Level of Detail
Level of Detail (LOD) is the technique of decreasing the detail and complexity of an object as the distance increases between the object and the viewer.
By using LODs, when the viewer is close to an object, the object has a high level of geometric detail. Therefore, the object appears detailed and accurate. When an object moves further away from the screen it automatically switches to a lower detail model, showing a less detailed model to the player.
There are two key benefits of changing to a model to one with a lower level of detail:
- A reduced level of artifacts due to the decreasing chances of geometric aliasing occurring
- The number of vertices that require shading are reduced, resulting in an increase to performance.
To prevent unnecessary oversampling from occurring, due to geometry that is tiny, LODs must be created with notable differences in the vertex count between each LOD level.
Further information on LODs can be found in the LOD section of the Real-Time 3D Art Best Practices: Geometry guide.
Visual examples demonstrating how LODs can look
The following image and video shows an example of how LODS work as the object gets closer or further away from the camera:
The following web address links to a video that shows an example of a mesh passing through three separate LODs as the camera moves closer to the object. The video shows that the finer details, that become apparent when the camera is closer to the object, are not visible from a distance. However, up close the finer details aid in improving the realism of the object.
Implementing Level of Detail in Unity
Implementing Level of Detail (LODs) in Unity is based on using the Component menu option.
To enable LODs for a model:
- Select the required model.
- Go to Component in the Object Inspector Panel.
- Choose Rendering.
- Select LOD Group.
Selecting LOD Group displays the LOD Group window in the Object Inspector Panel. Different LOD levels can be selected to expose the Renderers panel, where the meshes with the required level of complexity can be chosen. The available LOD levels can be resized, depending on the point where you want the application to move between LODs.
If necessary, the Fade Mode can be set to either Cross Fade or SpeedTree. Depending on the application of the object, the Fade Mode exposes a blend factor that can be accessed within a shader. The blend factor allows for the implementation of smooth blending between LODs.
Unity also supports shader LODs, allowing for
different shaders, or shader passes, to be applied depending on the current
value of either
Utilizing shader LODs allows for more efficient shaders to be applied when the benefit these shaders brings would be too costly for the hardware.