Unity-TA 成长之路(三)URP-Universal Render Pipeline

因为Unity版本为2020.3.20,推荐使用Universal RP 10.6.0,所以去看了这个版本的文档。

而unity.cn也未对此部分做中文解释:

所以只能去看外文网站了,蹩脚的英文水平,加上蹩脚的翻译软件,勉强读吧。

1、版本支持

Package versionMinimum Unity versionMaximum Unity version
10.6.x2020.3.4f12020.3.x

2、与Built-in Render Pipeline的功能比较

与Unity内置渲染管道相比,下表概述了通用渲染管道(URP)支持的当前功能。

注意:如果被标记为In research,URP团队仍在研究如何以及何时实现该功能。如果一个特性被标记为Not supported,那是因为Unity不打算在任何版本中支持它。

FeatureBuilt-in Render Pipeline
Unity 2018.x, 2019.x, 2020.x.
Universal Render Pipeline
Camera
HDR renderingYesYes
HDR outputYesIn research
MSAAYesYes
Physical CameraYesYes
Dynamic ResolutionYesYes
Multi DisplayYesYes
StackingYesYes
Flare LayerYesNot supported
Depth TextureYesYes
Depth + Normals TextureYesNot supported
Color TextureNot supportedYes
Motion vectorsYesIn research
Batching
Static Batching (By Shader)Not supportedYes
Static Batching (By Material)YesYes
Dynamic BatchingYesYes
Dynamic Batching (Shadows)YesNot supported
GPU InstancingYesYes
Color Space
LinearYesYes
GammaYesYes
Realtime Lights
Light Types
Directional
Spot
Point
Area

Yes
Yes
Yes
Rectangle (Baked)

Yes
Yes
Yes
Rectangle (Baked)
Inner Spot AngleNot supportedYes
ShadingMultiple PassesSingle Pass
Culling
Per-Object
Per-Layer

Yes
Yes

Yes
Yes
Light Limits
Main Directional Light
Per Object

Per Camera

1
Unlimited

Unlimited

1
8 (4 for GLES2). Can be point, spot, and directional Lights.
256 (16 for GLES 3.0 or lower, 32 on other mobile platforms)
AttenuationLegacyInverseSquared
Vertex LightsYesYes
SH LightsYesIn research
Realtime Shadows
Light Types
Directional
Spot
Point
Area

Yes
Yes
Yes
Not supported

Yes - only 1
Yes
In research
Not supported
Shadow Projection
Stable Fit
Close Fit

Yes
Yes

Yes
In research
Shadow Cascades
Number of Cascades
Control by Percentage
Control by Distance

1, 2 or 4
Yes
Not supported

1–4
Yes
Yes
Shadow Resolve Type
Lighting Pass
Screen Space Pass

Yes
Yes

Yes
No
Shadow BiasConstant clip space offset + normal biasOffsets shadowmap texels in the light direction + normal bias
Lightmapping
EnlightenYesNot supported
Progressive Lightmapper, CPUYesYes
Progressive Lightmapper, GPUYesYes
Realtime Global Illumination
EnlightenYesNot supported
Mixed Lighting Mode
SubtractiveYesYes
Baked IndirectYesYes
ShadowmaskYesYes (Forward Rendering Path)
Distance ShadowmaskYesYes (Forward Rendering Path)
Light Probes
BlendingYesYes
Proxy Volume (LPPV)YesNot supported
Custom ProvidedYesYes
Occlusion ProbesYesYes
Reflection Probes
RealtimeYesYes
BakedYesYes
Sampling
Simple
Blend Probes
Blend Probes and Skybox

Yes
Yes
Yes

Yes
In research
In research
Box ProjectionYesIn research
Lightmap Modes
Non-DirectionalYesYes
DirectionalYesYes
Environmental lighting
Source
Skybox
Gradient
Color

Yes
Yes
Yes

Yes
Yes
Yes
Ambient Mode
Realtime
Baked

Yes
Yes

