unity hdrp_如何在Unity HDRP中创建可配置的汽车

unity hdrp

Light & Shadows, based in Paris, has used HDRP to produce stunningly realistic real-time images and videos. This blog post from Light & Shadows walks through the processes they’ve used to achieve these excellent results.

总部位于巴黎的“光与影”公司(Light&Shadows)使用HDRP来制作逼真的实时图像和视频。 来自Light&Shadows的这篇博客文章介绍了它们用于实现这些出色结果的过程。

光影史 (History of Light and Shadows)

Unity has worked closely with Light & Shadows on projects to demonstrate lifelike visual quality in real time. This blog post has been written by Light & Shadows to provide technical insight into how they used Unity’s new HD Render Pipeline to produce an amazingly realistic video of the Lexus LC 500 in real time. Light & Shadows was founded in 2009 in response to growing demand by major industrial companies for compelling visual content. From its founding, the company has thrived by continuously adapting and innovating the delivery of new capabilities to its customers, including the generation of high-quality rendering together with cost reduction and productivity improvement. The rest of this blog post is from Light & Shadows.

Unity与Light&Shadows在项目上紧密合作,以实时展示逼真的视觉质量。 这篇博客文章由Light&Shadows撰写,旨在提供技术见解,介绍他们如何使用Unity的新HD渲染管线实时生成雷克萨斯LC 500的逼真视频。 Light&Shadows成立于2009年,以响应主要工业公司对引人注目的视觉内容的日益增长的需求。 自成立以来,该公司一直在不断适应和创新为客户提供新功能的过程中蓬勃发展,包括生成高质量渲染以及降低成本和提高生产率。 本博客文章的其余部分来自《光与影》。

实时渲染:汽车行业的游戏规则改变者 (Real-time rendering: A game changer for the automotive industry)

Technology is transforming the way we experience, sell and buy cars. Light and Shadows has deep experience with automotive visualization and offline rendering, as evidenced by the PSA car configurator and projects with Dassault Aviation. Although we primarily used a different real-time engine until recently, we have now partnered with Unity to deliver real-time rendering results using HDRP that achieve new levels of visual quality and performance. To prove these new capabilities, we recently created a video demonstrating real-time rendering of a Lexus LC500.

技术正在改变我们体验,销售和购买汽车的方式。 PSA汽车配置器和Dassault Aviation的项目证明,Light and Shadows在汽车可视化和脱机渲染方面拥有丰富的经验。 尽管直到最近我们主要使用不同的实时引擎,但我们现在已经与Unity合作,使用HDRP提供实时渲染结果,从而将视觉质量和性能提高到新的水平。 为了证明这些新功能,我们最近创建了一个视频,演示了雷克萨斯LC500的实时渲染。


项目从始至终 (The project from start to finish)

CAD数据准备工具和流程 (CAD data preparation tools and process)

For the LC500 project, Lexus provided us with access to boundary representation (B-rep) CAD data for all visible surfaces and certain internal geometry. This was helpful, as we didn’t need to do any hard surface modeling. However, the model is very complex and so organizing and preparing the data was a challenge. To meet this challenge, we selected PiXYZ software for its advanced tessellation and scriptable data preparation features.

对于LC500项目,雷克萨斯为我们提供了访问所有可见表面和某些内部几何图形的边界表示(B-rep)CAD数据的权限。 这很有用,因为我们不需要进行任何硬表面建模。 但是,该模型非常复杂,因此组织和准备数据是一个挑战。 为了应对这一挑战,我们选择了PiXYZ软件,因为它具有先进的细分和可编写脚本的数据准备功能。

As is typical of most complex products, the model of the Lexus is organized into an extensive hierarchy of objects, in this case representing thousands of components of the car. We decided to separate the outside and inside of the car, which gave us more flexibility and allowed us to work on the two parts of the model in parallel. We were also able to segregate design content including the powertrain, chassis, and vehicle structural components.

与大多数复杂产品一样,雷克萨斯的模型被组织成广泛的对象层次结构,在这种情况下,代表汽车的数千个组件。 我们决定将汽车的内外分开,这给了我们更大的灵活性,并允许我们并行处理模型的两个部分。 我们还能够分离设计内容,包括动力总成,底盘和车辆结构组件。

The source data is not organized as a single vehicle per file, but instead as a collection of parts covering all the geometric options of the same vehicle. This provided us the opportunity to organize the data in a logical way to mirror the variants (options) available to a Lexus customer. We used an XML file to logically connect each part in the source data with the relevant option logic. Using this XML together with a custom script, we were able to isolate the different variants of the vehicle into a form where a visual representation of each option combination can be readily assembled.

源数据不是按每个文件组织为单个车辆,而是组织为覆盖同一车辆的所有几何选项的零件的集合。 这为我们提供了以逻辑方式组织数据的机会,以反映雷克萨斯客户可用的变体(选项)。 我们使用XML文件将源数据中的每个部分与相关的选项逻辑进行逻辑连接。 通过将此XML与自定义脚本一起使用,我们能够将车辆的不同变体隔离成一种形式,在其中可以方便地组装每个选项组合的视觉表示。

Once the different parts were isolated, the next step was tessellation. This process involves transforming CAD data (B-rep) into a tessellated form (triangles) which can be used in applications such as 3ds Max or Unity. By using PiXYZ software, we were able to produce relatively lightweight tessellated models and still produce excellent visual quality.

一旦分离出不同的部分,下一步就是镶嵌。 此过程涉及将CAD数据(B-rep)转换为可细分的形式(三角形),该形式可在3ds Max或Unity等应用程序中使用。 通过使用PiXYZ软件,我们能够生产相对轻巧的镶嵌模型,并且仍能产生出色的视觉质量。

实现最佳照明和烘烤的选项 (Options to achieve optimal lighting and baking)

To achieve the very high standard for visual quality that we set for ourselves, we used lightmaps to enhance lighting. As part of this workflow, we needed to unwrap every single part of the car without any overlaps. We used automatic unwrapping tools together with interactive (manual) unwrapping where needed to optimize seam placement.

为了达到我们为自己设定的非常高的视觉质量标准,我们使用了光照贴图来增强光照。 作为此工作流程的一部分,我们需要拆开汽车的每个零件而没有任何重叠。 我们在需要优化接缝放置的地方使用了自动展开工具以及交互式(手动)展开工具。

UVs wrapped across visible surfaces


We evaluated two options to compute the lightmaps – directly in Unity with its built-in lightmapper, and in 3ds Max using a third party renderer such as Octane or V-Ray. We decided to evaluate both methods so we could compare the quality level resulting from each, and to test the workflow to integrate external lightmaps with Unity’s built-in lightmapper. The interior lightmaps of the vehicle were calculated directly in Unity, and with the right settings, the results were very convincing. The direct lighting is provided by real-time lights, while the indirect lighting is baked. With this technique, we are able to provide realistic visuals even when animating interactive parts of the scene such as turning the steering wheel and opening the doors. Using the built-in lightmapper in Unity was very straightforward and yielded excellent results.

我们评估了两个选项来计算光照贴图-直接在带有内置光照贴图的Unity中,以及在使用第三方渲染器(例如Octane或V-Ray)的3ds Max中。 我们决定对这两种方法进行评估,以便可以比较每种方法的质量水平,并测试工作流程以将外部光照贴图与Unity的内置光照贴图器集成。 车辆的内部光照贴图是直接在Unity中计算的,并且在正确的设置下,结果令人信服。 直接照明是由实时照明提供的,而间接照明是烘烤的。 使用这种技术,即使在为场景的交互部分设置动画时,例如转动方向盘和打开车门,我们也能够提供逼真的视觉效果。 在Unity中使用内置的光照贴图器非常简单,并产生了出色的效果。

Interior with and without lightmaps


We chose to experiment with the Octane lightmapper to interactively tailor specular occlusion for each exterior object in the model. We edited the standard shader in HDRP to properly incorporate a separated UV channel. The result was satisfying and enabled us to generate a visual result which is very realistic, especially in gaps between the body panels. Using these two approaches allowed us to evaluate tradeoffs between the flexibility of an external lightmapper and the ease of use of the integrated lightmapper. Ultimately we concluded that we could achieve the desired results with either approach.

我们选择使用Octane光照贴图进行实验,以交互方式为模型中的每个外部对象调整镜面反射遮挡。 我们在HDRP中编辑了标准着色器,以正确合并单独的UV通道。 结果令人满意,使我们能够产生非常逼真的视觉效果,尤其是车身面板之间的缝隙。 使用这两种方法使我们能够评估外部光照贴图的灵活性和集成光照贴图的易用性之间的折衷。 最终,我们得出结论,无论哪种方法,我们都可以达到预期的结果。

Exterior with and without lightmaps


量身定制的材料可以实现照片写实 (Tailored materials to achieve photorealism)

With our years of experience in the world of automotive offline rendering, we have accumulated a large collection of high-res textures in the form of diffuse maps, height maps, specular maps, normal maps and more. For this Lexus project we wanted to use our favorite maps to get the best results, but to optimize performance Unity needs metallic, smoothness and AO maps combined into the RGB channels of a single map. This approach is optimal for performance but creates challenges to interactively tweak maps and shaders precisely. Because the Shader Graph wasn’t available for HDRP when we started this project, we asked our development team to create a custom texture editor tool allowing us to load and tweak each map in our textures independently and directly in the standard HDRP shader. This editor tool enabled us to work very efficiently by fine-tuning materials directly in Unity. Now that the Shader Graph is available for HDRP, this same capability is available to all Unity customers.

