Version: 2021.1
ShaderLab: SubShader Tags
Синтаксис ShaderLab: 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 Рассеивание (Diffuse)
250 Diffuse Detail
Reflective Bumped Unlit
Reflective Bumped VertexLit
300 Bumped
Specular
400 Рельефная зеркальность (Bumped Specular)
500 Parallax
600 Parallax Specular
ShaderLab: SubShader Tags
Синтаксис ShaderLab: Fallback
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961