Continue tracing screen space reflection after encountering sky
Instead of breaking the whole trace when encountering the sky/camera far clip, continue tracing and check if "hits" are sky/far clip or not. Prevents some objects not being reflected due to gaps.
This commit is contained in:
parent
9239412027
commit
48a59e6c4a
|
@ -157,18 +157,14 @@ void main() {
|
||||||
|
|
||||||
depth = imageLoad(source_depth, ivec2(pos - 0.5)).r;
|
depth = imageLoad(source_depth, ivec2(pos - 0.5)).r;
|
||||||
|
|
||||||
if (-depth >= params.camera_z_far) { //went beyond camera
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
z_from = z_to;
|
z_from = z_to;
|
||||||
z_to = z / w;
|
z_to = z / w;
|
||||||
|
|
||||||
if (depth > z_to) {
|
if (depth > z_to) {
|
||||||
// if depth was surpassed
|
// if depth was surpassed
|
||||||
if (depth <= max(z_to, z_from) + params.depth_tolerance) {
|
if (depth <= max(z_to, z_from) + params.depth_tolerance && -depth < params.camera_z_far) {
|
||||||
// check the depth tolerance
|
// check the depth tolerance and far clip
|
||||||
//check that normal is valid
|
// check that normal is valid
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue