Version: Unity 6.0 (6000.0)
语言 : 中文
在 URP 的延迟渲染路径中启用 Accurate G-buffer normals
URP 中的 Forward+ 渲染路径的故障排除

在 URP 中使着色器与延迟渲染路径兼容

在延迟渲染路径中使用着色器

要在延迟渲染路径中使用着色器,请将 UniversalGBuffer 标签添加到__ ShaderLab__Unity 用于定义着色器对象结构的语言。更多信息
See in Glossary
代码中的通道。Unity 会在 G 缓冲区渲染通道期间执行该着色器。

例如:

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

在延迟渲染路径的前向通道中使用着色器

要在延迟渲染路径中使用着色器,请将 UniversalForwardOnlyDepthNormalsOnly 标签添加到 ShaderLab 代码中的通道。Unity 会在 G 缓冲区渲染通道期间执行该着色器。

例如:

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

指定着色器光照模型

要将着色器光照模型指定为光照 (Lit) 或简单光照 (Simple Lit),需使用 UniversalMaterialType 标签。例如:

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

其他资源

在 URP 的延迟渲染路径中启用 Accurate G-buffer normals
URP 中的 Forward+ 渲染路径的故障排除