Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alchemy
Alchemy Next
Commits
df895cf6
Commit
df895cf6
authored
Aug 22, 2021
by
Rye Mutt
🍞
Browse files
Fix inconsistencies in deferred spotlight shaders with dist_atten, noise, and discarding
parent
01cbbda5
Changes
4
Hide whitespace changes
Inline
Side-by-side
indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
View file @
df895cf6
...
...
@@ -140,19 +140,7 @@ void main()
{
discard
;
}
float
envIntensity
;
vec3
norm
=
getNormWithEnvIntensity
(
frag
.
xy
,
envIntensity
);
float
l_dist
=
-
dot
(
lv
,
proj_n
);
vec4
proj_tc
=
(
proj_mat
*
vec4
(
pos
.
xyz
,
1
.
0
));
if
(
proj_tc
.
z
<
0
.
0
)
{
discard
;
}
proj_tc
.
xyz
/=
proj_tc
.
w
;
float
fa
=
falloff
+
1
.
0
;
float
dist_atten
=
clamp
(
1
.
0
-
(
dist
-
1
.
0
*
(
1
.
0
-
fa
))
/
fa
,
0
.
0
,
1
.
0
);
dist_atten
*=
dist_atten
;
...
...
@@ -162,9 +150,18 @@ void main()
{
discard
;
}
vec4
proj_tc
=
(
proj_mat
*
vec4
(
pos
.
xyz
,
1
.
0
));
if
(
proj_tc
.
z
<
0
.
0
)
{
discard
;
}
float
noise
=
texture2D
(
noiseMap
,
frag
.
xy
/
128
.
0
).
b
;
dist_atten
*=
noise
;
proj_tc
.
xyz
/=
proj_tc
.
w
;
float
envIntensity
;
vec3
norm
=
getNormWithEnvIntensity
(
frag
.
xy
,
envIntensity
);
float
l_dist
=
-
dot
(
lv
,
proj_n
);
lv
=
proj_origin
-
pos
.
xyz
;
lv
=
normalize
(
lv
);
...
...
@@ -181,6 +178,8 @@ void main()
proj_tc
.
x
>
0
.
0
&&
proj_tc
.
y
>
0
.
0
)
{
float
noise
=
texture2D
(
noiseMap
,
frag
.
xy
/
128
.
0
).
b
;
float
amb_da
=
proj_ambiance
;
float
lit
=
0
.
0
;
...
...
@@ -193,7 +192,7 @@ void main()
dlit
=
color
.
rgb
*
plcol
.
rgb
*
plcol
.
a
;
lit
=
da
*
dist_atten
;
lit
=
da
*
dist_atten
*
noise
;
col
=
dlit
*
lit
*
diff_tex
;
amb_da
+=
(
da
*
0
.
5
)
*
proj_ambiance
;
...
...
indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
View file @
df895cf6
...
...
@@ -140,21 +140,9 @@ void main()
{
discard
;
}
float
envIntensity
;
vec3
norm
=
getNormWithEnvIntensity
(
frag
.
xy
,
envIntensity
);
float
l_dist
=
-
dot
(
lv
,
proj_n
);
vec4
proj_tc
=
(
proj_mat
*
vec4
(
pos
.
xyz
,
1
.
0
));
if
(
proj_tc
.
z
<
0
.
0
)
{
discard
;
}
proj_tc
.
xyz
/=
proj_tc
.
w
;
float
fa
=
falloff
+
1
.
0
;
float
dist_atten
=
min
(
1
.
0
-
(
dist
-
1
.
0
*
(
1
.
0
-
fa
))
/
fa
,
1
.
0
);
float
dist_atten
=
clamp
(
1
.
0
-
(
dist
-
1
.
0
*
(
1
.
0
-
fa
))
/
fa
,
0
.
0
,
1
.
0
);
dist_atten
*=
dist_atten
;
dist_atten
*=
2
.
0
;
...
...
@@ -162,7 +150,19 @@ void main()
{
discard
;
}
vec4
proj_tc
=
(
proj_mat
*
vec4
(
pos
.
xyz
,
1
.
0
));
if
(
proj_tc
.
z
<
0
.
0
)
{
discard
;
}
proj_tc
.
xyz
/=
proj_tc
.
w
;
float
envIntensity
;
vec3
norm
=
getNormWithEnvIntensity
(
frag
.
xy
,
envIntensity
);
float
l_dist
=
-
dot
(
lv
,
proj_n
);
lv
=
proj_origin
-
pos
.
xyz
;
lv
=
normalize
(
lv
);
float
da
=
dot
(
norm
,
lv
);
...
...
@@ -170,7 +170,6 @@ void main()
vec3
diff_tex
=
texture2DRect
(
diffuseRect
,
frag
.
xy
).
rgb
;
//light shaders output linear and are gamma corrected later in postDeferredGammaCorrectF.glsl
float
noise
=
texture2D
(
noiseMap
,
frag
.
xy
/
128
.
0
).
b
;
vec3
dlit
=
vec3
(
0
,
0
,
0
);
if
(
proj_tc
.
z
>
0
.
0
&&
...
...
@@ -179,6 +178,8 @@ void main()
proj_tc
.
x
>
0
.
0
&&
proj_tc
.
y
>
0
.
0
)
{
float
noise
=
texture2D
(
noiseMap
,
frag
.
xy
/
128
.
0
).
b
;
float
amb_da
=
proj_ambiance
;
float
lit
=
0
.
0
;
...
...
indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
View file @
df895cf6
...
...
@@ -144,6 +144,23 @@ void main()
}
dist
/=
size
;
float
fa
=
falloff
+
1
.
0
;
float
dist_atten
=
clamp
(
1
.
0
-
(
dist
-
1
.
0
*
(
1
.
0
-
fa
))
/
fa
,
0
.
0
,
1
.
0
);
dist_atten
*=
dist_atten
;
dist_atten
*=
2
.
0
;
if
(
dist_atten
<=
0
.
0
)
{
discard
;
}
vec4
proj_tc
=
(
proj_mat
*
vec4
(
pos
.
xyz
,
1
.
0
));
if
(
proj_tc
.
z
<
0
.
0
)
{
discard
;
}
proj_tc
.
xyz
/=
proj_tc
.
w
;
float
shadow
=
1
.
0
;
if
(
proj_shadow_idx
>=
0
)
...
...
@@ -158,40 +175,22 @@ void main()
vec3
norm
=
getNormWithEnvIntensity
(
frag
.
xy
,
envIntensity
);
float
l_dist
=
-
dot
(
lv
,
proj_n
);
vec4
proj_tc
=
(
proj_mat
*
vec4
(
pos
.
xyz
,
1
.
0
));
if
(
proj_tc
.
z
<
0
.
0
)
{
discard
;
}
proj_tc
.
xyz
/=
proj_tc
.
w
;
float
fa
=
falloff
+
1
.
0
;
float
dist_atten
=
min
(
1
.
0
-
(
dist
-
1
.
0
*
(
1
.
0
-
fa
))
/
fa
,
1
.
0
);
dist_atten
*=
dist_atten
;
dist_atten
*=
2
.
0
;
if
(
dist_atten
<=
0
.
0
)
{
discard
;
}
lv
=
proj_origin
-
pos
.
xyz
;
lv
=
normalize
(
lv
);
float
da
=
dot
(
norm
,
lv
);
vec3
diff_tex
=
texture2DRect
(
diffuseRect
,
frag
.
xy
).
rgb
;
vec4
spec
=
texture2DRect
(
specularRect
,
frag
.
xy
);
vec3
dlit
=
vec3
(
0
,
0
,
0
);
float
noise
=
texture2D
(
noiseMap
,
frag
.
xy
/
128
.
0
).
b
;
if
(
proj_tc
.
z
>
0
.
0
&&
proj_tc
.
x
<
1
.
0
&&
proj_tc
.
y
<
1
.
0
&&
proj_tc
.
x
>
0
.
0
&&
proj_tc
.
y
>
0
.
0
)
{
float
noise
=
texture2D
(
noiseMap
,
frag
.
xy
/
128
.
0
).
b
;
float
amb_da
=
proj_ambiance
;
float
lit
=
0
.
0
;
...
...
@@ -223,7 +222,7 @@ void main()
col
+=
amb_da
*
color
.
rgb
*
diff_tex
.
rgb
*
amb_plcol
.
rgb
*
amb_plcol
.
a
;
}
vec4
spec
=
texture2DRect
(
specularRect
,
frag
.
xy
);
if
(
spec
.
a
>
0
.
0
)
{
vec3
npos
=
-
normalize
(
pos
);
...
...
indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
View file @
df895cf6
...
...
@@ -143,6 +143,24 @@ void main()
}
dist
/=
size
;
float
fa
=
falloff
+
1
.
0
;
float
dist_atten
=
clamp
(
1
.
0
-
(
dist
-
1
.
0
*
(
1
.
0
-
fa
))
/
fa
,
0
.
0
,
1
.
0
);
dist_atten
*=
dist_atten
;
dist_atten
*=
2
.
0
;
if
(
dist_atten
<=
0
.
0
)
{
discard
;
}
vec4
proj_tc
=
(
proj_mat
*
vec4
(
pos
.
xyz
,
1
.
0
));
if
(
proj_tc
.
z
<
0
.
0
)
{
discard
;
}
proj_tc
.
xyz
/=
proj_tc
.
w
;
float
shadow
=
1
.
0
;
if
(
proj_shadow_idx
>=
0
)
...
...
@@ -157,40 +175,23 @@ void main()
vec3
norm
=
getNormWithEnvIntensity
(
frag
.
xy
,
envIntensity
);
float
l_dist
=
-
dot
(
lv
,
proj_n
);
vec4
proj_tc
=
(
proj_mat
*
vec4
(
pos
.
xyz
,
1
.
0
));
if
(
proj_tc
.
z
<
0
.
0
)
{
discard
;
}
proj_tc
.
xyz
/=
proj_tc
.
w
;
float
fa
=
falloff
+
1
.
0
;
float
dist_atten
=
min
(
1
.
0
-
(
dist
-
1
.
0
*
(
1
.
0
-
fa
))
/
fa
,
1
.
0
);
dist_atten
*=
dist_atten
;
dist_atten
*=
2
.
0
;
if
(
dist_atten
<=
0
.
0
)
{
discard
;
}
lv
=
proj_origin
-
pos
.
xyz
;
lv
=
normalize
(
lv
);
float
da
=
dot
(
norm
,
lv
);
vec3
diff_tex
=
texture2DRect
(
diffuseRect
,
frag
.
xy
).
rgb
;
vec4
spec
=
texture2DRect
(
specularRect
,
frag
.
xy
);
vec3
dlit
=
vec3
(
0
,
0
,
0
);
float
noise
=
texture2D
(
noiseMap
,
frag
.
xy
/
128
.
0
).
b
;
if
(
proj_tc
.
z
>
0
.
0
&&
proj_tc
.
x
<
1
.
0
&&
proj_tc
.
y
<
1
.
0
&&
proj_tc
.
x
>
0
.
0
&&
proj_tc
.
y
>
0
.
0
)
{
float
noise
=
texture2D
(
noiseMap
,
frag
.
xy
/
128
.
0
).
b
;
float
amb_da
=
proj_ambiance
;
float
lit
=
0
.
0
;
...
...
@@ -220,6 +221,7 @@ void main()
col
+=
amb_da
*
color
.
rgb
*
diff_tex
.
rgb
*
amb_plcol
.
rgb
*
amb_plcol
.
a
;
}
vec4
spec
=
texture2DRect
(
specularRect
,
frag
.
xy
);
if
(
spec
.
a
>
0
.
0
)
{
dlit
*=
min
(
da
*
6
.
0
,
1
.
0
)
*
dist_atten
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment