1
0
forked from 0ad/0ad

Small updates to the water shader: Refractions will now be less wavy than reflections, which makes it slightly easier to look through the water, and the water will get less transparent faster at low view angles (my project used different scale so this wasn't happening as fast as it should).

This was SVN commit r3920.
This commit is contained in:
Matei 2006-05-31 22:39:29 +00:00
parent aa9a1c4f29
commit ccb468e337

View File

@ -39,7 +39,7 @@ void main()
reflCoords += waviness * n.xz / w;
refrCoords = 0.5 * (gl_TexCoord[2].xy / gl_TexCoord[2].w) + 0.5; // Unbias texture coords
refrCoords -= waviness * n.xz / w;
refrCoords -= 0.8 * waviness * n.xz / w; // Refractions can be slightly less wavy
reflColor = texture2D(reflectionMap, reflCoords).rgb;
@ -51,6 +51,6 @@ void main()
// Make alpha vary based on both depth (so it blends with the shore) and view angle (make it
// become opaque faster at lower view angles so we can't look "underneath" the water plane)
t = 8.0 * max(0.0, 0.7 - v.y);
t = 18.0 * max(0.0, 0.7 - v.y);
gl_FragColor.a = 0.15 * waterDepth * (1.2 + t + fresnel);
}