This version of Unity is unsupported.
ShaderLab: adding shader programs
ShaderLab: grouping commands with the Category block

ShaderLab: commands

This page contains information on using commands in the ShaderLabUnity’s language for defining the structure of Shader objects. More info
See in Glossary
language.

ShaderLab commands fall into these categories:

  • Commands for setting the render state on the GPU.
  • Commands that create a Pass with a specific purpose.
  • Legacy “fixed function style” commands that allow you to create shaderA program that runs on the GPU. More info
    See in Glossary
    programs without writing HLSL.

You can group ShaderLab commands together with the Category block.

Commands for setting render state

Use these commands within a Pass block to set the render state for that Pass, or within a SubShader block to set the render state for that SubShader and any Passes that it contains.

  • AlphaToMask: sets the alpha-to-coverage mode.
  • BlendTransition from one animation to another animation smoothly and seamlessly, such as blending a character’s walking and running animations according to the character’s speed.
    See in Glossary
    : enables and configures alpha blending.
  • BlendOp: sets the operation used by the Blend command.
  • ColorMask: sets the color channel writing mask.
  • Conservative: enables and disables conservative rasterizationThe process of generating an image by calculating pixels for each polygon or triangle in all the geometry. This is an alternative to ray tracing.
    See in Glossary
    .
  • Cull: sets the polygon culling mode.
  • Offset: sets the polygon depth offset.
  • Stencil: configures the stencil test, and what to write to the stencil bufferA memory store that holds an 8-bit per-pixel value. In Unity, you can use a stencil buffer to flag pixels, and then only render to pixels that pass the stencil operation. More info
    See in Glossary
    .
  • ZClip: sets the depth clip mode.
  • ZTest: sets the depth testing mode.
  • ZWrite: sets the depth bufferA memory store that holds the z-value depth of each pixel in an image, where the z-value is the depth for each rendered pixel from the projection plane. More info
    See in Glossary
    writing mode.

Pass commands

Use these commands in a SubShader to define a Pass with a specific purpose.

  • UsePass defines a Pass that imports the contents of a named Pass from another Shader object.
  • GrabPass creates a Pass that grabs the contents of the screen into a texture, for use in a subsequent Pass.

Legacy “fixed function style” commands

These are documented on the page ShaderLab legacy functionality.

ShaderLab: adding shader programs
ShaderLab: grouping commands with the Category block