In research
Yes
Skybox
ProceduralYesYes
6 SidedYesYes
CubemapYesYes
PanoramicYesYes
Fog
LinearYesYes
ExponentialYesYes
Exponential SquaredYesYes
Visual Effects Components
HaloYesNot supported
Lens FlareYesNot supported
Trail RendererYesYes
Billboard RendererYesYes
ProjectorYesNot supported
Shaders (General)
Shader GraphNot supportedYes
Surface ShadersYesNot supported
Camera-relative RenderingNot supportedIn research
Built-in Lit Uber Shader
Metallic Workflow
Specular Workflow
Standard Shader
Yes
Yes
Lit Shader
Yes
Yes
Surface Type and Blend Mode
Opaque
Faded (Alpha Blend)
Transparent
Cutout
Additive
Multiply

Yes
Yes
Yes
Yes
Not supported
Not supported

Yes
Yes
Yes
Yes
Yes
Yes
Surface Inputs
Albedo (Base Map)
Specular
Metallic
Smoothness
Ambient Occlusion
Normal Map
Detail Map
Detail Normal Map
Heightmap

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Light CookiesYesIn research
Parallax MappingYesYes
Light Distance FadeNot supportedIn research
Shadow Distance FadeYesIn research
Shadow Cascade BlendingNot supportedIn research
GPU InstancingYesYes
Double Sided GIYesYes
Two SidedNot supportedYes
Order In LayerNot supportedYes
Render Pipeline Hooks
Camera.RenderWithShaderYesNot supported
Camera.AddCommandBuffer
(Camera.Remove[All]CommandBuffer)
YesNot supported
Camera.RenderYesNot supported
Light.AddCommandBuffer
(LightRemove[All]CommandBuffer)
YesNot supported
OnPreCullYesNot supported
OnPreRenderYesNot supported
OnPostRenderYesNot supported
OnRenderImageYesNot supported
OnRenderObjectYesYes
OnWillRenderObjectYesYes
OnBecameVisibleYesYes
OnBecameInvisibleYesYes
Camera Replacement MaterialNot supportedYes, with a custom Pass
RenderPipeline.BeginFrameRenderingNot supportedYes
RenderPipeline.EndFrameRenderingNot supportedYes
RenderPipeline.BeginCameraRenderingNot supportedYes
RenderPipeline.EndCameraRenderingNot supportedYes
UniversalRenderPipeline.RenderSingleCameraNot supportedYes
ScriptableRenderPassNot supportedYes
Custom RenderersNot supportedYes
Post-processingUses Post-Processing Version 2 packageUses integrated post-processing solution
Ambient Occlusion (MSVO)YesIn research
Auto ExposureYesNot supported
BloomYesYes
Chromatic AberrationYesYes
Color GradingYesYes
Depth of FieldYesYes
GrainYesYes
Lens DistortionYesYes
Motion Blur
Camera
Object

Yes
Not supported

Yes
In research
Screen Space ReflectionsYesNot supported
VignetteYesYes
Particles
VFX Graph (GPU)Not supportedYes
Particles System (CPU)YesYes
Shaders
Physically Based
Simple Lighting (Blinn Phong)
Unlit

Yes
Yes
Yes

Yes (Particles Lit)
Yes (Particles Simple Lit)
Yes (Particles Unlit)
Soft ParticlesYesYes
DistortionYesYes
Flipbook BlendingYesYes
Terrain
Shaders
Physically Based
Simple Lighting (Blinn-Phong)
Unlit
Speed Tree
Vegetation
Detail

Yes
Yes
Not supported
Yes
Yes
Yes

Yes
In research
In research
Yes
Yes
Yes
Wind ZoneYesYes
Number of LayersUnlimited8
GPU Patch GenerationYesYes
Surface MaskNot supportedIn research
2D
SpriteYesYes
TilemapYesYes
Sprite ShapeYesYes
Pixel-PerfectYes - using the 2D Pixel Perfect PackageYes
2D LightsNot supportedYes
UI (Canvas Renderer)
Screen Space - OverlayYesYes
Screen Space - CameraYesYes
World SpaceYesYes
Text Mesh ProYesYes
VR
MultipassYesYes
Single PassYesYes
Single Pass InstancedYesYes
Post-processing
Oculus Rift
Oculus Quest
PSVR
HoloLens
WMR
Magic Leap One

