Level of Detail

Tutorial

·

intermediate

·

+0XP

·

25 mins

·

(167)

Unity Technologies

Level of Detail

In this tutorial, you will learn about the different use cases in which Level of Detail (LOD) can help highlight details in your 3D models at varying distances while optimizing application performance.

Languages available:

1. Overview

Level of Detail (LOD) allows you to control the number of vertices that are rendered for each object in your Scene depending on the object’s distance from the camera. Doing this will improve your application’s performance.


LOD also avoids the micro triangles problem discussed in the last tutorial for distant objects. We recommend that you optimize the LOD for every 3D object whose distance from the camera changes while the application is running.


The following image shows how you can use LOD management to reduce a 3D model’s complexity while retaining an appropriate level of detail as the model moves away from the camera:



Here are some key things to remember when using LOD:


  • Keep in mind how triangles affect the silhouette of an object when you are reducing triangle counts.

  • Remove more polygons on flatter areas.

  • Mipmaps, which are functionally LOD for Textures, should be used with your models. We will cover mipmaps later in the Textures project.

  • LOD can also apply to Shader complexity. The Shader and Material can be optimized for 3D objects that are farther away. For example, you can reduce the number of Textures an object uses as it moves farther from the camera.

2. When Not to Use LODs

LOD is not suitable in every situation. For example, avoid using it in an application 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 because Mesh data must be saved so it can be used in real-time.


The following image shows a Scene where LOD is not used because the Scene is static. In this situation, you can use other optimization tricks, such as removing polygons that aren’t visible to the player:



3. Why Use LOD

As an object moves away from the camera, its detail becomes less visible. From 20 meters away, it’s hard to see any difference between an object with 200 triangles and an object with 2,000 triangles. Since you don’t want to use more triangles than your Scene requires, using LOD is a great way to optimize your application with little noticeable impact..


Other benefits of using LOD include:


  • A boost in performance, as fewer triangles must be processed.

  • LOD helps mitigate problems that micro triangles cause.

The following image shows how distant objects look the same, even with different polygon counts:



4. An Appropriate Number Of Triangles

Here are some key points to keep in mind when using LOD:


  • It’s often worth reducing the number of triangles between each LOD level by 50 percent.

  • Don’t use dense areas of triangles on objects with a lower LOD. These are only visible when the object is close.

  • Check what the LOD looks like at different distances from the camera. Lower LOD means a lower resolution when viewed up close, but that's OK for objects that are farther from the camera.

The following image shows how an object looks when the polygon count drops by 50 percent for each level:



The following image shows the lower LOD object up close. It looks less detailed but its appearance is acceptable when it’s farther from the camera:



If you don’t reduce the polygon count enough on lower LOD objects, your application’s performance will be negatively impacted. This is because the GPU is processing more vertices than needed.


But if you are too aggressive in reducing the polygon count for lower LOD objects, then the object’s details will pop in and out of view in real time. This could potentially ruin the experience for the user.


5. Number of LOD Levels

There is no predetermined number of LODs that an object should have. It depends on the size and importance of the object. For example, a character in an action or a car in a racing game can benefit from using more LOD levels than a small background object like a tree.


If you use too few LOD levels, you won’t benefit from a gain in performance. And, if there is too large a jump in polygon reduction between levels, then the popping that happens during an LOD switch will be more noticeable. If you use too many LOD levels, your application’s performance will be impacted.


Also, memory usage increases with more LODs, as you must store the extra Meshes somewhere, resulting in a larger file size. But the largest cost is your time, especially if you’re creating each level by hand.


6. Creating LOD Meshes

When creating LOD Meshes by hand using 3D software, either remove edge loops or reduce the number of vertices on the object. While this gives you more control, it can take longer to complete.


When creating LOD Meshes automatically, use a built-in modifier or separate LOD-generation software. Examples of built-in modifiers include ProOptimizer in 3ds Max and the Generate LOD Meshes function in Maya.


7. Conclusion

Using LOD Meshes is a smart way to optimize your application by minimizing excess geometry on objects that change distance from the camera. In the next tutorial, we’ll explore some additional best practices for optimizing geometry for mobile applications.


Complete this tutorial