Version: Unity 6 (6000.0)
Language : English
Enable accurate G-buffer normals in the Deferred rendering path in URP
Troubleshooting the Forward+ rendering path in URP

Make a shader compatible with the Deferred rendering path in URP

Use a shader in the Deferred rendering path

To use a shaderA program that runs on the GPU. More info
See in Glossary
in the Deferred rendering pathThe technique that a render pipeline uses to render graphics. Choosing a different rendering path affects how lighting and shading are calculated. Some rendering paths are more suited to different platforms and hardware than others. More info
See in Glossary
, add the UniversalGBuffer tag to the Pass in your ShaderLabUnity’s language for defining the structure of Shader objects. More info
See in Glossary
code. Unity executes the shader during the G-buffer render pass.

For example:

Shader "Examples/ExamplePassFlag"
{
    SubShader
    {
        Pass
        {    
              Tags
              { 
                "RenderPipeline" = "UniversalPipeline"
                "LightMode" = "UniversalGBuffer"
              }
            
              // The rest of the code that defines the Pass goes here.
        }
    }
}

Use a shader in the forward pass of the Deferred rendering path

To use a shader in the Deferred rendering path, add the UniversalForwardOnly and DepthNormalsOnly tags to the Pass in your ShaderLab code. Unity executes the shader during the G-buffer render pass.

For example:

Shader "Examples/ExamplePassFlag"
{
    SubShader
    {
        Pass
        {    
              Tags { 
                "RenderPipeline" = "UniversalPipeline"
                "LightMode" = "UniversalForwardOnly"
                "LightMode" = "DepthNormalsOnly"
              }
            
              // The rest of the code that defines the Pass goes here.
        }
    }
}

Specify the shader lighting model

To specify the shader lighting model as Lit or Simple Lit, use the UniversalMaterialType tag. For example:

Shader "Examples/ExamplePassFlag"
{
    SubShader
    {
        Pass
        {    
              Tags
              { 
                "RenderPipeline" = "UniversalPipeline"
                "LightMode" = "UniversalGBuffer"
                "UniversalMaterialType" = "Lit" 
              }
            
              // The rest of the code that defines the Pass goes here.
        }
    }
}

Additional resources

Enable accurate G-buffer normals in the Deferred rendering path in URP
Troubleshooting the Forward+ rendering path in URP