mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 13:12:42 +00:00
Fix SSR orientation issues when using orthogonal camera
- Use negative clip space values to fix reversed rotations in reflections - Use constant -z view vector when raymarching to fix perspective in reflections
This commit is contained in:
parent
26d1577f39
commit
56ed2cb6d1
@ -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));
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user