ShaderLab syntax: Pass
Reference Manual > ShaderLab Reference > ShaderLab syntax: Shader > ShaderLab syntax: SubShader > ShaderLab syntax: Pass

ShaderLab syntax: Pass

The Pass block causes the geometry of an object to be rendered once.

Syntax

Pass { [Name and Tags] [RenderSetup] [TextureSetup] }
The basic pass command contains an optional list of render setup commands, optionally followed by a list of textures to use.

Name and tags

A Pass can define its Name and arbitrary number of Tags - name/value strings that communicate Pass' intent to the rendering engine.

Render Setup

A pass sets up various states of the graphics hardware, for example should alpha blending be turned on, should fog be used, and so on. The commands are these:

Material { Material Block }
Defines a material to use in a vertex lighting pipeline.
Lighting On | Off
Turn vertex lighting on or off.
Cull Back | Front | Off
Set polygon culling mode.
ZTest (Less | Greater | LEqual | GEqual | Equal | NotEqual | Always)
Set depth testing mode.
ZWrite On | Off
Set depth writing mode.
Fog { Fog Block }
Set fog parameters.
AlphaTest (Less | Greater | LEqual | GEqual | Equal | NotEqual | Always) CutoffValue
Turns on alpha testing.
Blend SourceBlendMode DestBlendMode
Sets alpha blending mode.
Color Color value
Sets color to use if vertex lighting is turned off.
ColorMask RGB | A | or any combination of R, G, B, A
Set color writing mask. Writing ColorMask 0 turns off rendering to all color channels.
Offset OffsetFactor , OffsetUnits
Set depth offset.
SeparateSpecular On | Off
Turns separate specular color for vertex lighting on or off.

Texture Setup

After the render state setup, you can specify a number of textures and their combining modes to apply using SetTexture commands:

SetTexture texture property { [Combine options] }

The texture setup configures fixed function multitexturing pipeline, and is ignored if custom fragment shaders are used.

Details

Lighting

The per-pixel lighting pipeline works by rendering objects in multiple passes. Unity renders the object once to get ambient and any vertex lights in. Then it renders each pixel light affecting the object in a separate additive pass. See Render Pipeline for details.

See Also

There are several special passes available for reusing common functionality or implementing various high-end effects:

Subsections