Fix SSR warp when using orthogonal camera

This commit is contained in:
Mert Kasar 2024-07-11 20:38:06 +03:00
parent cfc4a0eff0
commit 5543f56ce2

View file

@ -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); 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; 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); vec3 view_dir = normalize(vertex);
#endif
vec3 ray_dir = normalize(reflect(view_dir, normal)); vec3 ray_dir = normalize(reflect(view_dir, normal));
if (dot(ray_dir, normal) < 0.001) { if (dot(ray_dir, normal) < 0.001) {