Yes
Yes
Yes
Yes
Yes
Yes

Yes
Yes
Yes
Yes
Yes
Yes
AR
AR FoundationYesYes
Debug
Scene view modesYesIn research

 3、Rendering in the Universal Render Pipeline(通用渲染管道中的渲染)

通用渲染管道(URP)使用以下命令渲染场景:

在前向渲染器中,URP实现了一个渲染循环,告诉Unity如何渲染帧。

        当渲染管道在图形设置中处于活动状态时,Unity将使用URP渲染项目中的所有摄影机,包括游戏和场景视图摄影机、反射探测器以及检查器中的预览窗口。

URP渲染器为每个摄影机执行摄影机循环,执行以下步骤:

  • Culls rendered objects in your Scene(剔除场景中的渲染对象)
  • Builds data for the renderer(为渲染器生成数据)
  • Executes a renderer that outputs an image to the framebuffer(执行将图像输出到帧缓冲区的渲染器)

        在RenderPipelineManager类中,URP提供事件,可用于在渲染帧之前和之后以及渲染每个摄影机循环之前和之后执行代码。活动包括:

  • beginCameraRendering
  • beginFrameRendering
  • endCameraRendering
  • endFrameRendering

摄影机循环执行以下步骤:

StepDescription
Setup Culling Parameters

Configures parameters that determine how the culling system culls Lights and shadows. You can override this part of the render pipeline with a custom renderer.

配置用于确定消隐系统如何消隐灯光和阴影的参数。可以使用自定义渲染器覆盖渲染管道的这一部分。

Culling

Uses the culling parameters from the previous step to compute a list of visible renderers, shadow casters, and Lights that are visible to the Camera. Culling parameters and Camera layer distances affect culling and rendering performance.

使用上一步中的消隐参数计算摄影机可见的可见渲染器、阴影投射器和灯光的列表。消隐参数和摄影机层距离会影响消隐和渲染性能。

Build Rendering Data

Catches information based on the culling output, quality settings from the URP Asset, Camera, and the current running platform to build the RenderingData. The rendering data tells the renderer the amount of rendering work and quality required for the Camera and the currently chosen platform.

基于剔除输出、URP资源的质量设置、相机和当前运行平台捕获信息,以构建渲染数据。渲染数据告诉渲染器渲染工作量和相机和当前所选平台所需的质量。

Setup Renderer

Builds a list of render passes, and queues them for execution according to the rendering data. You can override this part of the render pipeline with a custom renderer.

生成渲染过程的列表,并根据渲染数据将其排队以供执行。可以使用自定义渲染器覆盖渲染管道的这一部分。

Execute Renderer

Executes each render pass in the queue. The renderer outputs the Camera image to the framebuffer.

执行队列中的每个渲染过程。渲染器将相机图像输出到帧缓冲区。

4、如何使用渲染对象渲染器功能创建自定义渲染效果

例子见Unity官方文档:

Example: How to create a custom rendering effect using the Render Objects Renderer Feature | Universal RP | 10.6.0

5、通用渲染管道中的光照

        使用通用渲染管道(URP),可以实现适用于一系列艺术样式的真实照明。Unity的所有渲染管道都共享公共照明功能,但每个渲染管道都有一些重要的区别。

通用渲染管道(URP)与Unity的通用照明功能不同的地方有:

  • The Light component inspector, which displays some URP-specific controls(inspector面板,显示一些特定于URP的控件).
  • The Universal Additional Light Data component, which allows Unity to store Light-related data that is specific to URP(Universal Additional Light Data,允许Unity存储特定于URP的灯光相关数据).
  • Realtime Global Illumination using Enlighten is not supported in URP. Enlighten is deprecated, and 2020 LTS is the last version of Unity that will support any Enlighten functionality. For more information on Enlighten support, see this Unity blog post(URP中不支持使用Enlighten的实时全局照明。Enlighten已被弃用,2020 LTS是Unity的最后一个版本,将支持任何Enlighten功能).

6、Camera差异

URP中的Camera与标准Unity摄像头最显著的区别在于: 

  • The Universal Additional Camera Data component, which extends the Camera component's functionality and allows URP to store additional Camera-related data(Universal Additional Camera Data组件,它扩展了摄像头组件的功能,并允许URP存储与摄像头相关的附加数据)
  • The Render Type setting, which defines the two types of Camera in URP: Base and Overlay(“渲染类型”设置,用于定义URP中的两种摄影机类型:Base和Overlay)
  • The Camera Stacking system, which allows you to layer the output of multiple Cameras into a single combined output(摄影机堆叠系统,允许您将多个摄影机的输出分层为单个组合输出)
  • The Volume system, which allows you to apply post-processing effects to a Camera based on a given Transform's position within your Scene(体积系统,允许您基于场景中给定变换的位置将后处理效果应用于摄影机)
  • The Camera component, which exposes URP-specific properties in the Inspector(Camera组件,用于在检查器中显示特定于URP的特性)

7、通用渲染管道中的后处理

        通用渲染管道(URP)包括后处理效果的集成实现。如果使用URP,则无需安装额外的软件包来实现后期处理效果。 URP和Post Processing Stack v2不兼容。

7.1 后处理效果

下面的图像显示了一个场景,有URP后处理和没有URP后处理。

没有后处理:

有后处理:

注意:URP不支持OpenGL ES 2.0上的后期处理。 

7.2 如何使用后处理

要在新场景中配置后处理,请执行以下操作:

(1)选择相机,然后选中“后处理”复选框。

(2) 在场景中添加带有Volume组件的游戏对象。添加一个Global Volume(选择GameObject > Volume > Global Volume)。

 (3)选中Global Volume物体,在Volume组件中,点New按钮。

(4)添加post-processing effects

要配置location-based后处理效果,请参阅如何使用本地卷( How to use Local Volumes)。

7.3 移动设备URP中的后处理

        后处理效果可能会占用大量的帧时间。如果将URP用于移动设备,默认情况下,这些效果是最适用于移动端的:

  • Bloom (with High Quality Filtering disabled)
  • Chromatic Aberration
  • Color Grading
  • Lens Distortion
  • Vignette

注意:对于景深,Unity建议对低端设备使用高斯景深。对于控制台和桌面平台,请使用Bokeh景深。

注意:对于移动平台上的抗锯齿,Unity建议您使用FXAA。

7.4 VR中URP的后处理

        在VR应用程序和游戏中,某些后处理效果会导致恶心和迷失方向。要在快节奏或高速应用程序中减少晕车,请在VR中使用渐晕效果,并避免镜头失真、色差和运动模糊对VR的影响。

 7.5 Volumes

        通用渲染管道(URP)使用Volumes框架。Volumes可以覆盖或扩展场景属性,具体取决于相对于每个体积的摄影机位置。

        URP使用Volumes框架进行后期处理效果。

        将Mode设置为Global时,Volumes会影响场景中所有位置的摄影机。设置为Local时,如果摄影机位于碰撞器的边界内,则Volumes会影响摄影机。

        可以将Volume组件添加到任何游戏对象中,一个场景可以包含多个具有Volume组件的游戏对象,也可以向一个游戏对象添加多个Volume组件。

        Volume组件可以引用包含场景属性的Volume Profile,Volume Profile包含每个特性的默认值,并在默认情况下隐藏它们。Volume Overrides允许我们更改或Volume Profile中的默认特性。

         在运行时,URP将遍历场景中连接到活动游戏对象的所有已启用的Volume组件,并确定每个Volume对最终场景设置的影响。URP使用非零贡献对所有体积的值进行插值,以计算最终特性值。

        Volume组件包含的属性控制它们如何影响摄影机以及它们如何与其他Volume交互。

