mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-06 00:55:50 +00:00
Merge pull request #2785 from Capostrophic/underwaterfog
Don't radialize underwater fog
This commit is contained in:
commit
7aca6d72e4
@ -203,17 +203,20 @@ void main(void)
|
|||||||
float ior = (cameraPos.z>0.0)?(1.333/1.0):(1.0/1.333); // air to water; water to air
|
float ior = (cameraPos.z>0.0)?(1.333/1.0):(1.0/1.333); // air to water; water to air
|
||||||
float fresnel = clamp(fresnel_dielectric(vVec, normal, ior), 0.0, 1.0);
|
float fresnel = clamp(fresnel_dielectric(vVec, normal, ior), 0.0, 1.0);
|
||||||
|
|
||||||
|
float radialise = 1.0;
|
||||||
|
|
||||||
#if @radialFog
|
#if @radialFog
|
||||||
float radialDepth = distance(position.xyz, cameraPos);
|
float radialDepth = distance(position.xyz, cameraPos);
|
||||||
float radialize = radialDepth / linearDepth;
|
// TODO: Figure out how to properly radialise refraction depth and thus underwater fog
|
||||||
#else
|
// while avoiding oddities when the water plane is close to the clipping plane
|
||||||
float radialize = 1.0;
|
// radialise = radialDepth / linearDepth;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec2 screenCoordsOffset = normal.xy * REFL_BUMP;
|
vec2 screenCoordsOffset = normal.xy * REFL_BUMP;
|
||||||
#if REFRACTION
|
#if REFRACTION
|
||||||
float depthSample = linearizeDepth(texture2D(refractionDepthMap,screenCoords).x) * radialize;
|
float depthSample = linearizeDepth(texture2D(refractionDepthMap,screenCoords).x) * radialise;
|
||||||
float depthSampleDistorted = linearizeDepth(texture2D(refractionDepthMap,screenCoords-screenCoordsOffset).x) * radialize;
|
float depthSampleDistorted = linearizeDepth(texture2D(refractionDepthMap,screenCoords-screenCoordsOffset).x) * radialise;
|
||||||
float surfaceDepth = linearizeDepth(gl_FragCoord.z) * radialize;
|
float surfaceDepth = linearizeDepth(gl_FragCoord.z) * radialise;
|
||||||
float realWaterDepth = depthSample - surfaceDepth; // undistorted water depth in view direction, independent of frustum
|
float realWaterDepth = depthSample - surfaceDepth; // undistorted water depth in view direction, independent of frustum
|
||||||
screenCoordsOffset *= clamp(realWaterDepth / BUMP_SUPPRESS_DEPTH,0,1);
|
screenCoordsOffset *= clamp(realWaterDepth / BUMP_SUPPRESS_DEPTH,0,1);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user