Version: 2022.2
Language : English
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 PipelineA series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. More info
See in Glossary
.

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.

Value Function
Always Always rendered; does not apply any lighting. This is the default value.
ForwardBase Used in Forward renderingA rendering path that renders each object in one or more passes, depending on lights that affect the object. Lights themselves are also treated differently by Forward Rendering, depending on their settings and intensity. More info
See in Glossary
; applies ambient, main directional light, vertex/SH lights and lightmapsA pre-rendered texture that contains the effects of light sources on static objects in the scene. Lightmaps are overlaid on top of scene geometry to create the effect of lighting. More info
See in Glossary
.
ForwardAdd Used in Forward rendering; applies additive per-pixel lights, one Pass per light.
Deferred Used in Deferred ShadingA rendering path in the Built-in Render Pipeline that places no limit on the number of Lights that can affect a GameObject. All Lights are evaluated per-pixel, which means that they all interact correctly with normal maps and so on. Additionally, all Lights can have cookies and shadows. More info
See in Glossary
; renders G-buffer.
ShadowCaster Renders object depth into the shadowmap or a depth texture.
MotionVectors Used to calculate per-object motion vectors.
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 EnlightenA lighting system by Geomerics used in Unity for lightmapping and for Enlighten Realtime Global Illumination. More info
See in Glossary
Realtime Global IlluminationA group of techniques that model both direct and indirect lighting to provide realistic lighting results.
See in Glossary
. For more information, see Lightmapping and shaders.

PassFlags tag

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

Valid values

Value Function
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 settingsA broad collection of settings which allow you to configure how Physics, Audio, Networking, Graphics, Input and many other areas of your project behave. More info
See in Glossary
.

Valid values

Value Function
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