VOXELRENDER: tweaked the shaders to minimize the distortion artifacts on the water borders
parent
f4ae7053b6
commit
7d8bcc2abd
|
@ -46,7 +46,7 @@ void main(void) {
|
||||||
|
|
||||||
float moveFactor = fract(u_time / 40000.0);
|
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;
|
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)
|
// 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
|
// 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);
|
o_color = fog(v_pos.xyz, mix(shadowColor, waterColor.xyz, 0.5), 0.5);
|
||||||
// add a blue tint and the specular highlights
|
// 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 = 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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue