Detailed explanation of Unity Shader LOD

Subject

To introduce shader lod, you need to read the official document first

The role of Shader LOD

Fine tune shader performance on different hardware

Instructions

1 Define multiple subshaders in the shader, and then set their lod values

2 The c# code sets the log of a certain shader, for example, Shader.maximumLOD = 200

3 The lod value of the front subshader should be larger

In this way, when running, unity will use the subshader of the specified lod to run the rendering.

Set the global shader Lod: Shader.globalMaximumLOD

Remark

The default Lod value of the new shader is -1

The default value of Shader.globalMaximumLOD is 2147483647

possible misunderstanding

Myth 1: The Lod of the shader is related to the camera distance.

Correct understanding: Shader's Lod provides an interface to choose which subshader to execute

References

ShaderLab: Specifying LOD values ​​for sub-shaders - Unity Manual

Guess you like

Origin blog.csdn.net/ak47007tiger/article/details/126972529