mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-07 12:54:00 +00:00
fix silhouettes around objects above the water
This commit is contained in:
parent
97c45455fd
commit
4ae0a5c02e
@ -118,7 +118,6 @@
|
|||||||
#define WAVE_CHOPPYNESS 0.15 // wave choppyness
|
#define WAVE_CHOPPYNESS 0.15 // wave choppyness
|
||||||
#define WAVE_SCALE 75 // overall wave scale
|
#define WAVE_SCALE 75 // overall wave scale
|
||||||
|
|
||||||
#define ABBERATION 0.001 // chromatic abberation amount
|
|
||||||
#define BUMP 1.5 // overall water surface bumpiness
|
#define BUMP 1.5 // overall water surface bumpiness
|
||||||
#define REFL_BUMP 0.08 // reflection distortion amount
|
#define REFL_BUMP 0.08 // reflection distortion amount
|
||||||
#define REFR_BUMP 0.06 // refraction distortion amount
|
#define REFR_BUMP 0.06 // refraction distortion amount
|
||||||
@ -256,11 +255,15 @@
|
|||||||
|
|
||||||
// refraction
|
// refraction
|
||||||
float3 R = reflect(vVec, normal);
|
float3 R = reflect(vVec, normal);
|
||||||
|
|
||||||
|
// check the depth at the refracted coords, and don't do any normal distortion for the refraction if the object to refract
|
||||||
|
// is actually above the water (objectDepth < waterDepth)
|
||||||
|
// this solves silhouettes around objects above the water
|
||||||
|
float refractDepth = shSample(depthMap, screenCoords-(shoreFade * normal.xz*REFR_BUMP)).x * far - depthPassthrough;
|
||||||
|
float doRefraction = (refractDepth < 0) ? 0.f : 1.f;
|
||||||
|
|
||||||
float3 refraction = float3(0,0,0);
|
float3 refraction = float3(0,0,0);
|
||||||
refraction.r = shSample(refractionMap, (screenCoords-(shoreFade * normal.xz*REFR_BUMP))*1.0).r;
|
refraction.rgb = shSample(refractionMap, (screenCoords-(shoreFade * normal.xz*REFR_BUMP * doRefraction))*1.0).rgb;
|
||||||
refraction.g = shSample(refractionMap, (screenCoords-(shoreFade * normal.xz*REFR_BUMP))*1.0-(R.xy*ABBERATION)).g;
|
|
||||||
refraction.b = shSample(refractionMap, (screenCoords-(shoreFade * normal.xz*REFR_BUMP))*1.0-(R.xy*ABBERATION*2.0)).b;
|
|
||||||
|
|
||||||
// brighten up the refraction underwater
|
// brighten up the refraction underwater
|
||||||
refraction = (cameraPos.y < 0) ? shSaturate(refraction * 1.5) : refraction;
|
refraction = (cameraPos.y < 0) ? shSaturate(refraction * 1.5) : refraction;
|
||||||
|
Loading…
Reference in New Issue
Block a user