SubShader block in ShaderLab reference
Reference for the SubShader block in ShaderLab.
Read time 1 minuteLast updated a month ago
To define a SubShader in ShaderLab, you use a block. This page contains information on using SubShader blocks.
SubShaderInside the block, you can:
SubShader- Assign a LOD (level of detail) value to the SubShader, using the block. See assigning a LOD value to a SubShader.
LOD - Assign key-value pairs of data to the SubShader, using the block. See ShaderLab: assigning tags to a SubShader.
Tags - Add GPU instructions or shader code to the SubShader, using ShaderLab commands. See ShaderLab: using commands.
- Define one or more Passes, using the block. See ShaderLab: defining a Pass.
Pass - Specify package requirements using the block. This makes Unity only run the SubShader if the required packages are installed. See ShaderLab: specifying package requirements.
PackageRequirements
To target a subshader at a specific render pipeline, use the tag. For more information, refer to SubShader tags in ShaderLab reference.
RenderPipelineRender pipeline compatibility
Feature name | Universal Render Pipeline (URP) | High Definition Render Pipeline (HDRP) | Custom SRP | Built-in Render Pipeline |
|---|---|---|---|---|
| ShaderLab: SubShader block | Yes | Yes | Yes | Yes |
Syntax
Signature | Function |
|---|---|
| Defines a SubShader. You can define as many Passes as you like within a SubShader. |