Update leenkx/Shaders/water_pass/water_pass.frag.glsl

This commit is contained in:
Onek8 2025-04-07 16:06:53 +00:00
parent 86661c1012
commit 79553927aa

View File

@ -75,16 +75,17 @@ vec4 binarySearch(vec3 dir) {
}
vec4 rayCast(vec3 dir) {
#ifdef _CPostprocess
dir *= PPComp9.x;
#else
dir *= ssrRayStep;
#endif
float ddepth;
dir *= ss_refractionRayStep;
for (int i = 0; i < maxSteps; i++) {
hitCoord += dir;
if (getDeltaDepth(hitCoord) > 0.0) return binarySearch(dir);
ddepth = getDeltaDepth(hitCoord);
if (ddepth > 0.0)
return binarySearch(dir);
}
return vec4(0.0);
// No hit — fallback to projecting the ray to UV space
vec2 fallbackUV = getProjectedCoord(hitCoord);
return vec4(fallbackUV, 0.0, 0.5); // We set .w lower to indicate fallback
}
#endif //SSR