VOXELRENDER: tweaked the shaders to minimize the distortion artifacts on the water borders

Martin Gerhardy 2020-03-07 10:38:49 +01:00
parent f4ae7053b6
commit 7d8bcc2abd
1 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ void main(void) {
float moveFactor = fract(u_time / 40000.0);
vec2 distortedTexCoords = $texture2D(u_distortion, 10.0 * vec2(v_uv.x + moveFactor, v_uv.y)).rg * 0.01;
distortedTexCoords = v_uv + vec2(distortedTexCoords.x, distortedTexCoords.y + moveFactor);
distortedTexCoords = v_uv + vec2(distortedTexCoords.x, distortedTexCoords.y + moveFactor) * clamp(depthWater, 0.0, 1.0) ;
// b component of the normal map is upward (so our y)
// r and g are mapped onto x and z and converted to allow negative values
@ -85,5 +85,5 @@ void main(void) {
o_color = fog(v_pos.xyz, mix(shadowColor, waterColor.xyz, 0.5), 0.5);
// add a blue tint and the specular highlights
o_color = mix(o_color, vec4(0.0, 0.3, 0.5, 1.0), 0.2) + vec4(lightColor, 0.0);
//o_color = vec4(depthWater / 50.0, depthWater / 50.0, depthWater / 50.0, 1.0);
o_color.a = clamp(depthWater / 5.0, 0.0, 1.0);
}