The High Definition Render Pipeline: Focused on visual quality
In a recent blog post, we introduced the concept of Scriptable Render Pipelines. In short, SRP allows developers to control how Unity renders a frame in C#. We will release two built-in render pipelines with Unity 2018.1: the Lightweight Pipeline and High Definition Render Pipeline. In this article, we’re going to focus on the High Definition Render Pipeline or HDRP.
HDRP aims to provide developers with tools to achieve high definition visuals.
Its design follows three principles:
- Physically based rendering
- Unified and coherent lighting
- Features independent of the rendering path
Physically based rendering relies on three pillars: Lighting, Material, and Camera. Lighting and material rely on physical interaction and there should be a clear decoupling between them to get a coherent result under various lighting conditions. The camera interprets how the resulting lighting will be displayed on the screen. The goal is to make it easier for the artists to achieve a plausible result.
Unified lighting means that all objects and participating media in the scene should receive the same lighting. There shouldn’t be any distinction between opaque, transparent or volumetric materials. Coherent lighting means that a material must interact correctly with the lighting produced by any light sources (reflection probe, area lights…), even when modified by a Decal for example. This results in a more coherent look.
There are various rendering passes used in real-time rendering: Deferred/Forward, SinglePass/Multipass, Tile/Cluster… It is common in game development that the selection of a rendering path limits the set of graphics features. For HDRP we have tried to get the same set of graphics features whatever the rendering path. The result is that the choice of a rendering path is solely based on performance and not on which features are required for a game.
During the development of HDRP, we have followed this principle as closely as possible.
Who is it for?
The HDRP targets high-end PCs and consoles and prioritizes stunning, high definition visuals. We wanted to bring AAA graphics features in the hands of smaller teams. It assumes at least a DX11 level features set and makes heavy use of compute shaders. The tradeoff here is that the HDRP will not work on less powerful platforms. The target supported APIs are D3D11, D3D12, GNM (PlayStation 4), Metal and Vulkan. VR support is planned, but not implemented in the currently available preview.
Moreover, HDRP comes with a full new set of features and behaviors and there will be learning and re-tooling required. We’re providing a conversion tool to upgrade a project from Built-in Unity to HDRP, but it only helps you to quickly re-setup materials and textures. All the lighting, all the post-processing, scene settings, graphics settings and custom shaders will need to be re-worked.
Lastly, HDRP is in Preview state, which means that it’s currently not suitable for production.
HDRP comes with a new lighting architecture: It uses a hybrid Deferred / Forward — Tile / Cluster renderer. These words mean that it scales way better than built-in Unity rendering with the number of lights in the scene. This new lighting architecture is focused on performance.
Additionally, HDRP comes with various additional light properties and a new light editor: It is possible to fade the light, affect only diffuse or specular lighting or use color temperature to set up the color of the light. Spotlights have now control on inner angles and can have different shapes (cone, box or pyramid). Colored cookies are supported.
HDRP allows the use of real-time area lights (no shadow or baking currently), like rectangle light.
Finally, the light follows physical inverse square attenuation and uses physical light Unit. The lighting and the control of the light are fully linear, there is no Built-in Unity ‘Gamma mode’ anymore. The Sun Light intensity is defined in term of lux at the ground level and point and spot are defined in Lumen.
On image based lighting side, reflection probes get a big upgrade in HDRP. It is now possible to use oriented bounding box or sphere shape, the proxy shape (area approximating the scene geometry) and influence shape (an area where pixels are affected) are separated, there is various influence fading option (per face, based on normal orientation…).
HDRP has its own version of the Standard Shader called Lit Shader. The Lit Shader comes with a good amount of features and allows richer material than what is possible with Built-in Unity rendering. A double-sided option is available and connected to Global Illumination automatically and various mapping options are now possible like planar and tri-planar. Advanced effects like parallax occlusion mapping or tessellation are now available in one click!
But the strongest addition to material rendering is its lighting model.
HDRP uses the following BRDF: Isotropic multi scattering GGX for specular Layer and Disney Diffuse for diffuse Layer. The difference with Built-in Unity is the multi-scattering part.
Gold metallic ball going from Smooth (Left) to Rough (right):
The default parametrization is Metallic/Smoothness, but it is possible to switch to SpecularColor/Smoothness within the same shader.
HDRP allows us to enhance or replace this initial model. Various options are available to:
- Replace isotropic GGX by anisotropic GGX
- Add subsurface scattering to Disney Diffuse
- Add transmission
- Add iridescence effect
- Add a clear coat GGX
This variation of the lighting model helps us achieve various complex looks.
HDRP also allows a new set of options for transparent materials, like backface then front face rendering to help sorting, Depth post pass to help with depth of field effect on transparent and more.
Base on the Lit shader, HDRP provides a Layered Lit shader allowing to mix various Lit shaders together. Read this full blog post to get more information on Layered Lit.
Another addition to HDRP is Decal support. Decals are supported on both opaque and transparent material (and are still in development) and correctly affect the sampling of Global Illumination (lightmap/light probe).
The most important feature added to HDRP is its debugging tool. Debugging is extremely important to understand data authoring and performance problems.
HDRP comes with a new customizable debug window that allows to control debug view mode and render pipeline settings. This debug window can be used both in the Unity Editor or in any Player. Yes, it is now possible to have all the debug functionality on any of the target devices like PlayStation 4.
The debug windows allow to display any material properties for both opaque and transparent materials, either with deferred or forward render path.
It allows lighting debug view: Diffuse lighting only, Specular lighting only. It also allows you to override properties for the whole scene like normal, albedo, smoothness. It can display intermediate render targets like motion vector, depth buffer. It can highlight properties like objects using lightmap or tessellation, having a NaN checker and many more.
One interesting mode is also a color picker mode to read the current on-screen value or HDR value before postprocessing is applied.
The debug window can easily be extended to support any debug tool that your game may request like AI or Animation debugging tool.
HDRP comes with a new behavior that is different from Built-in Unity rendering pipeline.
Deferred and rendering path support the same set of features. Subsurface scattering, Screen space ambient occlusion, Decals work the same for both paths. There is no need to choose a specific rendering path for using a particular feature.
HDRP uses camera relative rendering. This means that there is a good rendering precision even far away from the origin of the world. This has an impact on all the shaders used with HDRP.
Your camera can control which lighting architecture is used (It is possible to mix deferred and forward renderer path in a scene) and which features are enabled for this rendering. It is possible to disable fog, shadow, post-processing etc.
To setup scene settings, there is a whole new system based on volume settings similar to what is available for post processing. The scene settings (Sky, Sunlight cascade shadow, Screen space shadow contact etc…) can now be set per volume and the parameters can be interpolated to have a smooth transition between volume.
There is also a new option available for Sky and Fog, like height based fog or fog tinted by the sky color. And the fog affects both opaque and transparent materials.
Lastly, HDRP uses a dedicated render target allocation system that avoids recurrent reallocation when resizing the screen. This avoids extra render target allocation when doing dynamic resolution for example.
We are still working on HDRP, so several of its features are in progress, buggy or incomplete. It will be released as Preview with 2018.1 and it’s not ready for production.
One of the current important limitations is that HDRP isn’t compatible with Lit Particles authored with Unity’s particle system, only Unlit Particles are compatible.
Also, the built-in terrain system has various artifacts.
As for all SRP, anything previously rendered in the Overlay layer like lens flares on light isn’t supported. Grabpass doesn’t exist anymore.
Our team currently focuses on stabilization and platform support. But there are still shiny features to come like volumetric lighting.
Area lights will be improved based on the research of Unity Labs team.
Physically based camera is also the next step to get more coherent lighting and postprocessing.
We also have several prototypes of character rendering tools in the works.
HDRP is coming with a fully new render pipeline for Unity that tries to push visual quality as far as possible for the current generation of games.
The downside is that there is quite a learning curve because there are significant differences from the current Built-In rendering pipeline.
All these features come with complexity. Unified and coherent lighting is extremely hard to achieve, having great debugging tools can be intrusive, relying on camera relative requires more thinking.. Writing custom shaders for HDRP is possible, but it now requires way more knowledge. But the benefit is worth it!
Join the Unity beta program to get early access to new features. You can also follow the development of HDRP on GitHub. We’re looking forward to talking to you about HDRP on the Graphics Experimental Previews section of the Unity Forums!