summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/windlight/moonF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/moonF.glsl18
1 files changed, 14 insertions, 4 deletions
diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
index 933625986c..8cc7fc3bb5 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
@@ -39,6 +39,7 @@ vec3 fullbrightScaleSoftClip(vec3 light);
uniform vec4 color;
uniform vec4 sunlight_color;
uniform vec3 lumWeights;
+uniform float moon_brightness;
uniform float minLuminance;
uniform sampler2D diffuseMap;
uniform sampler2D altDiffuseMap;
@@ -51,13 +52,22 @@ void main()
vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy);
vec4 c = mix(moonA, moonB, blend_factor);
- c.rgb = pow(c.rgb, vec3(0.45f));
+ 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.1, 0.3, 0.0);
- float mix = 1.0f - dot(sunlight_color.rgb, luma_weights);
- frag_color = vec4(c.rgb, mix * c.a);
+ 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));
+
+ frag_color = vec4(c.rgb, mix * (moon_brightness + (c.a * 0.25)));
}