Surface Shaders and rendering paths in the Built-In Render Pipeline
Understand how the rendering path affects how Unity applies lighting, and which passes Unity uses.
Read time 2 minutesLast updated 21 days ago
In the Built-in Render Pipeline, when using a Surface Shader, how lighting is applied and which Passes of the shader are used depends on which rendering path is used. Each pass in a shader communicates its lighting type via Pass Tags.
Render pipeline compatibility
Feature name | Universal Render Pipeline (URP) | High Definition Render Pipeline (HDRP) | Custom SRP | Built-in Render Pipeline |
|---|---|---|---|---|
| Surface Shaders | No For a streamlined way of creating Shader objects in URP, see Shader Graph. | No For a streamlined way of creating Shader objects in HDRP, see Shader Graph. | No | Yes |
Rendering paths
- In Forward Rendering, and
ForwardBasepasses are used.ForwardAdd - In Deferred Shading, pass is used.
Deferred - In legacy Vertex Lit, ,
VertexandVertexLMRGBMpasses are used.VertexLM - In any of the above, to render Shadows or a depth texture, pass is used.
ShadowCaster
Forward Rendering path
ForwardBaseForwardAddIf forward rendering is used, but a shader does not have forward-suitable passes (i.e. neither nor pass types are present), then that object is rendered just like it would in Vertex Lit path, see below.
ForwardBaseForwardAddDeferred Shading path
DeferredLegacy Vertex Lit Rendering path
Since vertex lighting is most often used on platforms that do not support programmable shaders, Unity can't create multiple shader variants internally to handle lightmapped vs. non-lightmapped cases. So to handle lightmapped and non-lightmapped objects, multiple passes have to be written explicitly.
- pass is used for non-lightmapped objects. All lights are rendered at once, using a fixed function OpenGL/Direct3D lighting model (Blinn-Phong)
Vertex - pass is used for lightmapped objects, when lightmaps are RGBM encoded (PC and consoles). No real-time lighting is applied; pass is expected to combine textures with a lightmap.
VertexLMRGBM - pass is used for lightmapped objects, when lightmaps are double-LDR encoded (mobile platforms). No real-time lighting is applied; pass is expected to combine textures with a lightmap.
VertexLM