From 767fb53aeb1ac92a141586b1c0b5d1e5d327b281 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 31 Jan 2019 09:56:37 -0800 Subject: 9996 partial fix (works for non-ALM rendering only) Use a new edge water shader to allow forcing frag depth to avoid z-fighting at back edge of water edge pieces. This will not work for ALM because forcing the depth breaks the use of the depth to backproject gbuffer position which breaks lighting calcs. --- indra/newview/app_settings/shaders/class1/deferred/waterF.glsl | 5 ----- indra/newview/app_settings/shaders/class1/environment/waterF.glsl | 5 ++--- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'indra/newview/app_settings/shaders') diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl index df7b8f3f92..40d4c24d34 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl @@ -169,11 +169,6 @@ void main() vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz); -#if defined(WATER_EDGE) - // force frag depth which doesn't z-fight - gl_FragDepth = 0.99999f; -#endif - frag_data[0] = vec4(color.rgb, color); // diffuse frag_data[1] = vec4(0); // speccolor, spec frag_data[2] = vec4(encode_normal(screenspacewavef.xyz*0.5+0.5), 0.05, 0);// normalxy, 0, 0 diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl index 415d0b9db4..f228deb938 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl @@ -157,9 +157,8 @@ void main() color.rgb = scaleSoftClip(color.rgb); color.a = spec * sunAngle2; -#if defined(WATER_EDGE) - // force frag depth to fix z-fighting at back edge of water edge pieces - gl_FragDepth = 0.99999; +#if WATER_EDGE + gl_FragDepth = 0.9999847f; #endif frag_color = color; -- cgit v1.2.3