上次更新时间:2020 年 2 月(阅读时长:10 分钟)

开始使用高清渲染管线 (HDRP) 制作游戏

本页内容简介了解如何评估何时该使用高清渲染管线 (HDRP) 以及如何开始将其用于生产。基于 Jennifer S. Roig-Deslandes 在 Unite Copenhagen 2019 上的主题演讲。

高清渲染管线检查清单

Among the most frequent questions Unity engineers get from creators are “What is HDRP?” and “How can I use it in my project?” So we put together this list of considerations to help you understand how you can use the High Definition Render Pipeline (HDRP) in your projects to get the most out of it. 

Let’s start by answering a few questions to assess if your project is ready for HDRP: 

  1. Are you on the right target platform? 

The first question you need to ask yourself is if you are shipping on a supported platform. If you’re planning to ship on consoles such as Xbox One and PlayStation 4, Windows (DirectX 11, DirectX 12 and Vulkan), Mac (Metal), and VR headsets (PlayStation VR, Oculus Rift, OpenVR, Windows Mixed Reality), then we’ve got you covered. There’s currently very little support for Linux, and no support for Nintendo Switch, OpenGL, and mobile platforms. 

  1. Are you in the right production cycle? 

HDRP will be out of preview with the Unity 2019.3 release. We strongly recommend you use HDRP with that version onwards; with Unity 2019.3 Long-Term Support (LTS) and above, you will have full support. If you use HDRP with any previous Unity versions, you’ll have to do all of the maintenance yourself.  

  1. Do you have technical pillars that are compatible with HDRP and production skill sets?

Working with HDRP requires a lot of upgrade and maintenance. To move from the Built-in rendering pipeline or the Universal Render Pipeline, you’ll also have to ramp up on technical knowledge for HDRP. Make sure that you and your team allocate some time to learn this tech.

  1. Is it the right tech for your artistic vision? 

HDRP is grounded in physically based rendering and offers a unified lighting pipeline. Also, it comes with several tools for your artistic needs: Visual Effect Graph, Look Dev, and post-processes. For characters and environment, HDRP offers skin, hair, and eye shaders, as well as subsurface scattering and some support for terrain. 

If you’re still deciding what render pipeline to use, here are a few things to consider. HDRP is supported with Unity 2019 LTS and above, and it comes with its own high-definition post-processing stack. It also comes with ray tracing support, VFX Graph support, Shader Graph support, and state-of-the-art graphics features.

If your project contains complex scenes, HDRP will scale better than with the built-in rendering pipeline. However, if you're planning to ship on both mobile and consoles, HDRP might not be the right tech for you.

HDRP 试图解决什么问题?

HDRP 旨在提供统一、连贯的光照。这与性能以及最先进的技术息息相关。

统一、连贯的光照

HDRP 是基于物理的渲染管线,这意味着您可以使用真实输入来创建场景。例如,灯光的光度以流明或勒克斯表示。

现在,美术师可以独立于上下文创作资源。当上下文改变时,您的视觉效果仍能在项目中保持连贯。

性能至上

HDRP 功能在我们当前支持的所有平台上均可提供极高的性能。我们希望您能在不牺牲性能的情况下实现项目的美术愿景。

最先进的技术

HDRP 采用了视频游戏行业的标准技术:基于物理的渲染、物理光单位和基于物理的组件,并提供了用户友好的工具。

开始使用:使用 HDRP 创建您的第一个项目

要在您的项目中开始使用 HDRP,我们建议您执行以下步骤:

  1. 通过演示和示例了解这项技术。

Unity 制作的所有演示都是以您下载 HDRP 包后可获得的相同技术制作的。您可以立即查看以下两个演示:FontainebleauSpaceship。这两个演示都附带了方便查看的文档和博客文章,对演示的创建过程进行了说明。

每个 HDRP 包版本都包含示例。

  1. 从 Unity Hub 中的 HDRP 模板创建新项目

如果您做好了深入学习的准备,可以按照以下步骤开始在 Unity 中使用 HDRP 创建项目:打开 Hub,创建一个新项目,选择 High Definition Render 模板,这就行了。此时,编辑器将打开,您可以尽情探索了。

  1. 使用渲染管线向导

如果事情进展不顺利,渲染管线向导可以帮助您确定项目中存在的任何问题。您可以在 Window > Analysis > Render Pipeline Wizard 下找到它。

