Merge pull request #94184 from mertkasar/ssr-rotation-fix

Fix SSR orientation issues when using orthogonal camera
This commit is contained in:
Rémi Verschelde 2024-07-17 11:43:25 +02:00
commit c2375d0b12
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 2 additions and 2 deletions

View File

@ -90,7 +90,7 @@ void main() {
if (sc_multiview) {
view_dir = normalize(vertex + scene_data.eye_offset[params.view_index].xyz);
} else {
view_dir = normalize(vertex);
view_dir = params.orthogonal ? vec3(0.0, 0.0, -1.0) : normalize(vertex);
}
vec3 ray_dir = normalize(reflect(view_dir, normal));

View File

@ -20,7 +20,7 @@ vec3 reconstructCSPosition(vec2 screen_pos, float z) {
return pos.xyz;
} else {
if (params.orthogonal) {
return vec3((screen_pos.xy * params.proj_info.xy + params.proj_info.zw), z);
return vec3(-(screen_pos.xy * params.proj_info.xy + params.proj_info.zw), z);
} else {
return vec3((screen_pos.xy * params.proj_info.xy + params.proj_info.zw) * z, z);
}