Skip to content

Culling

EntropyPortal employs a multi-stage culling system to minimize the number of objects submitted to the GPU.

The VisibilityService maintains a spatial index of all renderable entities in the scene.

  • Structure: A loose Octree (or similar spatial partition).
  • Updates: Handling dynamic objects vs static objects.

For each camera (Main, Shadow Cascade, Probe):

  1. Extract the camera’s view frustum planes.
  2. Query the spatial index for objects within the frustum.
  3. Result: A list of potentially visible EntityIDs.

This coarse culling removes the majority of off-screen objects.

graph TD
    Cam[Camera] --> Planes["Extract Frustum Planes"]
    Planes --> Query["Query Octree"]
    Query --> Traverse{Traverse Nodes}
    Traverse -->|Inside| Add["Add to List"]
    Traverse -->|Outside| Skip["Discard Node"]
    Add --> Result["Visible Entity List"]

Note: This feature is planned but not yet fully implemented.

Occlusion culling uses a low-resolution depth buffer (Hi-Z) to discard objects that are hidden behind others.

  • Two-Pass Approach: Render occluders -> Build Hi-Z -> Cull occludees.
  • Compute Shader: Bounding boxes are tested against the depth pyramid.

As part of the Clustered Shading pipeline, lights are culled against the view frustum clusters. This ensures that a fragment only processes lights that actually affect it.