Use previous frame's transform for depth pre-pass in deferred renderer
This commit is contained in:
parent
91f693ed6e
commit
bd5622fc3b
1 changed files with 5 additions and 2 deletions
|
|
@ -861,6 +861,7 @@ void main()
|
|||
|
||||
query_array queries;
|
||||
gfx::array box_array;
|
||||
std::optional<geom::matrix<float, 4, 4>> prev_transform;
|
||||
};
|
||||
|
||||
deferred_renderer::deferred_renderer()
|
||||
|
|
@ -1262,7 +1263,7 @@ void main()
|
|||
|
||||
// Occlusion pre-pass
|
||||
|
||||
if (!buffer_size_changed)
|
||||
if (!buffer_size_changed && impl().prev_transform)
|
||||
{
|
||||
use_occlusion = true;
|
||||
|
||||
|
|
@ -1278,7 +1279,7 @@ void main()
|
|||
gl::Disable(gl::CULL_FACE);
|
||||
|
||||
impl().occlusion_pass_program.bind();
|
||||
impl().occlusion_pass_program["u_camera_transform"] = camera_transform;
|
||||
impl().occlusion_pass_program["u_camera_transform"] = *impl().prev_transform;
|
||||
impl().box_array.bind();
|
||||
|
||||
for (int bi = 0; bi < bins_total; ++bi)
|
||||
|
|
@ -1941,6 +1942,8 @@ void main()
|
|||
impl().bloom_overlay.invoke(impl().bloom_texture[2], target);
|
||||
}
|
||||
|
||||
impl().prev_transform = camera_transform;
|
||||
|
||||
check_error();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue