引用:
Shader Level of Detail (LOD) works by only using shaders or subshaders that have their LOD value less than a given number.
色器的细节层次效果只有在着色器或子着色器含有小于一定阈值的LOD值时才起作用。
Shader LOD can be either set per individual shader (using Shader.maximumLOD), or globally for all shaders (using Shader.globalMaximumLOD).
着色器的细节层次既可以针对单个着色器进行设定(使用Shader.maximumLOD),也可以针对所有着色器进行全局设定(使用Shader.globalMaximumLOD)。
理解:
我觉得可以用LOD来实现某个物体上材质的替换,比如在下面的shader中:
Shader "Tut/Shader/Common/_SetShader" {
Properties {
_Color ("Main Color", Color) = (1,1,1,0.5)
_MainTex ("Base (RGB)", 2D) = "white" { }
}
SubShader {
LOD 600
Pass {
Material { Diffuse (0,1,0,1)}
Lighting On
SetTexture [_MainTex] {Combine texture * primary double}
}
}
SubShader {
LOD 500
Pass {
Material {Diffuse (1,1,0,1)}
Lighting On
}
}
SubShader {
LOD 400
Pass {
color(1,0,0,1)
}
}
}
可以用脚本设置myShader.maximumLOD =xxx 来实现替换。不知道有没有效率。