diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/moonF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/moonF.glsl | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index 35068899ee..f3e7b2ee72 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -23,29 +23,16 @@ * $/LicenseInfo$ */ -#extension GL_ARB_texture_rectangle : enable - /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; -#else -#define frag_data gl_FragData -#endif +out vec4 frag_data[4]; uniform vec4 color; -uniform vec4 sunlight_color; -uniform vec4 moonlight_color; uniform vec3 moon_dir; uniform float moon_brightness; uniform sampler2D diffuseMap; -VARYING vec2 vary_texcoord0; - -vec3 srgb_to_linear(vec3 c); - -/// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light); +in vec2 vary_texcoord0; void main() { @@ -54,20 +41,21 @@ void main() if( moon_dir.z > 0 ) fade = clamp( moon_dir.z*moon_dir.z*4.0, 0.0, 1.0 ); - vec4 c = texture2D(diffuseMap, vary_texcoord0.xy); -// c.rgb = srgb_to_linear(c.rgb); - c.rgb *= moonlight_color.rgb; - c.rgb *= moon_brightness; + vec4 c = texture(diffuseMap, vary_texcoord0.xy); - c.rgb *= fade; - c.a *= fade; + // SL-14113 Don't write to depth; prevent moon's quad from hiding stars which should be visible + // Moon texture has transparent pixels <0x55,0x55,0x55,0x00> + if (c.a <= 2./255.) // 0.00784 + { + discard; + } - c.rgb = scaleSoftClip(c.rgb); + c.rgb *= moon_brightness; + c.a *= fade; - frag_data[0] = vec4(c.rgb, c.a); + frag_data[0] = vec4(0); frag_data[1] = vec4(0.0); - frag_data[2] = vec4(0.0f); - - gl_FragDepth = 0.999985f; + frag_data[2] = vec4(0.0, 0.0, 0.0, GBUFFER_FLAG_HAS_ATMOS); + frag_data[3] = vec4(c.rgb, c.a); } |