Pass tags in ShaderLab reference
Reference for the Tags block in the Pass block in ShaderLab.
Read time 2 minutesLast updated a month ago
This page contains information on using a block in your ShaderLab code to assign tags to a Pass. It also contains information on using the tag, which determines when Unity runs the pass during rendering.
TagsLightModeFor information on how a Shader object works, and the relationship between Shader objects, SubShaders and Passes, see Shader object fundamentals.
Render pipeline compatibility
Feature name | Universal Render Pipeline (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 |
|---|---|
| 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 tag determines when Unity executes the pass.
LightModeValid values for this tag depend on the render pipeline. For more information, refer to:
- tag values in the Universal Render Pipeline
LightMode - tag values in the Built-In Render Pipeline
LightMode
PassFlags tag
In the Built-in Render Pipeline, use the Pass tag to specify what data Unity provides to the Pass.
PassFlagsValue | Function |
|---|---|
| OnlyDirectional | Valid only in the Built-in Render Pipeline, when the rendering path is set to Forward, in a Pass with a 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 Pass tag enables or disables a Pass based on project settings.
RequireOptionsValue | Function |
|---|---|
| Render this Pass only if QualitySettings-softVegetation is enabled. |