Version: 2020.2
ShaderLab: SubShader Tags (etiquetas SubShader)
ShaderLab sintaxis: Fallback

ShaderLab: SubShader LOD value

This page contains information on level of detail (LOD) for shaders. For information on LOD for meshes, see Level of detail (LOD) for meshes.

You can assign a LOD (level of detail) value to a SubShader. This value indicates how computationally demanding its shader programs are. At runtime, you can tell Unity to exclude SubShaders above a given LOD value, so that Unity falls back to using SubShaders that have a lower LOD value.

You can use this technique to fine-tune shader performance on different hardware. This is useful when a SubShader is theoretically supported by a user’s hardware, but the hardware is not capable of running it well.

Setting the maximum LOD value

You can set the maximum LOD for an individual shader using Shader.maximumLOD, or globally for all shaders using Shader.globalMaximumLOD. By default, there is no maximum LOD.

Note that although this technique is named after the LOD feature for rendering meshes, there are important differences: Unity does not calculate SubShader LOD automatically, and this feature does not relate to distance from the Camera. You must set the maximum LOD manually.

LOD values for legacy shaders

Unity’s built-in legacy shaders have the following LOD values:

LOD value Shader name
100 VertexLit
150 Decal
Reflective VertexLit
200 Difuso (Diffuse)
250 Diffuse Detail
Reflective Bumped Unlit
Reflective Bumped VertexLit
300 Bumped
400 Bumped Specular
500 Parallax
600 Parallax Specular
ShaderLab: SubShader Tags (etiquetas SubShader)
ShaderLab sintaxis: Fallback