Force frag depth in water shaders to avoid z-fighting at back edge of water edge pieces.
meow-7.2.2
Graham Linden 2019-01-30 10:38:41 -08:00
parent 12cd42221e
commit bd25688867
2 changed files with 6 additions and 1 deletions

View File

@ -167,7 +167,10 @@ void main()
color.a = spec * sunAngle2;
vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz);
// force frag depth which doesn't z-fight
gl_FragDepth = 0.99999f;
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

View File

@ -157,5 +157,7 @@ void main()
color.rgb = scaleSoftClip(color.rgb);
color.a = spec * sunAngle2;
// force frag depth to fix z-fighting at back edge of water edge pieces
gl_FragDepth = 0.99999;
frag_color = color;
}