mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:53:52 +00:00
add bit to suppress coastline artifacts at more of a distance
This commit is contained in:
parent
bf336e4cb4
commit
1a4e9df707
1 changed files with 5 additions and 1 deletions
|
@ -34,6 +34,7 @@ const vec3 SUN_EXT = vec3(0.45, 0.55, 0.68); //sunlight extinction
|
||||||
const float SPEC_HARDNESS = 256.0; // specular highlights hardness
|
const float SPEC_HARDNESS = 256.0; // specular highlights hardness
|
||||||
|
|
||||||
const float BUMP_SUPPRESS_DEPTH = 300.0; // at what water depth bumpmap will be suppressed for reflections and refractions (prevents artifacts at shores)
|
const float BUMP_SUPPRESS_DEPTH = 300.0; // at what water depth bumpmap will be suppressed for reflections and refractions (prevents artifacts at shores)
|
||||||
|
const float BUMP_SUPPRESS_DEPTH_SS = 1000.0; // modifier using screenspace depth (helps prevent same artifacts but at higher distances)
|
||||||
|
|
||||||
const vec2 WIND_DIR = vec2(0.5f, -0.8f);
|
const vec2 WIND_DIR = vec2(0.5f, -0.8f);
|
||||||
const float WIND_SPEED = 0.2f;
|
const float WIND_SPEED = 0.2f;
|
||||||
|
@ -218,7 +219,10 @@ void main(void)
|
||||||
float depthSampleDistorted = linearizeDepth(texture2D(refractionDepthMap,screenCoords-screenCoordsOffset).x) * radialise;
|
float depthSampleDistorted = linearizeDepth(texture2D(refractionDepthMap,screenCoords-screenCoordsOffset).x) * radialise;
|
||||||
float surfaceDepth = linearizeDepth(gl_FragCoord.z) * radialise;
|
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
|
||||||
|
* max(1, depthSample / BUMP_SUPPRESS_DEPTH_SS)) // suppress more at distance
|
||||||
|
,0 ,1);
|
||||||
#endif
|
#endif
|
||||||
// reflection
|
// reflection
|
||||||
vec3 reflection = texture2D(reflectionMap, screenCoords + screenCoordsOffset).rgb;
|
vec3 reflection = texture2D(reflectionMap, screenCoords + screenCoordsOffset).rgb;
|
||||||
|
|
Loading…
Reference in a new issue