Merge pull request #94281 from mertkasar/3.x-ssr-orthogonal-warp-fix

[3.x] Fix SSR warp when using orthogonal camera
This commit is contained in:
lawnjelly 2024-07-14 17:59:46 +01:00 committed by GitHub
commit ff77fe81d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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);
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) {