From 5543f56ce20a2910f50ec6d7df33a1d735025ee5 Mon Sep 17 00:00:00 2001 From: Mert Kasar Date: Thu, 11 Jul 2024 20:38:06 +0300 Subject: [PATCH] Fix SSR warp when using orthogonal camera --- drivers/gles3/shaders/screen_space_reflection.glsl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gles3/shaders/screen_space_reflection.glsl b/drivers/gles3/shaders/screen_space_reflection.glsl index 7ac81a5aeb9..e42957364f2 100644 --- a/drivers/gles3/shaders/screen_space_reflection.glsl +++ b/drivers/gles3/shaders/screen_space_reflection.glsl @@ -67,7 +67,11 @@ void main() { vec4 world_pos = inverse_projection * vec4(uv_interp * 2.0 - 1.0, depth_tex * 2.0 - 1.0, 1.0); vec3 vertex = world_pos.xyz / world_pos.w; +#ifdef USE_ORTHOGONAL_PROJECTION + vec3 view_dir = vec3(0.0, 0.0, -1.0); +#else vec3 view_dir = normalize(vertex); +#endif vec3 ray_dir = normalize(reflect(view_dir, normal)); if (dot(ray_dir, normal) < 0.001) {