Ray Tracing in Unity with HDRP

In this webinar originally created for NVIDIA, I demonstrate how to use the ray tracing effects provided by Unity’s High Definition Render Pipeline (HDRP). I showcase in detail ray-traced ambient occlusion, reflections, global illumination, shadows, and path tracing.

I also explain how to use the various debug views to isolate these effects and offer recommendations to ensure a suitable frame rate for a wide variety of use cases, from games to high-end visualizations.

Ray Traced Ambient Occlusion (RTAO)

The screen-space ambient occlusion (SSAO) has been a staple of real-time rendering for games for more than a decade. It is used to simulate the environment’s diffuse occlusion, in order to improve visual contact between objects in the world and darken the lighting in concave areas. However, this effect, when pushed too far, can produce halos around geometries, and even a cartoony look. On top of it, one of the main drawbacks of this screen-space technique is its inability to generate occlusion from objects which reside outside the frame, as it only relies on the depth information available in the z-buffer. On the plus side, this effect is still great at handling micro occlusion of small areas in the camera’s perspective, for a relatively low-performance cost.

Hopefully, thanks to Ray Tracing, rays can be shot at surfaces beyond the camera frustum, and therefore they are able to reach objects located outside the frame. This way, you can get great macro occlusion from large objects located all around the camera. Although technically AO is only a rough approximation of environment lighting, it can complement other lighting techniques such as lightmaps or lightprobes, whose resolution or density is limited and therefore unable to capture micro occlusion.

Ray Traced Reflections (RTR)

In a similar fashion to SSAO, screen-space reflections (SSR) can only reflect objects located in the frame: again, surfaces that aren’t immediately visible to the camera cannot be reflected. For instance, looking at the floor will result in the SSR technique being unable to provide any useful information. Therefore, SSR is very approximative, and this technique tends to have many detractors, including yours truly, as a good placement of static Reflection Probes can often provide more appealing and less distracting results for most static scenarios. However, one area where SSR shines literally is when dealing with planar reflections for surfaces parallel to the view direction, such as floors, walls, and ceilings. An optimal use-case for SSR would be a camera whose pitch is locked, such as in a racing game.

With Ray Tracing, however, we are able to get access to information that resides outside the screen, and as a consequence, we can offer a more exact reflection of the world, at least within a certain radius around the camera, defined by the Light Cluster and the length of the rays.

Ray Traced Global Illumination (RTGI)

One of the most impressive features of Ray Tracing is the ability to generate real-time global illumination, that is the simulation of indirect lighting, or simply put, the lighting bouncing in the environment.

Typically in game engines, the indirect lighting is handled with pre-computed or baking techniques, such as light probes or lightmaps, and they can greatly slow down the iteration time of artists and designers dealing with the lighting.

Thankfully, HDRP offers 2 techniques for RTGI: a Performance and a Quality one. The former is geared towards high frame rate scenarios in direct light, whereas the second one can provide very accurate results in more complex interiors thanks to multiple bounces and samples, for a very high computational cost nonetheless.

Ray-traced Shadows

Out of the box, when using the High shadow filtering quality (PCSS), HDRP provides great looking shadow maps that simulate the natural smoothness of shadows, while ensuring they remain sharp near the shadow casters, like in real life. However, when using the cheaper Medium filtering quality, results can be underwhelming, as the entire shadow map is filtered uniformly, regardless of the distances between casters and receivers.

Results can be improved dramatically with Ray Traced shadows, by shooting rays from surfaces towards the lights to figure out the amount of occlusion between them. This can therefore provide an extremely realistic approximation of the shadowing, for a moderate performance cost. In addition, HDRP supports transparent shadows!

HDRP Template for Unity

I was a leading force behind the new scene template for the High Definition Render Pipeline, from early requirements, to final delivery. It features most key features found in HDRP, from the volume system, to the physically based lighting and exposure. Furthermore, I solely created the following trailer.

The new template is set up in a physically based way, with a realistic sun intensity at 100,000 lux and correct exposures for each location. Beginners now have a good setup to start lighting their scenes, and they can experiment confidently with this template, knowing that the lighting is already correctly tuned. 

To help users understand how the lighting is set up, I prepared a cheat sheet with important values, with color temperatures and intensities of common light sources, as well as exposure values of typical scenes.

Learn more about the making of this project by reading my official blog post.

Welcome to my Portfolio

I am an experienced lighting artist with over a decade of AAA experience in the field of real-time rendering. I have a strong technical and artistic background and I specialize in lighting, level beautification, UX, tools design, and workflow improvements.

crysis1_boxart crysis2_boxart crysis3_boxart ryse_boxart gtav_boxart rdr2_cover

I have worked on award-winning games and large AAA productions, such as the Crysis series, Ryse: Son of RomeGrand Theft Auto V and Red Dead Redemption 2. Therefore, I have a great understanding of the art, lighting and tools requirements for many types of projects, from highly scripted cinematic experiences to large-scale open worlds, as well as competitive multiplayer games.

unity_logo.png

I work currently for Unity Technologies, as Technical Art Manager in the R&D Graphics team, where I lead fellow technical artists whose mission is to improve artists’ efficiency, develop new tools, workflows and graphical features alongside engineers and designers, and educate users globally.

For more information, please see my detailed resume or contact me on LinkedIn. You can discover my lighting work in the next pages or directly visit my Best Of section.