In this guide we will be showing you how to automatically generate and configure levels of detail for static meshes in Unreal Engine 4.
What are LODs?
LOD (Level of Detail) is a technique found in all game engines that switches between different complexities of a 3D mesh over distance to reduce the amount of polygons that are needed to draw the scene.
These LODs, when setup correctly, will improve your games GPU performance!
Creating Levels of Detail
Firstly, to automatically generate different LODs for your static mesh, open the mesh from the content browser.
Once the mesh is shown find the LOD Settings tab in the details section on the right.
In the LOD settings section, increase the “Number of LODs” section to the amount of different levels of detail you want Unreal Engine to automatically generate.
Before we start, untick the Auto Computer LOD Distance box.
For this guide we are using four levels of detail.
Once this is done, press the Apply Changes button.
Reducing the Triangles
Underneath the LOD Picker section of the detail menu, you will see the current selected LOD.
As the LOD is set to AUTO the current LOD visible is based on the distance to the camera in the editor’s viewport.
To change which LOD you are adjusting, press the LOD drop down and select which LOD distance you want to edit.
To change the reduction amount for the selected LOD, simply open the reduction settings tab.
To lower the quality of this LOD, change the “Percent Triangles” to a smaller percentage.
The best method is to lower the percentage slowly over the different LODs.
For this guide I have setup the Percent Triangles like so:
LOD 0: 100.0
LOD 1: 85.0
LOD 2: 65.0
LOD 3: 35.0
Setting the Distances
To switch between the different LODs, the engine uses the screen size setting. This determines how big the object is on the screen before it changes LOD state.
To change this value, select the LOD that you want to edit in the LOD Picker above and find the Screen Size box. Change this value to what you think is best for your meshes.
Its best to tweak these values and test until you find a sweet spot for the asset that you are configuring.
For this guide I have setup the distances like so:
LOD 0: 1.0
LOD 1: 0.55
LOD 2: 0.175
LOD 3: 0.035
Creating a blueprint that uses the newly adjusted mesh or just dragging in your new mesh into the level will automatically switch between the LODs.
As you can see in the video below the triangles used to render the object is heavily reduced.
Now your meshes fade between LOD states improving performance for your game!
This technique is essential for creating games that will perform well on many different power of PCs and other platforms.
To improve on this, enable LOD dithering to fade between LOD states smoothly. Click here for a link to our guide on using LOD Dithering in Unreal Engine 4!
For more information on LODs in Unreal Engine 4 click here for the official documentation: https://docs.unrealengine.com/en-US/Engine/Content/Types/StaticMeshes/HowTo/index.html