本页面包含有关可用于内置渲染管线的预定义通道标签的信息。
有关通道标签的一般信息,包括 LightMode 标签的介绍,请参阅ShaderLab:为通道分配标签。有关通用渲染管线 (URP) 中预定义的通道标签值,请参阅URP 通道标签:LightMode。
这些是内置渲染管线中 LightMode
通道标签的有效值。有关 LightMode 标签的更多信息,请参阅 ShaderLab:使用通道标签。
值 | 功能 |
---|---|
Always |
始终渲染;不应用任何光照。这是默认值。 |
ForwardBase |
在前向渲染中使用;应用环境光、主方向光、顶点/SH 光源和光照贴图。 |
ForwardAdd |
在前向渲染中使用;应用附加的每像素光源(每个光源有一个通道)。 |
Deferred |
在延迟渲染中使用;渲染 G 缓冲区。 |
ShadowCaster |
将对象深度渲染到阴影贴图或深度纹理中。 |
MotionVectors |
用于计算每个对象的运动矢量。 |
Vertex |
用于旧版顶点光照渲染(当对象不进行光照贴图时);应用所有顶点光源。 |
VertexLMRGBM |
用于旧版顶点光照渲染(当对象不进行光照贴图时),以及光照贴图为 RGBM 编码的平台(PC 和游戏主机)。 |
VertexLM |
用于旧版顶点光照渲染(当对象不进行光照贴图时),以及光照贴图为双 LDR 编码的平台上(移动平台)。 |
Meta |
This Pass is not used during regular rendering, only for lightmap baking or Enlighten Realtime Global Illumination. For more information, see Lightmapping and shaders. |
在内置渲染管线中,使用 PassFlags
通道标签来指定 Unity 提供给通道的数据。
值 | 功能 |
---|---|
OnlyDirectional | 仅在内置渲染管线中且渲染路径设置为 Forward,LightMode 标签值为 ForwardBase 的通道中有效。Unity 只为该通道提供主方向光和环境光/光照探针数据。这意味着非重要光源的数据将不会传递到顶点光源或球谐函数着色器变量。请参阅前向渲染路径以了解详细信息。 |
Shader "Examples/ExamplePassFlag"
{
SubShader
{
Pass
{
Tags { "LightMode" = "ForwardBase" "PassFlags" = "OnlyDirectional" }
// The rest of the code that defines the Pass goes here.
}
}
}
在内置渲染管线中,RequireOptions
通道标签根据项目设置启用或禁用一个通道。
值 | 功能 |
---|---|
SoftVegetation |
Render this Pass only if QualitySettings-softVegetation is enabled. |
Shader "Examples/ExampleRequireOptions"
{
SubShader
{
Pass
{
Tags { "RequireOptions" = "SoftVegetation" }
// The rest of the code that defines the Pass goes here.
}
}
}
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.