从内置管线到 HDRP

迁移您的游戏:从内置管线到 HDRP

如果您的项目已经使用了内置渲染管线,而您想要将其迁移到 HDRP,请按照以下建议步骤进行操作。

首先,确保您使用的是所需的 Unity 版本。要做出决定,请查阅文档。打开 Package Manager 并单击 High Definition RP,您将看到正在运行的版本。下方有一些链接 - 最重要的是,一个文档链接和一个变更日志链接。

请注意,包的每个主要版本都对应于兼容的 Unity 版本。您可在 Package Manager 中找到该信息。例如,HDRP 包的 5.0.1 版本与 Unity 2019.1 兼容。确定适合您的 Unity 版本和对应的 HDRP 包后,就可以继续升级项目了。

高清渲染管线项目设置渲染

具体如何升级项目?

首先,请确保删除项目当前使用的后处理栈,因为 HDRP 有自己的后处理栈。为此,请在 Package Manager 中选择 Post Processing,然后单击 Remove。

然后,您需要确保您位于线性颜色空间中。转到 Edit > Project Settings,选择 Player,转到 Other Settings 查看 Color Space Settings。将该值从 Gamma 更改为 Linear

然后,下载 HDRP 包。在 Package Manager 中,选择 High Definition RP,然后单击 Install。确保为您的 Unity 版本更新到最新的补丁程序版本。

高清渲染管线资源

要在项目中使用 HDRP,您需要使用高清渲染管线资源。在 Project 窗口中,右键单击 Assets 并转到 Create > Rendering,然后选择 High Definition Render Pipeline Asset。然后,确保将其分配给项目:转到 Edit > Project Settings > Graphics,然后选择 High Definition Render Pipeline Asset

高清渲染管线 HD 渲染管线向导

渲染管线向导

如果某些内容看起来不正确,可能是因为您使用的材质与 HDRP 不兼容。请使用渲染管线向导检查您的设置、材质和光照是否与 HDRP 兼容。

渲染管线向导 (Window > Analysis > Render Pipeline Wizard) 将为您提供项目中存在的潜在问题的完整列表。您可以单独检查问题,也可以单击 Fix All

高清渲染管线升级项目材质

转换材质

解决所有问题后,就可以开始转换材质了。要转换材质,请转到 Edit > Render Pipeline,将项目材质升级High Definition Materials;项目中的所有标准光照/无光照着色器将转换为 HDRP 光照/无光照材质。

然后,将光照从非物理光照单位更改为物理精确的光照单位。转换材质并调整光照后,需要重新创建后处理。

HDRP 中的后处理

默认情况下,您的项目已在 Project Settings > HDRP Default Settings > Volume Components 中启用了后处理。例如,默认启用了 Tonemapping 和 Bloom,但您可以通过 Volume Components 进行更改。您也可以为场景创建自己的体积,并在该部分为其添加新的配置文件。

如何充分利用 HDRP

看一下 HDRP 设置。可以在很多地方找到这些设置:

  • 您可以在两个地方调整项目范围的设置:

    • 例如,您可以使用 HDRP Default Settings 指定是否在项目中启用阴影
    • HDRenderPipelineAsset 也具有一些设置,例如贴花或后处理
  • Volume Components 显示当前场景的设置,例如后处理和天空。这些设置可以是针对您的 Volume 的(局部),也可以是针对场景的(全局)。
  • 基于摄像机的设置让您可以调整遮罩、背景、投影、视野等。

为项目确立设置后,您可能想要做进一步的调整。

可以通过多种方法在 HDRP 包中自定义渲染过程。

  • 自定义通道:使用不同材质渲染通过列表选定的场景对象,以便二次渲染它们。
  • 自定义全屏通道:使用特定材质渲染全屏四边形
  • 自定义后处理:渲染您自己的后处理

我们在 GitHub 上提供了 HDRP 的源代码,因此您可以根据项目需求对其进行调整。但是,我们强烈建议您制作副本以建立分支,并定期集成 Unity 提供的所有错误修复。

在哪里可以了解有关 HDRP 的更多信息?

如果您想了解有关如何在项目中开始使用 High Definition RP 的更多信息,请确保阅读 HDRP 概述手册、阅读最新的博客文章和加入论坛上的讨论。

我们使用 Cookie 来确保为您提供网站的最佳体验。有关更多信息,请访问我们的 Cookie 政策页面

明白了