本页包含有关着色器的细节级别 (LOD) 的信息。有关网格的 LOD 的信息,请参阅网格的细节级别 (LOD)。
可以将 LOD(细节级别)值分配给子着色器。此值指示着色器程序在计算方面的需求。在运行时,可以要求 Unity 排除高于给定 LOD 值的子着色器,以便 Unity 退回来使用具有较低 LOD 值的子着色器。
可以使用此方法来微调不同硬件上的着色器性能。用户的硬件理论上支持着色器,但是该硬件无法很好地运行着色器时,这很有用。
可使用 Shader.maximumLOD 为单个着色器设置最大 LOD,也可使用 Shader.globalMaximumLOD 为所有着色器全局设置最大 LOD。默认情况下,没有最大 LOD。
请注意,尽管此方法是以用于渲染网格的 LOD 功能命名,但是仍然存在重要区别:Unity 不会自动计算子着色器 LOD,并且此功能与相对于摄像机的距离无关。必须手动设置最大 LOD。
Unity 的内置旧版着色器具有以下 LOD 值:
LOD 值 | 着色器名称 |
---|---|
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) |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.