mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 11:39:44 +00:00
try to estimate vertical water depth, not screen-direction water depth
This commit is contained in:
parent
56fe1a8c12
commit
2ea0bf91e6
1 changed files with 5 additions and 1 deletions
|
@ -254,7 +254,11 @@ void main(void)
|
||||||
// wobbly water: hard-fade into refraction texture at extremely low depth, with a wobble based on normal mapping
|
// wobbly water: hard-fade into refraction texture at extremely low depth, with a wobble based on normal mapping
|
||||||
vec3 normalShoreRippleRain = texture2D(normalMap,normalCoords(UV, 2.0, 2.7, -1.0*waterTimer, 0.05, 0.1, normal3)).rgb - 0.5
|
vec3 normalShoreRippleRain = texture2D(normalMap,normalCoords(UV, 2.0, 2.7, -1.0*waterTimer, 0.05, 0.1, normal3)).rgb - 0.5
|
||||||
+ texture2D(normalMap,normalCoords(UV, 2.0, 2.7, waterTimer, 0.04, -0.13, normal4)).rgb - 0.5;
|
+ texture2D(normalMap,normalCoords(UV, 2.0, 2.7, waterTimer, 0.04, -0.13, normal4)).rgb - 0.5;
|
||||||
float shoreOffset = clamp((realWaterDepth - (normal2.r + mix(0, normalShoreRippleRain.r, rainIntensity) + 0.35)*8), 0, 1);
|
float verticalWaterDepth = realWaterDepth * mix(abs(vVec.z), 1.0, 0.2); // an estimate
|
||||||
|
float shoreOffset = verticalWaterDepth - (normal2.r + mix(0, normalShoreRippleRain.r, rainIntensity) + 0.15)*8;
|
||||||
|
float fuzzFactor = min(1.0, 1000.0/surfaceDepth) * mix(abs(vVec.z), 1, 0.2);
|
||||||
|
shoreOffset *= fuzzFactor;
|
||||||
|
shoreOffset = clamp(shoreOffset, 0, 1);
|
||||||
gl_FragData[0].xyz = mix(rawRefraction, gl_FragData[0].xyz, shoreOffset);
|
gl_FragData[0].xyz = mix(rawRefraction, gl_FragData[0].xyz, shoreOffset);
|
||||||
#else
|
#else
|
||||||
gl_FragData[0].xyz = mix(reflection, waterColor, (1.0-fresnel)*0.5) + specular * gl_LightSource[0].specular.xyz + vec3(rainRipple.w) * 0.7;
|
gl_FragData[0].xyz = mix(reflection, waterColor, (1.0-fresnel)*0.5) + specular * gl_LightSource[0].specular.xyz + vec3(rainRipple.w) * 0.7;
|
||||||
|
|
Loading…
Reference in a new issue