Version: Unity 6.5 (6000.5)
Language : English
Name directive in ShaderLab reference
Shader code blocks in ShaderLab reference

Pass tags in ShaderLab reference

Important: The Built-In Render Pipeline is deprecated and will be made obsolete in a future release.
It remains supported, including bug fixes and maintenance, through the full Unity 6.7 LTS lifecycle.
For more information on migration, refer to Migrating from the Built-In Render Pipeline to the Universal Render Pipeline and Render pipeline feature comparison.

This page contains information on using a Tags block in your ShaderLabUnity’s language for defining the structure of Shader objects. More info
See in Glossary
code to assign tags to a Pass. It also contains information on using the LightMode tag, which determines when Unity runs the pass during rendering.

For information on how a ShaderA program that runs on the GPU. More info
See in Glossary
object works, and the relationship between Shader objectsAn instance of the Shader class, a Shader object is container for shader programs and GPU instructions, and information that tells Unity how to use them. Use them with materials to determine the appearance of your scene. More info
See in Glossary
, SubShaders and Passes, see Shader object fundamentals.

Render pipeline compatibility

Feature name Universal 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
(URP)
High Definition Render Pipeline (HDRP) Custom SRP Built-in Render Pipeline
ShaderLab: Pass Tags block Yes Yes Yes Yes
ShaderLab: LightMode Pass tag Yes Yes Yes Yes

Syntax

Signature Function
Tags {"<name1>" = "<value1>" "<name2>" = "<value2>"} Applies the given tags to the Pass.

You can define as many tags as you like.

LightMode tag

Signature Function
“LightMode” = “[value]” Sets the LightMode value for this Pass.

The LightMode tag determines when Unity executes the pass.

Valid values for this tag depend on the render pipeline. For more information, refer to:

PassFlags tag

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

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.

Example

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
.

Value Function
SoftVegetation Render this Pass only if QualitySettings-softVegetation is enabled.

Additional resources

Name directive in ShaderLab reference
Shader code blocks in ShaderLab reference