Version: 2020.3
ShaderLab: assigning tags to a Pass
ShaderLab: adding shader programs

ShaderLab: Predefined Pass tags in the Built-in Render Pipeline

This page contains information on predefined Pass tags that you can use with the Built-in Render Pipeline.

For general information on Pass tags, including an introduction to the LightMode tag, see ShaderLab: assigning tags to a Pass. For predefined Pass tag values in the Universal Render Pipeline (URP), see URP Pass tags: LightMode.

LightMode tag valid values

These are the valid values for the LightMode Pass tag in the Built-in Render Pipeline. For more information on the LightMode tag, see ShaderLab: using Pass tags.

기능
Always Always rendered; does not apply any lighting. This is the default value.
ForwardBase Used in Forward rendering; applies ambient, main directional light, vertex/SH lights and lightmaps.
ForwardAdd Used in Forward rendering; applies additive per-pixel lights, one Pass per light.
Deferred Used in Deferred Shading; renders G-buffer.
ShadowCaster Renders object depth into the shadowmap or a depth texture.
MotionVectors Used to calculate per-object motion vectors.
PrepassBase Used in legacy Deferred Lighting; renders normals and specular exponent.
PrepassFinal Used in legacy Deferred Lighting; renders final color by combining textures, lighting and emission.
ShadowCaster Renders object depth into the shadowmap or a depth texture.
Vertex Used in legacy Vertex Lit rendering when the object is not lightmapped; applies all vertex lights.
VertexLMRGBM Used in legacy Vertex Lit rendering when the object is lightmapped, and on platforms where the lightmap is RGBM encoded (PC & console).
VertexLM Used in legacy Vertex Lit rendering when the object is lightmapped, and on platforms where lightmap is double-LDR encoded (mobile platforms).
Meta This Pass is not used during regular rendering, only for lightmap baking or Realtime Global Illumination. For more information, see Lightmapping and the Meta Pass tag.

PassFlags tag

In the Built-in Render Pipeline, use the PassFlags Pass tag to specify what data Unity provides to the Pass.

Valid values

기능
OnlyDirectional Valid only in the Built-in Render Pipeline, when the rendering path is set to Forward, in a Pass with a LightMode tag value of ForwardBase.

Unity provides only the main directional light and ambient/light probe data to this Pass. This means that data of non-important lights is not passed into vertex-light or spherical harmonics shader variables. See Forward rendering path for details.

PassFlag tag code examples

Shader "Examples/ExamplePassFlag"
{
    SubShader
    {
        Pass
        {    
              Tags { "LightMode" = "ForwardBase" "PassFlags" = "OnlyDirectional" }
            
              // The rest of the code that defines the Pass goes here.
        }
    }
}

RequireOptions tag

In the Built-in Render Pipeline, the RequireOptions Pass tag enables or disables a Pass based on project settings.

Valid values

기능
SoftVegetation Render this Pass only if QualitySettings-softVegetation is enabled.

Examples

Shader "Examples/ExampleRequireOptions"
{
    SubShader
    {
        Pass
        {    
              Tags { "RequireOptions" = "SoftVegetation" }
            
              // The rest of the code that defines the Pass goes here.
        }
    }
}
ShaderLab: assigning tags to a Pass
ShaderLab: adding shader programs
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961