PropertyDescription(描述)
ModeUse the drop-down to select the method that URP uses to calculate whether this Volume can affect a Camera(使用下拉列表选择URP用于计算此体积是否会影响摄影机的方法):
Global: Makes the Volume have no boundaries and allow it to affect every Camera in the Scene(使Volume 没有边界,并允许其影响场景中的每个摄影机).
Local: Allows you to specify boundaries for the Volume so that the Volume only affects Cameras inside the boundaries. Add a Collider to the Volume's GameObject and use that to set the boundaries(允许我们为Volume指定边界,以便Volume仅影响边界内的摄影机。将碰撞器添加到Volume的游戏对象,并使用该碰撞器设置边界).
Blend Distance

The furthest distance from the Volume’s Collider that URP starts blending from. A value of 0 means URP applies this Volume’s overrides immediately upon entry.

URP开始混合的距离Volume的碰撞器的最远距离。值为0表示URP在输入时立即应用此Volume的overrides。


This property only appears when you select Local from the Mode drop-down.

仅当从Mode下拉列表中选择Local时,此属性才会显示。

Weight

The amount of influence the Volume has on the Scene. URP applies this multiplier to the value it calculates using the Camera position and Blend Distance.

Volume对场景的影响量。URP将此乘数应用于使用摄影机位置和混合距离计算的值。

Priority

URP uses this value to determine which Volume it uses when Volumes have an equal amount of influence on the Scene. URP uses Volumes with higher priorities first.

URP使用此值确定当体积对场景的影响量相等时使用的体积。URP首先使用优先级较高的卷。

Profile

A Volume Profile Asset that contains the Volume Components that store the properties URP uses to handle this Volume.

URP使用此值确定当Volume对场景的影响量相等时使用的Volume。URP首先使用优先级较高的Volumes。

7.6 Volume Profiles

        Profile字段存储Volume ProfileVolume Profiles是一种资源,包含URP用于渲染场景的特性。我们可以编辑Volume Profile,或将其他Volume Profile指定给Profile字段。还可以分别单击NewClone按钮来创建Volume Profile或克隆当前Volume Profile

7.7 How to use Local Volumes

        在本例中,当摄影机位于某个长方体碰撞器内时,URP应用后处理效果。

(1)在场景中,创建新的Box Volume(GameObject > Volume > Box Volume)。

(2)选择Box Volume,Inspector面板Volume组件中,Profile字段点击New

(3)如果场景中有其他的Volume,修改Priority属性的值,以确保当前Volume优先级高于其他的Volume。

(4)点击Add Override,在Volume Overrides对话框中,选择后处理效果。

(5)在Collider组件中,调整大小和中心属性,使Collider占据您希望本地后期处理效果的Volume(确保选中“Is Trigger”复选框)。

        现在,当Camera在Volume Box Collider的范围内,URP使用Box Volume中的Volume Overrides.

7.8 Volume Profile

        Volume Profile是一个可脚本对象,它包含了Volumes用来确定如何为其影响的相机渲染场景环境的属性。Volume Profile引用了其Profile字段中的Volume Profile,并使用它引用的Volume Profile中的值。

        Volume Profile将其属性组织为控制不同环境设置的结构。这些结构都有可以使用的默认值,但您可以使用Volume Override来重写这些值并自定义环境设置。

更多说明见官方文档:Volume Profile | Universal RP | 10.6.0

7.9 Volume Overrides

        Volume Overrides允许我们更改或扩展Volume Profile中的默认属性。

        URP作为Volume Override实现后期处理效果.例如,下图显示了URP模板样框中Vignette后期处理的效果.

        在Volume Override中,每个属性左侧的复选框允许您启用或禁用特定属性。如果禁用属性,则URP将使用Volume对该属性的默认值。关闭所有属性,使用属性列表上方的全部或无快捷方式。

7.10 Effect List

