Version: 6000.3
语言: 中文
在 URP 的 Deferred 和 Deferred+ 渲染路径中启用准确的 G 缓冲区法线
对 URP 中的 Forward+ 渲染路径进行故障排除

使着色器与 URP 中的 Deferred 或 Deferred+ 渲染路径兼容

在 Deferred 或 Deferred+ 渲染路径中使用着色器

要使用着色器在 GPU 上运行的程序。更多信息
请参阅术语表
在递延渲染路径渲染管道用于渲染图形的技术。选择不同的渲染路径会影响照明和着色的计算方式。某些渲染路径比其他路径更适合不同的平台和硬件。更多信息
请参阅术语表
,将UniversalGBuffer标记添加到您的ShaderLabUnity 用于定义 Shader 对象结构的语言。更多信息
请参阅术语表
法典。Unity 在 G 缓冲区渲染通道期间执行着色器。

例如:

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

在 Deferred 或 Deferred+ 渲染路径的前向传递中使用着色器

要在延迟渲染路径中使用着色器,请将UniversalForwardOnlyDepthNormalsOnly标签添加到 ShaderLab 代码中的 Pass 中。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 的 Deferred 和 Deferred+ 渲染路径中启用准确的 G 缓冲区法线
对 URP 中的 Forward+ 渲染路径进行故障排除