URP 概念

本节描述允许您配置通用渲染管道的概念和设置。

Universal Render Pipeline Asset

要使用通用渲染管线(URP),您必须创建一个URP资产,并在图形设置中分配资产

URP资产控制通用渲染管线的几个图形特性和质量设置。它是一个可编写脚本的对象,继承自“RenderPipelineAsset”。当你在图形设置中分配资产时,Unity会从内置的渲染管道切换到URP。然后,您可以直接在URP中调整相应的设置,而不是在其他地方寻找它们。

您可以拥有多个URP资产并在它们之间进行切换。例如,你可以设置一个打开阴影和一个关闭阴影。如果你切换属性来查看效果,你不必每次都手动切换相应的阴影设置。但是,由于渲染管道不兼容,您不能在HDRP/SRP和URP资产之间切换。

UI overview

在URP中,您可以配置以下设置:

注意:如果你启用了实验性的2D渲染器(Graphics Settings > add the 2D Renderer Asset under Scriptable Render Pipeline Settings),URP资产中与3D渲染相关的一些选项对你的最终应用程序或游戏没有任何影响。

General

General (一般)设置控制管线渲染的核心帧部分。

PropertyDescription
Depth Texture

Enables URP to create a _CameraDepthTexture. URP then uses this depth texture by default for all Cameras in your Scene. You can override this for individual cameras in the Camera Inspector.

允许URP创建_CameraDepthTexture。URP然后在场景中的所有相机上默认使用这个深度纹理。您可以在相机检查器中为单个相机覆盖此选项。

Opaque Texture

Enable this to create a _CameraOpaqueTexture as default for all cameras in your Scene. This works like the GrabPass in the built-in render pipeline. The Opaque Texture provides a snapshot of the scene right before URP renders any transparent meshes. You can use this in transparent Shaders to create effects like frosted glass, water refraction, or heat waves. You can override this for individual cameras in the Camera Inspector.

启用它可以为场景中的所有相机创建一个_CameraOpaqueTexture默认值。这就像内置渲染管道中的GrabPass一样工作。Opaque Texture提供了URP渲染任何透明网格之前的场景快照。你可以在透明着色器中使用它来创建像磨砂玻璃,水折射,或者热波的效果。您可以在相机检查器中为单个相机覆盖此选项。

Opaque DownsamplingSet the sampling mode on the opaque texture to one of the following:
None: Produces a copy of the opaque pass in the same resolution as the camera.
2x Bilinear: Produces a half-resolution image with bilinear filtering.
4x Box: Produces a quarter-resolution image with box filtering. This produces a softly blurred copy.
4x Bilinear: Produces a quarter-resolution image with bi-linear filtering.

将不透明纹理的采样模式设置为以下模式之一:

无:生成与相机具有相同分辨率的不透明通道的副本。

2倍双线性:产生半分辨率图像与双线性滤波。

4x方框:使用方框过滤产生四分之一分辨率的图像。这会产生一个柔和模糊的副本。

4x双线性:产生四分之一分辨率的图像与双线性滤波。

Terrain Holes

If you disable this option, the URP removes all Terrain hole Shader variants when you build for the Unity Player, which decreases build time.

如果你禁用这个选项,URP会在你为Unity玩家构建时移除所有的地形的洞着色器变体,这会减少构建时间。

Quality

这些设置控制URP的质量水平。在这种情况下,您可以在低端硬件上提高性能,或者在高端硬件上使图形看起来更好。

提示:如果您想为不同的硬件设置不同的设置,您可以通过设置多个通用渲染管线资产配置,并根据需要将它们切换出来。

PropertyDescription
HDR

Enable this to allow rendering in High Dynamic Range (HDR) by default for every camera in your Scene. With HDR, the brightest part of the image can be greater than 1. This gives you a wider range of light intensities, so your lighting looks more realistic. With it, you can still see details and experience less saturation even with bright light. This is useful if you want a wide range of lighting or to use bloom effects. If you’re targeting lower-end hardware, you can disable this to skip HDR calculations and get better performance. You can override this for individual cameras in the Camera Inspector.

