Cross-fading is a technique that makes the transitions between LODs smooth and lets you avoid a visible switchover from one LODThe Level Of Detail (LOD) technique is an optimization that reduces the number of triangles that Unity has to render for a GameObject when its distance from the Camera increases. More info
See in Glossary to another.
With this technique, Unity renders both the current and the next LODs separately, and then blends them together:
Unity implements the cross-fading effect by using either screen-space dithering or transparency. For the last LOD, Unity uses the fade-out effect instead of cross-fading.
To enable LOD cross-fading:
In URP Asset, enable the LOD Cross Fade property.
In the LOD GroupA component to manage level of detail (LOD) for GameObjects. More info
See in Glossary component, in the Fade Mode drop-down select Cross Fade.
For SpeedTree assets, select Speed Tree. For more information, refer to Working with SpeedTree models.
Note: The Speed Tree mode doesn’t apply to SpeedTree models with an .st9 file extension.
LOD Group technique supports two cross-fading modes:
Animate Cross-fading
Custom transition zones
In this mode Unity performs transitions between LODs over a short period of time. This is the default option.
The transition between LODs begins when the model’s screen size ratio reaches the next LOD threshold. For example, if the LOD1 threshold is set t0 50%, the transition between LOD0 and LOD1 begins as soon as the screen size ration of the model is 50%. The transition lasts for a short period of time.
The duration of the cross-fade effect is the same for every LOD.
To define custom transition zones based on the model’s screen size ratio, use the Fade Transition Width property.
Each transition zone begins and ends between the current and the next LOD’s threshold. The Fade Transition Width property defines where a transition zone begins:
To define the transition zone on each LOD level:
In the LOD Group component, disable the Animate Cross-fading option.
Click on a LOD box in LOD selection bar.
Set the Fade Transition Width value. The value defines the width of the transition zone as a proportion (between 0.0 and 1.0) of the current LOD’s selection bar length. A smaller value delays the beginning of the transition and makes the transition faster.
In SpeedTree models, each vertex stores its position in the current and the next LOD.
When Unity imports SpeedTree models with .spm and .st extensions, it automatically sets their Fade Mode property to Speed Tree.
In this mode, during LOD transitions, Unity interpolates between the vertex positions to gradually transform the model’s geometry from the current to the next LOD.
Note: Unity uses the Cross Fade mode instead of the Speed Tree mode for the following models and transitions:
Unity doesn’t provide a built-in technique to blend LOD geometries. To blend LODs in custom shadersA program that runs on the GPU. More info
See in Glossary, implement your own technique depending on your application type and asset production pipeline.
Unity calculates a blend factor using the GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary’s screen size and passes it to shaders in the unity_LODFade.x uniform variable. Depending on the Fade Mode property, use either the LOD_FADE_PERCENTAGE
or LOD_FADE_CROSSFADE
keyword for GameObjects that use LOD cross-fading.
In Animate Cross-fading mode, you can set the duration of the transition for every LOD using the LODGroup.crossFadeAnimationDuration property.