Update leenkx/Shaders/water_pass/water_pass.frag.glsl
This commit is contained in:
parent
86661c1012
commit
79553927aa
@ -75,16 +75,17 @@ vec4 binarySearch(vec3 dir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vec4 rayCast(vec3 dir) {
|
vec4 rayCast(vec3 dir) {
|
||||||
#ifdef _CPostprocess
|
float ddepth;
|
||||||
dir *= PPComp9.x;
|
dir *= ss_refractionRayStep;
|
||||||
#else
|
for (int i = 0; i < maxSteps; i++) {
|
||||||
dir *= ssrRayStep;
|
hitCoord += dir;
|
||||||
#endif
|
ddepth = getDeltaDepth(hitCoord);
|
||||||
for (int i = 0; i < maxSteps; i++) {
|
if (ddepth > 0.0)
|
||||||
hitCoord += dir;
|
return binarySearch(dir);
|
||||||
if (getDeltaDepth(hitCoord) > 0.0) return binarySearch(dir);
|
}
|
||||||
}
|
// No hit — fallback to projecting the ray to UV space
|
||||||
return vec4(0.0);
|
vec2 fallbackUV = getProjectedCoord(hitCoord);
|
||||||
|
return vec4(fallbackUV, 0.0, 0.5); // We set .w lower to indicate fallback
|
||||||
}
|
}
|
||||||
#endif //SSR
|
#endif //SSR
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user