这些是在通用渲染管道(URP)中可用的后期处理效果:

 8、Shaders and Materials

         通用渲染管道使用的阴影方法与内置的统一渲染管道不同.因此,内置Lit和自定义Lit Shaders与URP不工作.相反,URP有一套新的标准Shaders.URP为最常见的用例场景提供以下Shaders:

8.1 Choosing a Shader

        使用URP,我们可以使用物理基础阴影(PBS)和非物理基础渲染(PBR)实时照明。

        对于PBS,使用Lit Shader。我们可以在所有平台上使用。阴影质量量表取决于平台,但在所有平台上保持基于物理的呈现。这给了我们在硬件上的真实图形。Unity Standard ShaderStandard (Specular setup) Shaders都映射到URP中的Lit Shader。有关Shader映射的列表,请参阅Shader mappings

8.2 SRP Batcher compatibility

确保Shader是SRP Batcher可兼容的:

  • Declare all Material properties in a single CBUFFER called UnityPerMaterial.
  • Declare all built-in engine properties, such as unity_ObjectToWorld or unity_WorldTransformParams, in a single CBUFFER called UnityPerDraw.

更多关于SRP的信息,参阅Scriptable Render Pipeline (SRP) Batcher

8.3 Upgrading your Shaders

        如果项目使用的uilt-in render,我们想把项目改为使用URP,必须将这些Shaders转换为URP Shaders。这是因为built-in Lit shaders不兼容RP Shaders。有关built-in shaders和URP Shaders之间映射的概述,请参阅Shader mappings

        要升级built-in Shaders:Edit > Render Pipeline > Universal Render Pipeline,根据需求选择Materials to URP Materials或者Upgrade Selected Materials to URP Materials

注意:这些更改无法撤消。在升级项目之前备份项目。

提示:如果项目视图中的预览缩略图在升级后不正确,尝试右键单击Project View窗口中的任何地方,然后选择Reimport All

        对于SpeedTree Shaders,当重新导入时,Unity不会重新生成Materials,除非点击Generate Materials或Apply & Generate Materials按钮。

下表显示Unity built-in shaders在升级Shader转换为URP shaders。

Unity built-in shaderUniversal Render Pipeline shader
StandardUniversal Render Pipeline/Lit
Standard (Specular Setup)Universal Render Pipeline/Lit
Standard TerrainUniversal Render Pipeline/Terrain/Lit
Particles/Standard SurfaceUniversal Render Pipeline/Particles/Lit
Particles/Standard UnlitUniversal Render Pipeline/Particles/Unlit
Mobile/DiffuseUniversal Render Pipeline/Simple Lit
Mobile/Bumped SpecularUniversal Render Pipeline/Simple Lit
Mobile/Bumped Specular(1 Directional Light)Universal Render Pipeline/Simple Lit
Mobile/Unlit (Supports Lightmap)Universal Render Pipeline/Simple Lit
Mobile/VertexLitUniversal Render Pipeline/Simple Lit
Legacy Shaders/DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Bumped DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Bumped SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Self-Illumin/DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Self-Illumin/Bumped DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Self-Illumin/SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Self-Illumin/Bumped SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/Bumped DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/Bumped SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/Cutout/DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/Cutout/SpecularUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/Cutout/Bumped DiffuseUniversal Render Pipeline/Simple Lit
Legacy Shaders/Transparent/Cutout/Bumped SpecularUniversal Render Pipeline/Simple Lit

 8.4 Shader Stripping

        Unity从一个Shader源文件中编译许多Shader变量。Shader变量的数量取决于Shader中包含了多少关键词。在默认Shader中,URP使用一组关键字来光照和阴影。URP可以排除哪些Shader变体,取决于URP Asset中活跃的哪些特性。

        当我们禁用URP Asset中的某些特性时,管线从构建中“剥离”相关的Shader变体。剥离Shaders给我们更小的构建大小和更短的构建时间。如果项目永远不会使用某些特性或关键字,这是很有用的。

        例如,可能有一个项目,我们directional lights永远不会使用阴影。没有Shader剥离,有定向阴影支持的Shader变体仍在构建中。如果我们知道根本不会使用这些阴影,就可以在URP Asset中取消direction light的投影阴影,然后URP从构建中剥离这些Shader变量。

        有关Unity中剥离阴影变量的详细信息,请参阅这篇博客:Stripping scriptable shader variants | Unity Blog