启用此功能可以默认为场景中的每个摄像机在高动态范围(HDR)中渲染。使用HDR,图像最亮的部分可以大于1。这给了你更广泛的光强度范围,所以你的照明看起来更真实。有了它,即使在明亮的光线下,你仍然可以看到细节,体验较少的饱和度。如果你想要广泛的照明或使用发光(光晕)效果这是非常有用的。如果您的目标是低端硬件,您可以禁用此功能以跳过HDR计算并获得更好的性能。您可以在相机检查器中为单个相机覆盖此选项。

MSAA

Use Multi Sample Anti-aliasing by default for every Camera in your Scene while rendering. This softens edges of your geometry, so they’re not jagged or flickering. In the drop-down menu, select how many samples to use per pixel: 2x4x, or 8x. The more samples you choose, the smoother your object edges are. If you want to skip MSAA calculations, or you don’t need them in a 2D game, select Disabled. You can override this for individual cameras in the Camera Inspector.

在渲染时,默认为场景中的每个相机使用多样本抗锯齿。这样可以软化几何图形的边缘,使它们不会锯齿状或闪烁。在下拉菜单中,选择每个像素使用多少个样本:2x、4x或8x。选择的样本越多,对象的边缘就越平滑。如果您想跳过MSAA计算,或者在2D游戏中不需要它们,请选择禁用。您可以在相机检查器中为单个相机覆盖此选项。

Render Scale

This slider scales the render target resolution (not the resolution of your current device). Use this when you want to render at a smaller resolution for performance reasons or to upscale rendering to improve quality. This only scales the game rendering. UI rendering is left at the native resolution for the device.

这个滑块可以缩放渲染目标的分辨率(不是当前设备的分辨率)。当您出于性能原因想要以较小的分辨率进行渲染或为了提高渲染质量而使用此方法时。这只会缩放游戏渲染。UI渲染留给设备的原生解析。

Lighting

这些设置会影响场景中的灯光。

如果你禁用这些设置,相关的关键字将从着色器变量中剥离。如果有一些你肯定不会在游戏或应用中使用的设置,你可以禁用它们来提高性能并减少构建时间。

PropertyDescription
Main Light

These settings affect the main Directional Light in your Scene. You can select this by assigning it as a Sun Source in the Lighting Inspector. If you don’t assign a sun source, the URP treats the brightest directional light in the Scene as the main light. You can choose between Pixel Lighting and None. If you choose None, URP doesn’t render a main light, even if you’ve set a sun source.

这些设置会影响场景中的主方向光。您可以通过在照明检查器中将它指定为一个太阳光源来选择它。如果你没有指定一个太阳光源,URP会将场景中最亮的方向光作为主光。你可以在像素照明和无照明之间选择。如果你选择None, URP不会渲染主光,即使你设置了一个太阳光源。

Cast Shadows

Check this box to make the main light cast shadows in your Scene.

选中这个框,让主光源在场景中投射阴影。

Shadow Resolution

This controls how large the shadow map texture for the main light is. High resolutions give sharper, more detailed shadows. If memory or rendering time is an issue, try a lower resolution.

这控制了主光源的阴影贴图纹理的大小。高分辨率可以产生更清晰、更详细的阴影。如果内存或渲染时间是一个问题,尝试低分辨率。

Additional Lights

Here, you can choose to have additional lights to supplement your main light. Choose between Per VertexPer Pixel, or Disabled.

在这里,你可以选择有额外的灯来补充你的主灯。选择每个顶点,每个像素,或禁用。

Per Object Limit

This slider sets the limit for how many additional lights can affect each GameObject.

这个滑块设置了限制多少额外的灯光可以影响每个游戏对象。

Cast Shadows

Check this box to make the additional lights cast shadows in your Scene.

选中这个框,让额外的灯光在你的场景中投射阴影。

Shadow Resolution

This controls the size of the textures that cast directional shadows for the additional lights. This is a sprite atlas that packs up to 16 shadow maps. High resolutions give sharper, more detailed shadows. If memory or rendering time is an issue, try a lower resolution.