凭借我们在汽车离线渲染领域的多年经验,我们以扩散贴图,高度贴图,镜面贴图,法线贴图等形式积累了大量的高分辨率纹理。 对于这个雷克萨斯项目,我们希望使用我们喜欢的贴图来获得最佳效果,但是要优化性能,Unity需要将金属贴图,平滑贴图和AO贴图组合到单个贴图的RGB通道中。 这种方法对于性能而言是最佳的,但给以交互方式精确调整地图和着色器带来了挑战。 由于在开始此项目时Shader Graph无法用于HDRP,因此我们要求开发团队创建一个自定义纹理编辑器工具,使我们能够独立地直接在标准HDRP着色器中加载和调整纹理中的每个贴图。 这个编辑器工具使我们可以直接在Unity中微调素材,从而非常高效地工作。 现在,Shader Graph可用于HDRP,所有Unity用户均可使用此功能。

Custom texture editing


后期处理 (Post-processing)

Post-processing is essential to give a film-like and realistic feeling to a 3D scene. HDRP provides many available options to tweak the final look of a scene, including color grading, bloom, vignetting, depth of field, and more.

后处理对于为3D场景赋予电影般逼真的感觉至关重要。 HDRP提供了许多可用选项来调整场景的最终外观,包括颜色分级,光晕,渐晕,景深等等。

Door interior with and without post-processing


Depth of field is an essential visual effect to achieve realistic visualization. It helps the viewer to focus on a specific area and feel immersed in the scene. Applying fixed values for the depth of field focus point within a real-time app could produce unnatural results, so we made a small camera script that automatically sets the focus on the closest object in front of the camera. It was very easy in Unity for us to cast rays within the scene to determine the closest object.

景深是实现逼真的可视化的基本视觉效果。 它可以帮助观看者将注意力集中在特定区域并沉浸在场景中。 在实时应用程序中为景深对焦点应用固定值可能会产生不自然的结果,因此我们制作了一个小型相机脚本,该脚本自动将焦点设置在相机前面最近的对象上。 在Unity中,我们很容易在场景中投射光线以确定最接近的对象。

Interior with and without depth-of-field effect


重要细节 (Important details)

We used Cinemachine in Unity to make what we call a “Demo” mode, a kind of cinematic showcase mode with predefined camera paths, to show key features of the product even when nobody is actively interacting with the car.


To accurately represent the car, we provided a way to manage its many different configurations. Not only did we need to switch among variants in the runtime (executable) app, but also within the Unity Editor, to ensure that all variants were correctly defined. To achieve this, we created a configuration management script that records “scene states” and provides automatic material assignment.

为了准确表示汽车,我们提供了一种管理其许多不同配置的方法。 我们不仅需要在运行时(可执行)应用程序中的变体之间进行切换,而且还需要在Unity编辑器中进行切换,以确保正确定义了所有变体。 为此,我们创建了一个配置管理脚本来记录“场景状态”并提供自动材料分配。

Variant configuration logic


Four different interior variants


下一步是什么 (What’s next)

Our experience with this project has given us the confidence to use HDRP to pursue new customer projects demanding the highest level of visual quality. We are able to deploy new projects very efficiently through the use of PiXYZ for data preparation together with the latest rendering, cinematic, and post-processing tools in Unity and our own in-house custom tools and scripts.

我们在该项目中的经验使我们有信心使用HDRP来追求要求最高视觉质量的新客户项目。 通过使用PiXYZ进行数据准备,以及Unity中最新的渲染,电影和后处理工具以及我们自己的内部自定义工具和脚本,我们能够非常高效地部署新项目。

Real-time 3D rendering is transforming the way we develop, manufacture and market products. See how Light & Shadows partners with Unity to deliver real-time 3D results in an on-demand webinar. We will go in-depth the steps that we described in the above blog.

实时3D渲染正在改变我们开发,制造和销售产品的方式。 了解Light&Shadows如何与Unity合作在按需在线研讨会上提供实时3D结果。 我们将深入介绍上述博客中描述的步骤。

Watch now


We at Unity would like to thank Light & Shadows for this blog post and for the great work they did on this video. More information about Unity’s solutions for Automotive and Transportation can be found here.

Unity的我们要感谢Light&Shadows的这篇博客文章以及他们在此视频上所做的出色工作。 可以在此处找到有关Unity汽车和运输解决方案的更多信息。

翻译自: https://blogs.unity3d.com/2019/01/23/how-to-create-a-configurable-car-in-unity-hdrp/

unity hdrp

评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页