Level of Detail (LOD) is a technique to reduce mesh complexity as objects become more distant from the viewer.
LOD provides the following benefits:
- LOD reduces the number of vertices that must be processed.
- LOD avoids the micro triangles problem.
- LOD often looks better for objects that are placed further away in the scene.
Arm recommends that you optimize the LOD for every 3D object that has significant changes in distance from the camera.
The following image shows how you can use LOD management to reduce the complexity of a 3D model, while retaining an appropriate level of detail as the model moves further away from the camera:
Here are a few other things to remember when considering how to optimize your use of LOD:
- Consider how triangles affect the silhouette of objects when you are reducing triangle counts for LOD.
- LOD can also apply to shader complexity. The shader and material can be optimized for 3D objects that are further away. For example, by reducing the number of textures that are used.
- Remove more polygons on flatter areas.
- Use mipmaps as LOD for textures.
When to avoid LOD
LOD is not suitable in every situation. For example, avoid using LOD in a game where both the camera view and objects are static, or where the object is already using a low polygon count.
LOD comes with a memory overhead, and a larger file size. All of the LOD mesh data must be saved in memory, so that this data can be utilized in real time.
The following image shows a scene where LOD is not used because the scene is static. Instead, you can use other optimization tricks, like removing polygons that are never visible to the player:
Why use LOD
As an object goes further away from the camera, you can see less of the detail of that object. From twenty meters away, it is hard to see any difference between one version of an object with 200 triangles, and another version of the object with 2,000 triangles. Therefore, it is not necessary to use extra triangles that add nothing of value to the scene.
A few other key benefits of using LOD include:
- A boost in performance because fewer triangles must be processed
- Mitigation of problems that micro triangles cause
The following image shows you how distant objects look the same, even with different polygon counts:
Use an appropriate number of triangles
Here are some key points to consider when you decide the number of triangles in each LOD:
- It is often worth reducing the number of triangles between each LOD level by 50%.
- Do not use a dense number of triangles on lower LODs. These lower LODs are only seen when the object is further away.
- Check what the LODs look like at the correct distances from the camera on which they are meant to be seen. Lower LODs have lower resolution when viewed up close. This is okay, because they are not meant to be seen up close.
The following image shows you how an object can look when the number of polygons that are used drops by 50% for each level:
In the following image, the lower LOD object looks poor when viewed up close. However, their appearance is acceptable when they are viewed at the correct distance from the camera:
LOD triangle counts matter. This is because, if you do not reduce the polygon count enough on lower LOD objects, the performance of the game is negatively impacted. This is because the CPU is processing more vertices than is needed.
However, if you reduce the polygon count of your lower LOD objects too much, items look like they are popping in and out of detail in real time. This popping effect is noticeable to users, and could ruin their immersion in your game.
What is a reasonable number of LOD levels to use?
There is no precise number for how many LODs an object can have. It depends on both the size and importance of the object. For example, a character in an action game, or a car in racing game, can benefit from using more LOD levels than a small background object, like a tree.
If too few LOD levels are used, the effect would be:
- Reduced performance gain if the polygon reduction is not substantial enough between LOD levels.
- If there is too large a jump in polygon reduction, then the popping that happens on LOD switch is more noticeable.
If too many LOD levels are used, the effect is:
- Increased workload for the CPU, because more processing is needed to decide which LOD to display.
- Increased memory usage and larger file sizes to store the extra meshes.
- More time is required to create and verify the LOD models, especially if an artist creates them by hand. This is the largest cost.
Creating LOD meshes
When creating lower LOD meshes manually in 3D software from a higher LOD mesh, remove edge loops or reduce the number of vertices on a 3D object. While this gives more control to the artist, it can take a longer time to do.
When creating LOD meshes automatically, use a built-in modifier, or separate LOD generation software. As an example of built-in modifiers, in 3DS Max, use the ProOptimizer function, or the Generate LOD Meshes function within Maya.
Implementing LOD in Unity
For guidance on how to implement LOD in Unity, read Implementing Level of Detail in Unity.