summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-10-30 18:17:47 +0100
committerGraham Linden <graham@lindenlab.com>2018-10-30 18:17:47 +0100
commit9a8e124fdecbeb57f65645d102f5f1767f8e4d16 (patch)
tree1457b7beb2ca152ec6fa63131369c8d1a7742de9 /indra/newview/app_settings/shaders/class1
parent2f97660ab7de0154ea3cadb1530b261f93bd31de (diff)
SL-9976 change moon blend/brightness handling in shaders and cleanup extraneous GL state management.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/moonF.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/moonF.glsl17
2 files changed, 8 insertions, 29 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
index f65a6eb32b..8bf4551abc 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
@@ -33,9 +33,6 @@ out vec4 frag_data[3];
#define frag_data gl_FragData
#endif
-vec3 fullbrightAtmosTransport(vec3 light);
-vec3 fullbrightScaleSoftClip(vec3 light);
-
uniform vec4 color;
uniform vec4 sunlight_color;
uniform vec3 lumWeights;
@@ -52,23 +49,16 @@ void main()
vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy);
vec4 c = mix(moonA, moonB, blend_factor);
- if (c.a < 0.1f)
- {
- discard;
- }
-
- c.rgb = pow(c.rgb, vec3(0.7f));
- c.rgb = fullbrightAtmosTransport(c.rgb);
- c.rgb = fullbrightScaleSoftClip(c.rgb);
-
// mix factor which blends when sunlight is brighter
// and shows true moon color at night
vec3 luma_weights = vec3(0.2, 0.3, 0.2);
- float mix = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights);
- c.rgb = pow(c.rgb, 1.2 - vec3(mix * moon_brightness));
+ float mix = 1.0 - dot(normalize(sunlight_color.rgb), luma_weights);
+
+ vec3 exp = vec3(1.0 - mix * moon_brightness) * 2.0 - 1.0;
+ c.rgb = pow(c.rgb, exp);
- frag_data[0] = vec4(c.rgb, mix * (moon_brightness + (c.a * 0.25)));
+ frag_data[0] = vec4(c.rgb, c.a);
frag_data[1] = vec4(0.0);
frag_data[2] = vec4(0.0f);
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
index 8cc7fc3bb5..b66b56e0fb 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
@@ -33,9 +33,6 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
-vec3 fullbrightAtmosTransport(vec3 light);
-vec3 fullbrightScaleSoftClip(vec3 light);
-
uniform vec4 color;
uniform vec4 sunlight_color;
uniform vec3 lumWeights;
@@ -52,22 +49,14 @@ void main()
vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy);
vec4 c = mix(moonA, moonB, blend_factor);
- if (c.a < 0.1f)
- {
- discard;
- }
-
- c.rgb = pow(c.rgb, vec3(0.7f));
- c.rgb = fullbrightAtmosTransport(c.rgb);
- c.rgb = fullbrightScaleSoftClip(c.rgb);
-
// mix factor which blends when sunlight is brighter
// and shows true moon color at night
vec3 luma_weights = vec3(0.2, 0.3, 0.2);
float mix = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights);
- c.rgb = pow(c.rgb, 1.2 - vec3(mix * moon_brightness));
+ vec3 exp = vec3(1.0 - mix * moon_brightness) * 2.0 - 1.0;
+ c.rgb = pow(c.rgb, exp);
- frag_color = vec4(c.rgb, mix * (moon_brightness + (c.a * 0.25)));
+ frag_color = vec4(c.rgb, c.a);
}