8.5 URP Pass tags: LightMode

        此标记的值允许管线确定在执行Render Pipeline的不同部分时使用哪个传递。

        如果你没有将Light Mode标签设置为Pass,URP使用SRPDefault Unlit t Unlit标记值。

在URP中,Light Mode标签可以有以下值:

PropertyDescription
UniversalForward

The Pass renders object geometry and evaluates all light contributions. URP uses this tag value in the Forward Rendering Path.

该通道渲染对象几何和评价所有光贡献.URP在前向渲染中使用此标签值。

UniversalGBuffer

The Pass renders object geometry without evaluating any light contribution. URP uses this tag value in the Deferred Rendering Path.

该通道在不评估任何光贡献的情况下呈现物体的几何形状.URP在延迟渲染路径中使用此标签值.

UniversalForwardOnly

The Pass renders object geometry and evaluates all light contributions, similarly to when LightMode has the UniversalForward value. The difference from UniversalForward is that URP can use the Pass for both the Forward and the Deferred Rendering Paths.

该通道渲染物体的几何形状并评估光的贡献,类似于Light Mode具有Universalforward值的时候。与Universalforward的区别在于,URP可以同时为转发和延迟渲染路径使用通道。


Use this value if a certain Pass must render objects with the Forward Rendering Path when URP is using the Deferred Rendering Path. For example, use this tag if URP renders a Scene using the Deferred Rendering Path and the Scene contains objects with shader data that does not fit the GBuffer, such as Clear Coat normals.

当URP使用递延渲染通道时,如果某个传递必须使用转发渲染通道渲染对象,则使用此值。例如,如果URP使用延迟渲染通道渲染场景,并且场景包含不适合GBuffer的着色数据的对象,例如清除Coat常态,则使用此标签。


If a shader must render in both the Forward and the Deferred Rendering Paths, declare two Passes with the UniversalForward and UniversalGBuffer tag values. If a shader must render using the Forward Rendering Path regardless of the Rendering Path that the URP Renderer uses, declare only a Pass with the LightMode tag set to UniversalForwardOnly.

如果着色器必须同时呈现在转发和延迟渲染通道中,用Universalforward和Universal GBuffer标记值声明两个Passes。如果着色器必须使用“转发渲染通道”渲染,无论URP渲染器使用的渲染通道如何,只向Universal Forward Only声明带有Light Mode标签的通道。

Universal2D

The Pass renders objects and evaluates 2D light contributions. URP uses this tag value in the 2D Renderer.

该通道染对象和评价2D光贡献,URP在2DRenderer中使用此标签值。

ShadowCaster

The Pass renders object depth from the perspective of lights into the Shadow map or a depth texture.

通过将物体的深度从光线的角度呈现到阴影图或深度纹理。

DepthOnly

The Pass renders only depth information from the perspective of a Camera into a depth texture.

该通道仅从相机的角度呈现深度信息到深度纹理。

MetaUnity executes this Pass only when baking lightmaps in the Unity Editor. Unity strips this Pass from shaders when building a Player.
SRPDefaultUnlit

Use this LightMode tag value to draw an extra Pass when rendering objects. Application example: draw an object outline. This tag value is valid for both the Forward and the Deferred Rendering Paths.

使用这个Light Mode标签值在绘制对象时绘制额外的通道。应用示例:绘制物体描边。此标签值对于转发和延迟渲染通道都有效。


URP uses this tag value as the default value when a Pass does not have a LightMode tag.

当通道没有Light Mode标签时,URP将此标签值作为默认值。

注意:URP不支持以下Light Mode标签:

Always, ForwardAdd, PrepassBase, PrepassFinal, Vertex, VertexLMRGBM, VertexLM.

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

末零

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值