Added water murkiness parameters to shaders.
This was SVN commit r4014.
This commit is contained in:
parent
2b0e5d0b42
commit
c97129d711
@ -7,19 +7,23 @@ uniform sampler2D reflectionMap;
|
||||
uniform sampler2D refractionMap;
|
||||
uniform float shininess;
|
||||
uniform float waviness;
|
||||
uniform vec3 tint;
|
||||
uniform float murkiness;
|
||||
uniform float fullDepth;
|
||||
|
||||
varying vec3 worldPos;
|
||||
varying vec3 waterColor;
|
||||
varying float waterDepth;
|
||||
varying float w;
|
||||
|
||||
const vec3 specularColor = vec3(0.2, 0.2, 0.2);
|
||||
const vec3 specularColor = vec3(0.15, 0.15, 0.15);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 n, l, h, v; // Normal, light vector, half-vector and view vector (vector to eye)
|
||||
float ndotl, ndoth, ndotv;
|
||||
float fresnel;
|
||||
float myMurkiness; // Murkiness and tint at this pixel (tweaked based on lighting and depth)
|
||||
vec3 myTint;
|
||||
float t;
|
||||
vec2 reflCoords, refrCoords;
|
||||
vec3 reflColor, refrColor, specular;
|
||||
@ -43,7 +47,9 @@ void main()
|
||||
|
||||
reflColor = texture2D(reflectionMap, reflCoords).rgb;
|
||||
|
||||
refrColor = (0.5 + 0.5*ndotl) * mix(texture2D(refractionMap, refrCoords).rgb, waterColor, 0.3);
|
||||
myMurkiness = murkiness * min(waterDepth / fullDepth, 1.0);
|
||||
myTint = (ambient + ndotl * sunColor) * tint;
|
||||
refrColor = (0.6 + 0.4*ndotl) * mix(texture2D(refractionMap, refrCoords).rgb, myTint, myMurkiness);
|
||||
|
||||
specular = pow(max(0.0, ndoth), shininess) * sunColor * specularColor;
|
||||
|
||||
|
@ -4,14 +4,12 @@ uniform mat4 refractionMatrix;
|
||||
attribute float vertexDepth;
|
||||
|
||||
varying vec3 worldPos;
|
||||
varying vec3 waterColor;
|
||||
varying float waterDepth;
|
||||
varying float w;
|
||||
|
||||
void main()
|
||||
{
|
||||
worldPos = gl_Vertex.xyz;
|
||||
waterColor = gl_Color.rgb;
|
||||
waterDepth = vertexDepth;
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_TexCoord[1] = reflectionMatrix * gl_Vertex; // projective texturing
|
||||
|
Loading…
Reference in New Issue
Block a user