这控制了纹理的大小,为额外的灯光投射方向阴影。这是一个精灵图集,包含了16个阴影贴图。高分辨率可以产生更清晰、更详细的阴影。如果内存或渲染时间是一个问题,尝试低分辨率。

Shadows

这些设置可以让您配置阴影的外观和行为,并在视觉质量和性能之间找到一个良好的平衡。

阴影部分有以下属性。

PropertyDescription
Max Distance

The maximum distance from the Camera at which Unity renders the shadows. Unity does not render shadows farther than this distance.
Note: This property is in metric units regardless of the value in the Working Unitproperty.

Unity渲染阴影时距离摄像机的最大距离。Unity不会渲染比这个距离更远的阴影。

注意:无论工作单元属性中的值是多少,此属性都以公制单位表示。

Working Unit

The unit in which Unity measures the shadow cascade distances.

测量阴影级联距离的单位。

Cascade Count

The number of shadow cascades. With shadow cascades, you can avoid crude shadows close to the Camera and keep the Shadow Resolution reasonably low. For more information, see the page Shadow Cascades. Increasing the number of cascades reduces the performance.

影子级联的数量。使用阴影级联,你可以避免粗糙的阴影靠近相机,并保持阴影分辨率合理的低。有关更多信息,请参见页面阴影级联。增加级联的数量会降低性能。

    Split 1

The distance where cascade 1 ends and cascade 2 starts.

级联1结束和级联2开始的距离。

    Split 2

The distance where cascade 2 ends and cascade 3 starts.

级联2结束和级联3开始的距离。

    Split 3

The distance where cascade 3 ends and cascade 4 starts.

cascade 3结束和cascade 4开始的距离。

Depth Bias

Use this setting to reduce shadow acne.

使用这个设置来减少暗疮。

Normal Bias

Use this setting to reduce shadow acne.

使用这个设置来减少暗疮。

Soft Shadows

Select this check box to enable extra processing of the shadow maps to give them a smoother look.
When enabled, Unity uses the following shadow map filtering method:
Desktop platforms: 5x5 tent filter, mobile platforms: 4 tap filter.
Performance impact: high.
When this option is disabled, Unity samples the shadow map once with the default hardware filtering.

选中此复选框可对阴影映射进行额外处理,以使其外观更加平滑。

当启用时,Unity使用以下阴影贴图过滤方法:

桌面平台:5x5帐篷过滤器,移动平台:4 tap过滤器。

性能影响:高。

当这个选项被禁用时,Unity使用默认的硬件过滤来采样一次阴影贴图。

Post-processing

本节允许您对全局后期处理设置进行微调。

PropertyDescription
Grading Mode

Select the color grading mode to use for the Project.
• High Dynamic Range: This mode works best for high precision grading similar to movie production workflows. Unity applies color grading before tonemapping.
• Low Dynamic Range: This mode follows a more classic workflow. Unity applies a limited range of color grading after tonemapping.

选择项目要使用的颜色分级模式。

•高动态范围:这种模式最适合高精度分级,类似电影制作工作流程。统一在调色前应用颜色分级。

•低动态范围:此模式遵循更经典的工作流程。统一在调色后应用有限范围的颜色分级。

LUT Size

Set the size of the internal and external look-up textures (LUTs) that the Universal Render Pipeline uses for color grading. Higher sizes provide more precision, but have a potential cost of performance and memory use. You cannot mix and match LUT sizes, so decide on a size before you start the color grading process.
The default value, 32, provides a good balance of speed and quality.

设置通用渲染管线用于颜色分级的内部和外部查找纹理(LUTs)的大小。更大的尺寸提供了更精确的精度,但有性能和内存使用的潜在成本。你不能混合和匹配LUT大小,所以,你开始的颜色分级过程之前决定一个大小。

默认值32提供了速度和质量的良好平衡。

Advanced

本节允许您微调不太常更改的设置,这些设置会影响更深层次的渲染特性和着色器组合。

