mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 23:31:53 -05:00
Fix occlusion culling jitter
This commit is contained in:
@@ -536,8 +536,6 @@ Projection RaycastOcclusionCull::_jitter_projection(const Projection &p_cam_proj
|
|||||||
return p_cam_projection;
|
return p_cam_projection;
|
||||||
}
|
}
|
||||||
|
|
||||||
Projection p = p_cam_projection;
|
|
||||||
|
|
||||||
int32_t frame = Engine::get_singleton()->get_frames_drawn();
|
int32_t frame = Engine::get_singleton()->get_frames_drawn();
|
||||||
frame %= 9;
|
frame %= 9;
|
||||||
|
|
||||||
@@ -577,11 +575,11 @@ Projection RaycastOcclusionCull::_jitter_projection(const Projection &p_cam_proj
|
|||||||
// Higher divergence gives fewer false hidden, but more false shown.
|
// Higher divergence gives fewer false hidden, but more false shown.
|
||||||
// False hidden is obvious to viewer, false shown is not.
|
// False hidden is obvious to viewer, false shown is not.
|
||||||
// False shown can lower percentage that are occluded, and therefore performance.
|
// False shown can lower percentage that are occluded, and therefore performance.
|
||||||
jitter *= Vector2(1 / (float)p_viewport_size.x, 1 / (float)p_viewport_size.y) * 0.05f;
|
jitter *= Vector2(1 / (float)p_viewport_size.x, 1 / (float)p_viewport_size.y) * 0.9f;
|
||||||
|
|
||||||
p.add_jitter_offset(jitter);
|
Projection correction;
|
||||||
|
correction.add_jitter_offset(jitter);
|
||||||
return p;
|
return correction * p_cam_projection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaycastOcclusionCull::buffer_update(RID p_buffer, const Transform3D &p_cam_transform, const Projection &p_cam_projection, bool p_cam_orthogonal) {
|
void RaycastOcclusionCull::buffer_update(RID p_buffer, const Transform3D &p_cam_transform, const Projection &p_cam_projection, bool p_cam_orthogonal) {
|
||||||
|
|||||||
Reference in New Issue
Block a user