unity 可视化渲染管线
Prior to Unite Copenhagen in September 2019, Unity collaborated with Lexus and its agency Team One to showcase a real-time car configurator and promote Unity as a photographic tool with real-world camera controls, using the High Definition Render Pipeline (HDRP). The demo featured a high-detail car model from Lexus in different trims, a fully-modeled 3D environment of the Amalienborg Palace in Copenhagen, and 3 distinct lighting conditions.
在2019年9月举行哥本哈根Unite大会之前,Unity与雷克萨斯及其代理商Team One合作展示了一款实时汽车配置器,并使用高清渲染管道(HDRP)将 Unity推广为带有现实相机控制的摄影工具。 该演示以雷克萨斯(Lexus)的高细节汽车模型为特色,并采用了不同的装饰,哥本哈根的阿美琳堡宫(Amalienborg Palace)的完全建模3D环境以及3种不同的照明条件。
Unity’s Spotlight team in the UK was in charge of the quality of the environment and lighting, to ensure the car appeared in the best possible light, literally.
从根本上说,Unity在英国的Spotlight团队负责环境和照明的质量,以确保汽车在尽可能最佳的光线下出现。
This article will explain in more detail how I set up HDRP in the context of this automotive scenario, and how physically-correct lighting and camera setups can help you to reach an impressive level of visual fidelity for high-end visualizations made with Unity.
本文将更详细地说明我如何在这种汽车场景中设置HDRP,以及物理上正确的照明和摄像头设置如何帮助您达到使用Unity进行高端可视化的令人印象深刻的视觉保真度。
软件和数据 (Software and data)
The demo used an early build of Unity 2019.3 in conjunction with HDRP 7.1.x. The car materials rely on Unity’s extensive Library of Measured Materials which offers, among many others, a realistic car paint shader with metal flakes. The environment uses the standard HDRP Lit shader. Important mention: for this demo, HDRP’s Ray-Tracing capabilities were not utilized because they were still in early preview at the time.
该演示将Unity 2019.3的早期版本与HDRP 7.1.x结合使用。 汽车材料依赖于Unity广泛的测量材料库,该库除其他外,还提供了带有金属薄片的逼真的汽车油漆着色器。 该环境使用标准的HDRP Lit着色器。 重要提示:对于此演示,未使用HDRP的光线追踪功能 ,因为当时它们仍处于早期预览中。
The extremely detailed pre-tessellated car model was provided by the manufacturer. The outsourcing studio elite3d entirely modeled and textured the Amalienborg Palace to a high standard, using software such as Maya (primarily for asset exports), 3ds Max (hard surface modeling), Zbrush (sculpting on top of scanned data provided by Domeble), as well as Substance tools (material creation and painting), and Marmoset Toolbag (baking). Finally, Unity’s Spotlight team created the lighting for the environment, applied all the materials to the hundreds of car parts, and ensured the quality of the visuals was optimal.
由制造商提供了极为详细的预镶嵌汽车模型。 外包工作室elite3d使用诸如Maya(主要用于资产出口),3ds Max(硬表面建模),Zbrush(在Domeble提供的扫描数据之上进行雕刻)之类的软件对Amalienborg Palace进行了完全建模并使其达到了高标准。以及物质工具(材料创建和绘画)和Marmoset工具袋(烘焙)。 最终,Unity的Spotlight团队创造了环境照明,将所有材料应用于数百个汽车零件,并确保视觉效果达到最佳质量。
Unlike many other automotive configurators, we did not use a static dome or a backplate for the environment: instead, the entire courtyard is modeled in 3D. The car can thus be placed wherever needed and the lighting and time of day can be changed at will. Indeed, one of the major drawbacks of static HDRIs, domes or backplates is that their lighting and perspective are fixed due to the way they are intrinsically captured: with a fixed perspective and lighting. For this reason, they offer little flexibility and impose very strong restrictions on the lighting, and the ability to move the subject and the camera away from the original capture point. As you can see in the following animation, a fully modeled environment is significantly more flexible.
与许多其他汽车配置器不同,我们没有为环境使用静态圆顶或背板:相反,整个庭院均以3D建模。 因此,可以将汽车放置在任何需要的地方,并且可以随意更改照明和时间。 确实,静态HDRI,圆顶或背板的主要缺点之一是,由于其固有的捕获方式,它们的照明和透视是固定的:具有固定的透视和照明。 因此,它们几乎没有灵活性,并且对照明施加了非常严格的限制,并且无法将被摄体和照相机移离原始拍摄点。 如下面的动画所示,完全建模的环境要灵活得多。
HDRP设置 (HDRP settings)
If you aren’t already familiar with the High Definition Render Pipeline, please have a look at the official documentation to get started. Pay attention particularly to the Volume Framework, the main way to control HDRP’s effects.
如果您还不熟悉High Definition Render Pipeline,请查看官方文档以开始使用。 特别注意Volume Framework ,它是控制HDRP效果的主要方法。
I also highly recommend you have a look at the HDRP Wizard under “Window > Rendering Pipeline”, because it can automatically fix incorrect settings in your HDRP project, notably the Color Space, as it can radically reduce the image quality if you were to use Gamma color space rather than Linear.
我也强烈建议您查看“窗口>渲染管道”下的“ HDRP向导”,因为它可以自动修复HDRP项目中的错误设置,尤其是“色彩空间”,因为如果您要使用它,它可以从根本上降低图像质量。伽玛色彩空间而不是线性。
Furthermore, using the settings detailed in this article will most likely result in poor framerate on any platforms but high-end PCs when dealing with such a demanding scene. Thus, in order to provide a comfortable working experience in Unity at 1440p or 4K resolution under 100 milliseconds per frame, a GeForce GTX 1080 TI or better is recommended.
此外,使用本文中详述的设置在处理这种苛刻的场景时,很可能会导致在除高端PC之外的任何平台上的帧速率较差。 因此,为了在每帧100毫秒内以1440p或4K分辨率在Unity中提供舒适的工作体验,建议使用GeForce GTX 1080 TI或更高版本。
渲染设置 (Rendering settings)
First of all, head to HDRP’s quality settings under “Edit > Project Settings > Quality” and enable the following settings:
首先,转到“编辑>项目设置>质量”下的HDRP的质量设置,并启用以下设置:
“R16G16B16A16”: The fp16 precision can reduce unwanted banding on light and fog gradients stretching over a large screen-space distance, for a performance cost, i.e. increased memory consumption and bandwidth. Additionally, I recommend you activate 8-bit Dithering in the Camera’s inspector to minimize banding further.
“ R16G16B16A16”:fp16精度可以减少在较大的屏幕空间距离上延伸的光和雾渐变上的不必要条纹,从而降低性能,即增加内存消耗和带宽。 此外,我建议您在相机的检查器中激活8位抖动,以进一步减少条带。
“Forward Only”: Forward rendering generally offers higher quality compared to Deferred rendering. Furthermore, at the time of writing this article, it is the only mode that offers a convenient way to quickly enable a finer shadow filtering technique that we will cover later in this article.
“仅向前”: 与“延迟”渲染相比, “向前”渲染通常提供更高的质量 。 此外,在撰写本文时,这是唯一一种提供快速便捷的方法来快速启用更好的阴影过滤技术的模式,我们将在本文后面介绍。
MSAA must also be manually enabled in the Frame Settings of every GameObject type able to render the scene, i.e. cameras and reflection probes. In the Default Frame Settings under “Edit > Project Settings > HDRP Default Settings”, toggle “MSAA within Forward” globally for cameras and the different types of reflections.
还必须在每种能够渲染场景的GameObject类型的“帧设置”中手动启用MSAA,例如摄像机和反射探测器。 在“编辑>项目设置> HDRP默认设置”下的“默认帧设置”中,针对摄像机和不同类型的反射全局切换“正向内的MSAA”。
MSAA for reflections is particularly important when dealing with highly reflective materials such as chrome and car paint: any visible aliasing will harm the photo-realism of the rendered frames. Furthermore, cameras and reflection probes can use their own custom Frame Settings in their respective inspectors: for example, you can decide to enable the use of MSAA for the Baked Reflection Probes, disable it for the real-time Reflections Probes to reduce performance impact, and rely on a faster type of anti-aliasing for the camera.
当处理诸如Chrome和汽车漆之类的高反射材料时,反射的MSAA尤其重要:任何可见的锯齿都将损害渲染帧的真实感。 此外,摄像头和反射探测器可以在各自的检查器中使用其自己的自定义帧设置:例如,您可以决定对烘焙反射探测器启用MSAA,对实时反射探测器禁用MSAA,以降低性能影响,并依靠更快 类型的相机消除锯齿 。
临时抗锯齿(TAA) (Temporal anti-aliasing (TAA))
TAA is particularly effective in dealing with cases where MSAA is unable to remove jaggies that are not related to geometric aliasing, such as lighting (specular), texture or transparency aliasing. TAA can in certain cases stand on its own as the only form of anti-aliasing for the camera, especially given its quality and its relatively low cost compared to MSAA 4x or 8x. Nevertheless, due to its temporal nature, i.e. the reliance on previous frames and motion vectors, TAA can introduce unwanted ghosting when dealing with fast-moving cameras or subjects, and can soften the image slightly. Thankfully, HDRP’s Cameras provide a TAA Sharpness control.
TAA在处理MSAA无法消除与几何混叠(例如照明(镜面),纹理或透明度混叠)无关的锯齿的情况下特别有效。 在某些情况下,TAA可以作为摄像机抗锯齿的唯一形式,特别是考虑到其质量以及与MSAA 4x或8x相比成本较低的原因。 然而,由于其时间性质,即对先前帧和运动矢量的依赖,TAA在处理快速移动的相机或对象时会引入不必要的重影,并会稍微柔化图像。 值得庆幸的是,HDRP的摄像机提供了TAA清晰度控制。
To force TAA in the Scene View as well, toggle the feature in “Edit > Preferences > HD Render Pipeline > Scene View Anti-Aliasing”, and then activate “Animated Materials” in the Scene View toolbar.
要同时在“场景视图”中强制TAA,请在“编辑>首选项> HD渲染管道>场景视图抗锯齿”中切换功能,然后在“场景视图”工具栏中激活“动画材质”。
纹理过滤 (Texture filtering)
Another very important parameter to consider is the filtering of the textures. The best possible filtering, i.e. Anisotropic Filtering, can be forced globally via “Project Settings > Quality > Anisotropic Textures”. This will ensure surfaces nearly parallel to the view direction, typically ground and road materials, remain sharp at medium range and beyond, for a negligible performance impact on modern high-end GPUs.
要考虑的另一个非常重要的参数是纹理的过滤。 可以通过“项目设置>质量>各向异性纹理”全局强制执行最佳过滤,即各向异性过滤。 这将确保几乎平行于视线方向的表面(通常是地面和道路材料)在中等范围及更高范围内保持清晰,对现代高端GPU的性能影响可忽略不计。
照明设置 (Lighting settings)
In HDRP’s quality settings, in the Lighting section, I suggest you enable the following options, either to maximize the quality of the lighting rendering or to facilitate your workflow.
建议在HDRP的质量设置的“照明”部分中,启用以下选项,以最大程度地提高照明渲染的质量或简化工作流程。
轻薄层 (Light layers)
The Light Layers allow you to control which lights and reflection probes affect certain objects in your scene. In other words, they can radically simplify the setup when selectively applying lighting and reflections to the parts of a model. For instance, I can use them to get a correct level of reflections on the wheels and under the arches of the vehicle while preventing the main bodywork from receiving unwanted dark reflections, by following these steps:
在 光层 允许你控制哪些灯和反射探头影响场景中的特定对象。 换句话说,当对模型的各个部分选择性地应用照明和反射时,它们可以从根本上简化设置。 例如,通过执行以下步骤,我可以使用它们在车轮和车辆拱门下获得正确的反射水平,同时防止主体收到不必要的深色反射:
Place a Reflection Probe under each inner fender and tune its influence volume
在每个内部护舷板下方放置一个“反射探针”,并调节其影响力
Assign these 4 probes to “Light Layer 1”, in the probes’ inspector.
在探针的检查器中将这四个探针分配给“ Light Layer 1”。
Add the “Light Layer 1” to the list of Rendering Layers that can affect the wheels and inner fenders
将“ Light Layer 1”添加到可能影响车轮和内部挡泥板的渲染层列表中
Result: the wheels and inner fenders receive correct, darker, reflections, while the main bodywork remains unaffected and correctly lit by another external reflection probe.
结果:车轮和内部挡泥板接收到正确的,更暗的反射,而车身仍未受到其他外部反射探测器的影响并正确点亮。
I use this workflow for many other parts of the car to:
我将此工作流程用于汽车的其他许多部分,以:
Prevent the interior Lights and Reflection Probes from leaking on the exterior bodywork, and vice versa
防止内部的灯光和反射探针泄漏到外部车身上,反之亦然
Restrict the Planar Reflection Probes to the mirrors geometries
将平面反射探针限制为反射镜的几何形状
Produce believable reflections for the headlight and taillights reflectors and lamp casings, without affecting the bodywork
在不影响车身的情况下,为前灯和尾灯反射器和灯罩产生可信的反射
Assign Reflection Probes to certain iconic chrome parts, such as the front grill
将反射探头分配给某些标志性镀Chrome部件,例如前格栅
No more (or at least less) fiddling with the bounds and Blend Distances of Reflection Probes when trying to encompass complex shapes! The only minor drawback is that your model has to be separated into several GameObjects to take advantage of this feature.
尝试包含复杂形状时,不再(或至少更少)摆弄反射探针的边界和混合距离! 唯一的次要缺点是必须将模型分成多个GameObject,才能利用此功能。
阴影过滤 (Shadow filtering)
Another critical parameter to achieve near-photorealism is the quality of the shadows and the simulation of the penumbra; thankfully, HDRP excels in this area. In HDRP’s quality settings, enable “High” Filtering Quality and increase the maximum shadow resolution to fit your requirements for the different types of light you want to use: Directional, Punctual (Point and Spot), and Area lights.
实现接近照片级逼真的另一个关键参数是阴影的质量和半影的模拟。 值得庆幸的是,HDRP在这一领域表现出色。 在HDRP的质量设置中,启用“高” 滤镜质量 并增加最大阴影分辨率,以适合您要使用的不同类型的光的要求:定向,点状(点和点)和区域光。
There is a common misconception in real-time graphics where sharper shadows are often wrongly associated with higher quality, because higher resolution shadowmaps produce relatively sharper shadows when no additional blurring is applied. However, in reality, the further a shadow extends from its shadow caster, the blurrier the shadow. Generally, shadows are a lot softer than anticipated by most. HDRP is able to simulate shadow blurriness to a high degree of fidelity: distant shadows are highly blurred, whereas shadows close to their source remain sharp.
在实时图形中存在一个普遍的误解,即锐利的阴影通常会与更高的质量错误地关联,因为在不应用其他模糊处理时,高分辨率的阴影贴图会产生相对锐利的阴影。 但是,实际上,阴影从其阴影投射器延伸的越远,阴影就越模糊。 通常,阴影要比大多数人预期的要柔和得多。 HDRP能够高度逼真地模拟阴影模糊:远处的阴影高度模糊,而靠近其源的阴影保持清晰。
In the example below, see how the central Equestrian Statue appears realistically blurred on the facade of the Palace as the shadow of the statue travels over a long distance. Meanwhile, the shadow originating from the car remains fairly sharp, yet gradually becomes blurrier as the distance from the car increases.
在下面的示例中,查看中央马术雕像如何在宫殿的外墙上真实地模糊,因为雕像的阴影在远处传播。 同时,源自汽车的阴影仍然相当清晰,但是随着与汽车距离的增加,阴影逐渐变得模糊。
The quality of the filtering is controlled in the Shadow section of the Light inspector. Furthermore, HDRP allows you to simulate larger emissive Shapes, thanks to the Angular Diameter (Directional Light), or the Radius (Point & Spot Light). These controls affect both the softness of the shadows and specular highlights in a physically-based fashion: the larger the emissive source, the softer its shadows and specular highlights.
过滤的质量在“灯光”检查器的“阴影”部分中控制。 此外, 由于角直径(方向光)或半径(点和点光) ,HDRP允许您模拟较大的发射 形状 。 这些控件以基于物理的方式影响阴影和镜面反射高光的柔和度:发射源越大,其阴影和镜面反射高光越柔和。
If you notice stepping artifacts (shadow acne), increase the Slope-Scale Depth Bias: more bias will be applied to polygons facing away from the Light. Thus, unwanted shadows will visibly “sink” under their surface. Pushing the Near Plane and reducing the Range of the Light can also offer more shadowing precision, although it is not always a practical solution.
如果您发现台阶状瑕疵(阴影粉刺),请增加“ 坡度缩放深度偏差” :将更多的偏差应用于背离光源的多边形。 因此,不需要的阴影将在其表面下明显“下沉”。 尽管并非总是可行的解决方案,但推动近平面并减小光的范围也可以提供更高的阴影精确度。
接触阴影 (Contact shadows)
Contact shadows are particularly effective at fixing the lack of resolution in the distant cascades of the directional shadowmap. They can dramatically improve the quality of the self-shadowing for micro geometric details at any distance from the camera, for both Directional and Punctual Lights. The facades of the Palace noticeably benefit from this feature: fine ornaments, ledges, sentry boxes and windows cast believable shadows.
接触阴影 在解决定向 阴影图 的遥远级联中缺乏分辨率方面特别有效。 对于定向光和准时光,它们可以在距相机任何距离的地方显着提高微几何细节自阴影化的质量。 宫殿的外墙明显受益于此功能:精美的装饰品,壁架,岗亭和窗户投射出令人难以置信的阴影。
However, like any screenspace technique, offscreen geometries, transparent materials, and objects hidden behind other opaque objects will not produce any contact shadows, as those objects do not appear in the screen-space depth buffer. This can result in “holes” in the contact shadows, as well as a lack of shadowing on the very edge of the frame. In any case, the image quality boost provided by this effect, especially at medium and long-range, usually alleviates those drawbacks.
但是,像任何屏幕空间技术一样,屏幕外的几何形状,透明材质以及隐藏在其他不透明对象后面的对象将不会产生任何接触阴影,因为这些对象不会出现在屏幕空间深度缓冲区中。 这会导致接触阴影中的“Kong”,以及框架的边缘上没有阴影。 在任何情况下,由这种效果提供的图像质量提升(尤其是在中距离和远距离时)通常可以缓解这些缺陷。
照明设置 (Lighting setup)
First of all, I highly recommend you activate ACES tonemapping to ensure a filmic light response from the get-go. Obviously, you may still color grade the final image at a later stage, preferably after your lighting pass, with some of these Volume Overrides:
首先,我强烈建议您激活 ACES色调映射, 以确保一 开始 就产生电影 般的 光响应。 显然,您仍然可以在以后的阶段(最好是在照明通过之后)对最终图像进行颜色分级,其中包括以下一些“音量替代”:
The later is especially important when using physically-based color temperatures for the sun, moon and artificial lighting, to reproduce the color adaptation in the human brain, or the automatic or manual white balance of a camera. For example, uncorrected images with incandescent lighting around 3000 Kelvin will have a very strong orange hue. White balance can also be used artistically in many situations; nonetheless, color reproduction in high-end visualizations must be taken very seriously, especially when it comes to car paints.
当将基于物理的色温用于太阳,月亮和人造照明时,后者在重现人脑的色彩适应性或相机的自动或手动白平衡时尤其重要。 例如,白炽灯照明在3000开尔文附近的未校正图像将具有非常强烈的橙色调。 白平衡还可以在许多情况下在艺术上使用。 但是,必须非常重视高端可视化中的颜色复制,尤其是在涉及汽车涂料时。
环境照明 (Environment lighting)
Due to the dynamic nature of the demo, with the ability to change the time of day as well as the position of the car, a single overcast bake (Indirect Only) was set up, using an overcast HDRI sky with a multiplier of 10 000 lux. This provided a sufficient amount of occlusion in the concave parts of the Amalienborg environment.
由于演示的动态性质,具有更改一天中的时间以及汽车位置的能力,因此使用了多云的HDRI天空(乘数为10000),设置了一个多云的烘烤(仅间接)。勒克斯 这在阿美琳堡环境的凹陷部分提供了足够的遮挡。
Thereafter, I set up an Indirect Light Controller to modulate the intensity of the baked indirect lighting at ease, especially for low light conditions. This allows me to create a fully physically-based lighting setup, with the Directional Light Intensity ranging from under 1 lux (moonlight) to 100 000 lux (intense sunlight).
此后,我设置了一个 间接光控制器 来轻松调节烘焙的间接光的强度,尤其是在弱光条件下。 这使我可以创建一个完全基于物理的照明设置,其定向光强度范围从1勒克斯(月光)到10万勒克斯(强烈日光)。
Finally, Volumetric Fog is added to provide a better sense of depth: every light in the environment can interact with the fog and generate gorgeous volumetric effects, such as crepuscular rays. The street lamps rely on the cookie baking technique I detailed in my previous Unity Expert Guide, to ensure flawless self-shadowing for emissive sources.
最后, 添加了 体积雾 ,以提供更好的深度感:环境中的每个光线都可以与雾交互并产生华丽的体积效果,例如缝隙光线。 路灯依靠我在 之前的《 Unity Expert Guide》中 详细介绍的cookie烘烤技术 ,以确保发射源的完美自阴影。
Thanks to the versatility of Unity’s GPU Progressive Lightmapper (PLM) and the recent addition of machine-learning denoising techniques from Nvidia and Intel, the entire courtyard can be baked under 30 seconds with a GeForce RTX 2080 TI. The following settings are sufficient to create a soft sky-occlusion bake for the entire courtyard:
由于Unity的 GPU渐进式光照贴图器 (PLM) 的多功能性以及 Nvidia和Intel最近增加的机器学习去噪技术,使用GeForce RTX 2080 TI可以在30秒内烘烤整个庭院。 以下设置足以为整个庭院创建柔和的天空遮盖烘烤:
Resolution of 5 texels per meter
每米5像素的分辨率
2 bounces
2次弹跳
No Ambient Occlusion
无环境遮挡
Nvidia Optix AI-Accelerated Denoiser
Nvidia Optix AI加速去噪器
环境光遮蔽 (Ambient occlusion)
Another important effect is Ambient Occlusion (AO), either using a screen-space or a ray-tracing technique: it simulates the micro-occlusion occurring in concave parts of the scene. If you did not bake the AO offline with an external solution, these two real-time techniques can greatly refine the ambient lighting quality, especially in the interior of the car, and they can be particularly effective at reducing reflection leaking. Be aware that using unnecessarily strong Intensities can produce a cartoony look, due to the increased local contrast and haloing effect.
另一个重要的效果是使用 屏幕空间 或 光线跟踪 技术的 环境光遮挡(AO) :它模拟场景凹面部分中发生的微光遮挡。 如果不使用外部解决方案将AO脱机烘烤,则这两种实时技术可以极大地改善环境照明质量,尤其是在汽车内部,并且在减少反射泄漏方面特别有效。 请注意,由于增加的局部对比度和光晕效果,使用不必要的强强度可能会产生卡通外观。
If you rely on the real-time screen-space Ambient Occlusion, handling the darkening under the car still requires a dedicated shadow plane to ensure optimal results, because the former cannot ensure satisfactory results at close range when parts of the undercarriage are offscreen. The occlusion can be baked using a DCC package. The resulting texture can then be applied in Unity using two different methods:
如果您依赖实时屏幕空间环境光遮挡,则在汽车下方处理变暗仍然需要专用的阴影平面以确保最佳效果,因为当部分底盘不在屏幕上时,前者无法确保近距离的令人满意的结果。 可以使用DCC包装烘烤咬合。 然后可以使用两种不同的方法在Unity中应用生成的纹理:
A plane using an HDRP Unlit shader
使用HDRP Unlit着色器的平面
A Decal Projector using an HDRP Decal shader
使用HDRP贴图着色器的贴图投影仪
The obvious advantage of a decal is that it will be correctly projected onto uneven grounds, even when using advanced techniques such as displacement mapping which offsets pixels downwards; whereas an unlit plane might appear as floating when pixel-peeping. Setting up a Reflection Probe underneath the car will also prevent potential unwanted reflection leaking onto the road surface and the undercarriage.
贴花纸的明显优点是,即使使用诸如向下偏移像素的位移映射之类的先进技术,它也可以正确地投影到不平坦的地面上。 而未照明平面在窥视像素时可能看起来像是漂浮的。 在汽车下方安装反射探头也可以防止潜在的有害反射泄漏到路面和底盘系统上。
相机设定 (Camera setup)
HDRP’s Physical Camera controls simulate many key characteristics of a lens with the following parameters, among others:
HDRP的“ 物理摄像头” 控件使用以下参数来模拟镜头的许多关键特性,其中包括:
Focal Length
焦距
Aperture
光圈
Sensitivity (ISO)
感光度(ISO)
Shutter Speed
快门速度
Blade Count
叶片数
Anamorphism
变形
Barrel distortion
桶变形
These properties can affect both the Depth of Field (DoF) and the Exposure if you so choose. One of the advantages of HDRP is that you can easily decouple the Exposure from the Physical Camera settings, and you can, therefore, have more freedom when it comes to lighting and Exposure, while still maintaining a believable DoF.
如果您选择这些属性,则可能会影响景深(DoF)和曝光。 HDRP的优点之一是,您可以轻松地将“曝光”与“物理相机”设置分离开,因此,在照明和曝光方面,您可以拥有更大的自由度,同时仍然保持可信的DoF。
HDRP also provides a Manual Focus mode for the DoF using non-physically-based Near and Far Blur distances. Nevertheless, I highly recommend using the Physical Camera mode instead and mimicking real-world automotive photography. In doubt, sticking to traditional cinematographic conventions and shot composition will avoid raising eyebrows. For instance, the use of an ultra-wide lens should be restricted to very specific scenarios, such as action shots, because they tend to introduce unwanted perspective distortions when shooting a subject at close range. And an unnecessarily shallow Depth of Field can negatively impact the sense of scale and look unrealistic, or video-gamey. Additionally, you can link the Camera’s Field of View to its Focal Length and prevent unrealistic DoF scenarios caused by using both a very wide field of view and a very high focal length simultaneously, knowing that those 2 parameters are inversely proportional.
HDRP还使用非基于物理的近距和远距模糊距离为DoF提供了手动聚焦模式。 但是,我强烈建议改用“物理相机”模式,并模拟现实世界中的汽车摄影。 毫无疑问,坚持传统的摄影惯例和镜头构图将避免引起人们的注意。 例如,应该将超广角镜头的使用限制在非常特殊的场景中,例如动作拍摄,因为在近距离拍摄对象时,它们会导致不必要的透视失真。 不必要的浅景深可能会对比例感产生负面影响,并且看起来不真实,或具有视频游戏性。 此外,您可以 将相机的视场与其焦距链接起来, 并防止由于同时使用非常宽的视场和非常高的焦距而导致的不切实际的DoF场景,这两个参数是成反比的。
There are many more camera effects available in HDRP: the new physically-based Bloom and the Panini Projection deserve an honorable mention. As always, all these effects require subtlety and artistic taste, especially when simulating generally unwanted lens defects, such as Lens Distortion, Chromatic Aberration, and Vignette.
HDRP提供了更多的相机效果: 值得一提的 是新的基于物理的 Bloom 和 Panini Projection 。 与往常一样,所有这些效果都需要微妙和艺术气息,尤其是在模拟通常不希望有的镜头缺陷(例如 镜头畸变 , 色差 和 小插图)时 。
There is no doubt these camera features can take time to digest if you are not familiar with the Art of Photography. Nonetheless, learning about the technical aspects of cameras and cinematography will enable you to create better visuals and more interesting compositions. Even if you don’t have an artistic mindset, you will be able at least to replicate the look of existing marketing materials more easily.
毫无疑问,如果您不熟悉摄影艺术,这些相机功能可能会花费一些时间。 尽管如此,了解相机和摄影技术的知识将使您能够创建更好的视觉效果和更有趣的构图。 即使您没有艺术思维,也至少能够更轻松地复制现有营销材料的外观。
透明度 (Transparency)
One of the areas where real-time 3D struggles particularly is the correct rendition of transparencies, because such materials are usually treated in a different shading pass and rarely carry their own depth information. This means sorting transparent surfaces can be tricky, and transparent pixels typically inherit the depth of opaque objects located behind them. This obviously becomes troublesome when combined with Depth of Field, as the transparent objects that should normally be in focus become as blurry as the defocused background.
实时3D尤其困难的领域之一是对透明胶片的正确再现,因为此类材料通常在不同的阴影通道中处理,并且很少携带自己的深度信息。 这意味着对透明表面进行排序可能很棘手,并且透明像素通常会继承位于它们后面的不透明对象的深度。 当与景深结合使用时,这显然变得很麻烦,因为通常应聚焦的透明对象变得像散焦背景一样模糊。
Thankfully, HDRP has a few tricks up its sleeve: in the inspector of a material (for the HDRP Lit shader), you can toggle several Surface Options, such as “Render Back then Front” to prevent common sorting artifacts, and “Transparent Depth Postpass” to avoid graphical bugs related to post-processing effects. Unity even allows you to manually sort objects!
值得庆幸的是,HDRP有一些技巧:在材质检查器(用于HDRP Lit着色器)中,您可以切换多个“ 曲面选项” ,例如“先渲染后再渲染”以防止常见的排序瑕疵和“透明深度”。后传递”,以避免与后处理效果相关的图形错误。 Unity甚至允许您 手动排序对象 !
The following worst-case scenario features a shallow depth of field with several layers of glass in the taillights and headlights. Without Transparent Depth Postpass, parts of these lamps inherit the depth of the building and pavement, and therefore, they receive a similar level of blurriness as these background objects. As the blur is very strong, parts of the glass materials nearly disappear into the background. Thankfully, the Transparent Depth Postpass or the more radical Write Depth can solve this issue.
以下最坏的情况是景深较浅,尾灯和前灯中有几层玻璃。 如果没有“透明深度后传递”,则这些灯的某些部分会继承建筑物和人行道的深度,因此,它们收到的模糊程度与这些背景对象相似。 由于模糊非常强烈,部分玻璃材料几乎消失在背景中。 幸运的是,透明深度后传递或更彻底的写入深度可以解决此问题。
Nevertheless, one nontrivial rendering problem persists: the building and the pavement, seen through the taillight and headlight respectively, will remain in perfect focus, although they clearly belong to the background and thus should be blurred as such. Sadly, there is no elegant solution to this problem in the realm of game engines, and this issue isn’t limited to Unity only: this is one of the limitations of any rendering pipeline that relies on a single depth buffer.
尽管如此,仍然存在一个重要的渲染问题:分别通过尾灯和前灯观察的建筑物和人行道将保持完美的焦点,尽管它们显然属于背景,因此应如此模糊。 令人遗憾的是,在游戏引擎领域中,还没有完美的解决方案来解决这个问题,并且这个问题不仅限于Unity:这是任何依赖单一深度缓冲区的渲染管道的局限性之一。
最后的话 (Final words)
HDRP is a very flexible rendering pipeline, able to scale from mainstream consoles to very high-end workstations. However, this flexibility comes at the price of a daunting number of rendering features to toggle and parameters to tune, in order to satisfy your project’s requirements. Hopefully, after reading my expert guide, you should have a better understanding of the capabilities of HDRP for your high-end visualizations, and the setup required to dramatically raise their visual quality for Automotive, AEC, Film, and even next-generation games.
HDRP是一个非常灵活的渲染管道,能够从主流控制台扩展到非常高端的工作站。 但是,要满足项目的需求,这种灵活性的代价是要切换许多渲染功能以及调整参数。 希望在阅读我的专家指南后,您应该对HDRP的高端可视化功能有更好的了解,并需要极大地提高HDRP在 Automotive , AEC , Film 甚至下一代游戏中 的视觉质量所需的设置 。
Finally, thanks to the ongoing improvements to HDRP’s Ray-Tracing feature set, the gap between real-time and offline rendering is progressively narrowing: many traditional screen-space and image-based techniques might soon be a thing of the past, at least for high-end real-time applications. Nevertheless, there is no doubt these “antique” techniques, when pushed to their limits, can still easily fool the main target of these visualizations, i.e. the average consumer.
最后,由于对HDRP的“ 光线追踪” 功能集 的不断改进, 实时和脱机渲染之间的差距正在逐渐缩小:许多传统的屏幕空间和基于图像的技术可能很快就会过去,至少对于高端实时应用。 然而,毫无疑问,这些“古董”技术一旦推向极限,仍然可以轻易地愚弄这些可视化的主要目标,即普通消费者。
unity 可视化渲染管线