PropertyDescription
SRP Batcher

Check this box to enable the SRP Batcher. This is useful if you have many different Materials that use the same Shader. The SRP Batcher is an inner loop that speeds up CPU rendering without affecting GPU performance. When you use the SRP Batcher, it replaces the SRP rendering code inner loop.

选中此框以启用SRP批处理程序。这是有用的,如果你有许多不同的材质使用相同的着色器。SRP批处理程序是一个内部循环,加速CPU渲染而不影响GPU性能。当您使用SRP批处理程序时,它将替换SRP呈现代码的内部循环。

Dynamic Batching

Enable Dynamic Batching, to make the render pipeline automatically batch small dynamic objects that share the same Material. This is useful for platforms and graphics APIs that do not support GPU instancing. If your targeted hardware does support GPU instancing, disable Dynamic Batching. You can change this at run time.

启用动态批处理,使渲染管线自动批处理共享同一材质的动态小对象。这对于不支持GPU实例化的平台和图形api非常有用。如果你的目标硬件确实支持GPU实例化,禁用动态批处理。您可以在运行时更改这一点。

Mixed Lighting

Enable Mixed Lighting, to tell the pipeline to include mixed lighting shader variants in the build.

启用混合照明,告诉管线在构建中包含混合照明着色器变体。

Debug Level

Set the level of debug information that the render pipeline generates. The values are:
Disabled: Debugging is disabled. This is the default.
Profiling: Makes the render pipeline provide detailed information tags, which you can see in the FrameDebugger.

设置渲染管线生成的调试信息的级别。

它的值是:

Disabled:禁用调试。这是默认值。

Profiling:使渲染管线提供详细的信息标记,您可以在FrameDebugger中看到。

Shader Variant Log Level

Set the level of information about Shader Stripping and Shader Variants you want to display when Unity finishes a build. Values are:
Disabled: Unity doesn’t log anything.
Only Universal: Unity logs information for all of the URP Shaders.
All: Unity logs information for all Shaders in your build.
You can see the information in Console panel when your build has finished.

当Unity完成一个构建时,设置你想要显示的着色器剥离和着色器变体的信息级别。

值:

Disabled:Unity不记录任何内容。

Only Universal:Unity记录所有URP着色器的信息。

All:Unity记录你构建中所有着色器的信息。

当构建完成时,您可以在控制台面板中看到这些信息。

Adaptive Performance

如果在项目中安装了Adaptive Performance包,则可以使用此部分。使用自适应性能属性允许启用自适应性能功能。

PropertyDescription
Use Adaptive Performance

Select this check box to enable the Adaptive Performance functionality, which adjusts the rendering quality at runtime.

选中此复选框以启用Adaptive Performance功能,该功能在运行时调整渲染质量。

Forward Renderer

本页描述了URP前向渲染器的设置。

URP中的前向渲染器实现了前向渲染路径。

有关URP如何实现和使用前向渲染器的更多信息,请参见通用渲染管道中的渲染

How to find the Forward Renderer asset

要找到URP资产正在使用的正向渲染器资产:

选择URP资产。

在渲染器列表部分,单击一个渲染器项或垂直省略号图标(⋮)在渲染器旁边。

当你使用通用渲染管道模板创建一个新项目时,正向渲染器资产在以下位置:

/Assets/Settings/ForwardRenderer.asset

Forward Renderer asset reference

本节描述正向渲染器资产的属性。

Forward Renderer

本节包含高级定制用例的属性。

PropertyDescription
Post Process Data

The asset containing references to shaders and Textures that the Renderer uses for post-processing.
Note: This property is for advanced customization use cases.

这个资产包含了渲染器用于后期处理的着色器和纹理的引用。
注意:此属性用于高级定制用例。

Filtering

此部分包含定义渲染器绘制哪些层的属性。

PropertyDescription
Opaque Layer Mask

Select which opaque layers this Renderer draws

选择该渲染器绘制的不透明层

Transparent Layer Mask

Select which transparent layers this Renderer draws

