summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-01-25 10:34:42 -0800
committerGraham Linden <graham@lindenlab.com>2019-01-25 10:34:42 -0800
commit88d4d85711a25772f3659850902e3a395ef2358c (patch)
tree9a7018cdb86dd4c0dbda2f5a50f954e66a0eba26 /indra/newview/app_settings/shaders/class1/deferred
parentb33f9c4533b1d2f539baf65820ccb07a89389e72 (diff)
SL-10303
Modify sun disc shader to better position itself within the sun glow and to fade as the sun approaches the horizon (to mask where the position difference is greatest).
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl16
2 files changed, 19 insertions, 11 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
index 3557c0766e..c66f3f62b2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl
@@ -40,17 +40,21 @@ uniform sampler2D diffuseMap;
uniform sampler2D altDiffuseMap;
uniform float blend_factor; // interp factor between sunDisc A/B
VARYING vec2 vary_texcoord0;
+VARYING float sun_fade;
void main()
{
- vec4 sunDiscA = texture2D(diffuseMap, vary_texcoord0.xy);
- vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy);
+ vec4 sunDiscA = texture2D(diffuseMap, vary_texcoord0.xy);
+ vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy);
vec4 c = mix(sunDiscA, sunDiscB, blend_factor);
c.rgb = clamp(c.rgb, vec3(0), vec3(1));
- c.rgb = pow(c.rgb, vec3(0.7f));
- c.rgb = fullbrightAtmosTransport(c.rgb);
+ c.rgb = pow(c.rgb, vec3(0.7f));
+ c.rgb = fullbrightAtmosTransport(c.rgb);
c.rgb = fullbrightScaleSoftClip(c.rgb);
- frag_data[0] = c;
+
+ c.a *= sun_fade;
+
+ frag_data[0] = c;
frag_data[1] = vec4(0.0f);
frag_data[2] = vec4(0.0, 1.0, 0.0, 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl
index c67ed8e6d9..0d117c6bc7 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl
@@ -31,18 +31,22 @@ ATTRIBUTE vec3 position;
ATTRIBUTE vec2 texcoord0;
VARYING vec2 vary_texcoord0;
+VARYING float sun_fade;
void calcAtmospherics(vec3 eye_pos);
void main()
{
- //transform vertex
- vec4 vert = vec4(position.xyz - vec3(0, 0, 50), 1.0);
- vec4 pos = modelview_projection_matrix*vert;
+ //transform vertex
+ vec3 offset = vec3(0, 0, 50);
+ vec4 vert = vec4(position.xyz - offset, 1.0);
+ vec4 pos = modelview_projection_matrix*vert;
- gl_Position = pos;
-
+ sun_fade = smoothstep(0.3, 1.0, (position.z + 50) / 512.0f);
+
+ gl_Position = pos;
+
calcAtmospherics(pos.xyz);
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
}