summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-10-08 22:08:35 +0100
committerGraham Linden <graham@lindenlab.com>2018-10-08 22:08:35 +0100
commitffc6393309d06446f9d1361f0f0282b2110768ae (patch)
treef2a802ab7710126521be6826b8d5e3d5993de858 /indra/newview/app_settings/shaders/class1/deferred
parent5eed233618abd7020e130799be2abe0f986543f6 (diff)
SL-9751
Add optional moon brightness setting
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/moonF.glsl15
1 files changed, 12 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
index e86bca3ddd..f65a6eb32b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/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,15 +52,23 @@ 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.1, 0.3, 0.0);
- float mix = 1.0f - dot(sunlight_color.rgb, luma_weights);
- frag_data[0] = 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_data[0] = vec4(c.rgb, mix * (moon_brightness + (c.a * 0.25)));
frag_data[1] = vec4(0.0);
frag_data[2] = vec4(0.0f);
}