选择该渲染器绘制哪些透明层

Shadows

这个部分包含与渲染阴影相关的属性。

PropertyDescription
Transparent Receive Shadows

When this option is on, Unity draws shadows on transparent objects.

当这个选项打开时,Unity在透明对象上绘制阴影。

Overrides

此部分包含此渲染器覆盖的渲染管线属性。

Stencil

选中此复选框后,渲染程序处理模具缓冲区值。

有关Unity如何使用模板缓冲区的更多信息,请参见 ShaderLab: Stencil

Renderer Features

此部分包含分配给所选渲染器的渲染器特性列表。

有关如何添加渲染器特性的信息,请参见如何向渲染器添加渲染器特性

URP包含预构建的渲染器特性,称为渲染对象

URP Renderer Feature

渲染器特性是一种资产,它允许您向URP渲染器添加额外的渲染通道并配置它们的行为。

URP包含预构建的渲染器特性,称为渲染对象。

有关如何向呈现器添加呈现器特性的信息,请参阅“如何向呈现器添加呈现器特性”一页。

Render Objects Renderer Feature

渲染对象渲染器特性包含以下属性。

PropertyDescription
Name

The name of the feature.

特性的名称。

Event

The event in the URP queue when Unity executes this Renderer Feature.

当Unity执行这个渲染器特性时URP队列中的事件。

Filters

Settings that let you configure which objects this Renderer Feature renders.

配置渲染器渲染哪些对象的设置。

Queue

Select whether the feature renders opaque or transparent objects.

选择该特性是渲染不透明对象还是透明对象。

Layer Mask

The Renderer Feature renders objects from layers you select in this property.

渲染器特性从你在这个属性中选择的层中渲染对象。

Pass Names

If a Pass in a shader has the LightMode Pass Tag, this Renderer Feature processes only the shaders where the value of the LightMode Pass Tag equals one of the values in the Pass Names property.

如果一个着色器中的一个Pass有LightMode Pass标签,这个渲染器特性只处理那些LightMode Pass标签的值等于Pass Names属性中的一个值的着色器。

Overrides

Settings in this section let you configure overrides for certain properties when rendering with this Renderer Feature.

本节中的设置允许您在使用此渲染器特性进行渲染时配置某些属性的覆盖。

Material

When rendering an object, Unity replaces the Material assigned to it with this Material.

当渲染一个对象时,Unity用这个分配给它的材质替换材质。

Depth

Selecting this option lets you specify how this Renderer Feature affects or uses the Depth buffer. This option contains the following items:
Write Depth: this option defines whether the Renderer Feature updates the Depth buffer when rendering objects.
Depth Test: the condition which determines when this Renderer Feature renders pixels of a given object.

选择此选项可让您指定此渲染器特性如何影响或使用深度缓冲区。此选项包含以下项目:
写入深度:这个选项定义渲染器在渲染对象时是否更新深度缓冲区。
深度测试:决定渲染器什么时候渲染给定对象的像素的条件。

Stencil

With this check box selected, the Renderer processes the Stencil buffer values.
For more information on how Unity works with the Stencil buffer, see ShaderLab: Stencil.

选中此复选框后,渲染程序处理模具缓冲区值。
有关Unity如何使用模板缓冲区的更多信息,请参见 ShaderLab: Stencil

Camera

Selecting this option lets you override the following Camera properties:
Field of View: when rendering objects, the Renderer Feature uses this Field of View instead of the value specified on the Camera.
Position Offset: when rendering objects, the Renderer Feature moves them by this offset.
Restore: with this option selected, the Renderer Feature restores the original Camera matrices after executing the render passes in this Renderer Feature.

选择这个选项可以让您覆盖以下相机属性:
视场:当渲染对象时,渲染器功能使用这个视场,而不是相机上指定的值。
位置偏移:当渲染对象时,渲染器特性通过这个偏移来移动它们。
还原:选择此选项后,渲染器功能将在执行此渲染器功能中的渲染通道后还原原始相机矩阵。

  • 1
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值