By Zac Jackson
Do you have a level that has too many objects in it, that seems to be loading or performing poorly? Cull distance volumes can help optimize your scene by not drawing objects (meshes) when they are small enough to be considered unimportant. Level Streaming will do close to the same thing, however, for the purpose of this tutorial, we will be sticking to cull distance volumes.
What is a Cull Distance Volume?
Cull Distance Volumes are optimization tools provided by the Unreal Engine that allow for meshes to be culled (not drawn to the screen) based on that meshes distance from the camera and its size. The mesh size is calculated using the longest dimension of the bounding box, and the cull distance chosen is the one closest to that size.
How to Use Cull Distance Volumes
Start a blank project or open up a blank level in your current project.
Add 3 cubes to your level: one big, one medium, and one small. This is to show you how the different properties in a cull distance volume work. You can find the cubes in the “Modes” section, under the “Basic” tab.
Scale them so that all 3 cubes are different sizes, ranging from small to large. Arrange them to be a little apart from each other.
Under the “Volumes” section under the “Modes” menu, select a Cull Distance volume and drag it into your level. Next, scale it so that the 3 cubes and the level are inside the volume.
NOTE: You can have more than one cull distance volume in a level depending on the size of the level, and the overall feel you are going for. This also is helpful with performance in towns for example. Adding a cull distance volume to the interior of a house so that when the player camera is outside of it, the meshes within it are not drawn is a good use of this.
Click on your cull distance volume and navigate to the “Details” panel. This is typically found in the bottom right corner. Once there scroll down to the “cull distance volume” tab.
NOTE: The culling distance volume details allow you to change the shape of the volume itself, along with many other items of customization including size. Experiment with these, to get the most use out of a cull distance volume for your level.
Under the “cull distance volume” tab, you can see that we can add “elements”. These elements give you the option of size and cull distance. The size option is the “bounding box” size of the object (in this case, our 3 boxes), and the “cull distance” is the distance at which that size of object should cull (not be drawn). Make sure there are 3 elements set up under this tab. Each element should represent the size of a box.
I’ve set my size and culling distance elements to the following sizes, as they are the approximate sizes of the small, medium, and large boxes.
From the above image, element 1 tells the engine to cull anything below 200 in size ( remember, this is bounding box size) from a distance of 800 units, element 2 tells the engine to cull anything that’s 300 or less in size from a distance of 1600 units, and the final element tells the engine to cull anything 450 or less in size from a distance of 2600 units.
Hit play and test out your cull distance volume. If you start from far away, you’ll notice that the large box draws first, followed by the medium box, and then the small box.
If you have a bunch of foliage instances in a bigger level and would like the same desired effect as a cull distance volume, you can modify some of the settings for each foliage type that you have in your scene.
Navigate to the Foliage editor.
Click on the foliage mesh that you would like to cull.
Under the “Instance settings” for the foliage there is a “Cull distance” option. This option allows the foliage to cull in between a minimum cull distance and a maximum. This makes it so that each instance of foliage your scene tries to load slightly more random (within the minimum /maximum distance that you set) so that all foliage instances do not load all at once (if you want this effect, make the minimum and maximum values the same).
FINAL NOTE: Cull distance volumes do not work with movable objects. To see if an object has been set as movable, navigate to the “Details” panel look for the “Mobility” option. Meshes can be set to either be static or movable here.
Do you have any level optimization techniques that you’d like to share? Let us know in the comments!