You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Use Reverse Z for the depth buffer
This commit is contained in:
committed by
Rémi Verschelde
parent
f47f4a02c8
commit
d950f5f838
@@ -483,8 +483,12 @@ void SSEffects::downsample_depth(Ref<RenderSceneBuffersRD> p_render_buffers, uin
|
||||
downsample_uniform_set = uniform_set_cache->get_cache_vec(shader, 2, u_depths);
|
||||
}
|
||||
|
||||
float depth_linearize_mul = -p_projection.columns[3][2] * 0.5;
|
||||
float depth_linearize_add = p_projection.columns[2][2];
|
||||
Projection correction;
|
||||
correction.set_depth_correction(false);
|
||||
Projection temp = correction * p_projection;
|
||||
|
||||
float depth_linearize_mul = -temp.columns[3][2];
|
||||
float depth_linearize_add = temp.columns[2][2];
|
||||
if (depth_linearize_mul * depth_linearize_add < 0) {
|
||||
depth_linearize_add = -depth_linearize_add;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user