通用渲染管道(URP)使用:

  • Renderer. URP contains the following Renderers:(渲染。URP包含以下渲染)
  • Shading models for shaders shipped with URP(URP附带了着色器的阴影模型)
  • Camera(摄影机)
  • UniversalRP Asset(通用渲染管线资产)

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

URP——通用渲染管线中的渲染

渲染管线在图形设置中**时,Unity使用URP来渲染项目中的所有摄像机,包括游戏和场景视图摄像机、反射探针和检查器中的预览窗口。

URP渲染器为每个摄像头执行一个摄像头循环,执行以下步骤:

  • 筛选场景中渲染的对象
  • 为渲染器构建数据
  • 执行一个渲染器,该渲染器将图像输出到framebuffer。

有关每一步的更多信息,请参见相机循环

在RenderPipelineManager类中,URP提供了一些事件,您可以使用这些事件在渲染帧之前和之后,以及在渲染每个摄像机循环之前和之后执行代码。事件:

有关如何使用beginCameraRendering事件的示例,请参阅使用beginCameraRendering事件的页面。

Camera loop

相机环执行以下步骤:

Step Description
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 AssetCamera, 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.

执行队列中的每个渲染传递。渲染器将摄像机图像输出到framebuffer。

相关文章: