diff options
author | Arman <48544263+puchik@users.noreply.github.com> | 2020-05-22 00:12:42 -0700 |
---|---|---|
committer | Arman <48544263+puchik@users.noreply.github.com> | 2020-05-22 00:12:42 -0700 |
commit | 48a59e6c4aee952af7d5d1ce9a5234ded98f89d9 (patch) | |
tree | 08cad70976907c396eb89eeb695d2df20d3a2143 /servers | |
parent | 9239412027b6c25009efab69dc39650e0d76c56d (diff) |
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.
Diffstat (limited to 'servers')
-rw-r--r-- | servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl index 084f28d932..3d2a8638af 100644 --- a/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl +++ b/servers/rendering/rasterizer_rd/shaders/screen_space_reflection.glsl @@ -157,18 +157,14 @@ void main() { depth = imageLoad(source_depth, ivec2(pos - 0.5)).r; - if (-depth >= params.camera_z_far) { //went beyond camera - break; - } - z_from = z_to; z_to = z / w; if (depth > z_to) { // if depth was surpassed - if (depth <= max(z_to, z_from) + params.depth_tolerance) { - // check the depth tolerance - //check that normal is valid + if (depth <= max(z_to, z_from) + params.depth_tolerance && -depth < params.camera_z_far) { + // check the depth tolerance and far clip + // check that normal is valid found = true; } break; |