Documentation

Unity Engine


Unity Engine


Pass tags in ShaderLab reference

Reference for the Tags block in the Pass block in ShaderLab.
Read time 2 minutesLast updated a month ago

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.
This page contains information on using a
Tags
block in your ShaderLab 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 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 blockYesYesYesYes
ShaderLab: LightMode Pass tagYesYesYesYes

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

OnlyDirectionalValid 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 settings.

Value

Function

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

Additional resources