diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-09-21 22:48:23 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2022-10-03 21:58:32 +0300 |
commit | 331fe92e4685f1cf84d6285a4209a72d007a82a0 (patch) | |
tree | b599fb8954fcb5ea0a285207d2f7e49e9f348413 | |
parent | 170e03aa98b20d9444884d37ae8fe8b48426fde4 (diff) |
Fix EEVEE: Screen Space Refraction Artefacts caused by viewport aspect ratio
This was caused by the vertical/horizontal clasification being done in
NDC space which wasn't respecting the Aspect ratio.
Multiplying the test vector by the target size fixes the issue.
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl b/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl index 1b2135646c9..ffbf6708a3d 100644 --- a/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl @@ -51,7 +51,8 @@ void raytrace_screenspace_ray_finalize(inout ScreenSpaceRay ray) } float ray_len_sqr = len_squared(ray.direction.xyz); /* Make ray.direction cover one pixel. */ - bool is_more_vertical = abs(ray.direction.x) < abs(ray.direction.y); + bool is_more_vertical = abs(ray.direction.x / ssrPixelSize.x) < + abs(ray.direction.y / ssrPixelSize.y); ray.direction /= (is_more_vertical) ? abs(ray.direction.y) : abs(ray.direction.x); ray.direction *= (is_more_vertical) ? ssrPixelSize.y : ssrPixelSize.x; /* Clip to segment's end. */ |