In this lesson, you will learn how to reduce your GPU and CPU overhead by automatically pruning distant objects from the rendering pipeline using per-actor distance culling.
While techniques like Hierarchical Instanced Static Meshes (HISM) help manage density, sometimes you simply need an object to stop rendering entirely once it passes a specific distance threshold. Unreal Engine provides two primary ways to handle this: Distance Culling and Desired Max Draw Distance.
Configuring Distance Culling
You can find these settings in the Details panel of any StaticMeshActor.
- Desired Max Draw Distance: By setting this value (in Unreal units), you define the exact distance at which an actor disappears. This is an "all-or-nothing" approach; once the camera exceeds this value, the actor is removed from the render queue, instantly saving draw calls and reducing vertex processing.
- Cull Distance Volume: For larger scenes, manually setting hundreds of actors is inefficient. Instead, place a
CullDistanceVolumein your level. Inside this volume’sDetailspanel, you can define an array ofCull Distancesthat map specificSizevalues toCull Distanceranges. Any actor inside the volume will automatically adopt the cull distance corresponding to its bounding box size.
Optimizing by Screen Size
Beyond simple distance, you can also leverage Min/Max Draw Distance settings within the LOD section of a mesh. If you want a more precise trigger, you can use the Bounds Scale to artificially inflate or deflate an actor's perceived size, which influences when the engine decides to cull it based on the camera frustum.
// Example: Programmatically setting a cull distance on a spawned actor
MyStaticMeshActor->SetCullDistance(5000.0f);
By leveraging CullDistanceVolumes or individual actor settings, you ensure the render thread isn't wasting resources on pixels that are too small to perceive, allowing you to maintain high framerates even in dense, complex environments.
Key Takeaway: Distance culling shifts the burden of performance from your hardware to the engine's culling system, ensuring that objects are only rendered when they significantly contribute to the player's visual experience.