occlusion culling improvement: removed depth bias, bounds are extended instead

This commit is contained in:
Turánszki János
2024-08-25 08:09:26 +02:00
parent 839b22aa63
commit b169d725e5
2 changed files with 11 additions and 4 deletions
+10 -3
View File
@@ -2286,8 +2286,8 @@ void SetUpStates()
rs.fill_mode = FillMode::SOLID;
rs.cull_mode = CullMode::NONE;
rs.front_counter_clockwise = true;
rs.depth_bias = 1;
rs.depth_bias_clamp = 0.01f;
rs.depth_bias = 0;
rs.depth_bias_clamp = 0;
rs.slope_scaled_depth_bias = 0;
rs.depth_clip_enable = false;
rs.multisample_enable = false;
@@ -5323,7 +5323,14 @@ void OcclusionCulling_Render(const CameraComponent& camera, const Visibility& vi
int queryIndex = occlusion_result.occlusionQueries[query_write];
if (queryIndex >= 0)
{
const AABB& aabb = vis.scene->aabb_objects[instanceIndex];
AABB aabb = vis.scene->aabb_objects[instanceIndex];
// extrude the bounding box a bit:
aabb._min.x -= 0.001f;
aabb._min.y -= 0.001f;
aabb._min.z -= 0.001f;
aabb._max.x += 0.001f;
aabb._max.y += 0.001f;
aabb._max.z += 0.001f;
const XMMATRIX transform = aabb.getAsBoxMatrix() * VP;
device->PushConstants(&transform, sizeof(transform), cmd);
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wi::version
// minor features, major updates, breaking compatibility changes
const int minor = 71;
// minor bug fixes, alterations, refactors, updates
const int revision = 554;
const int revision = 555;
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);