Simulation / Modeling / Design

Getting Started with Real-Time Ray Tracing and DLSS in Unreal Engine 4

The RTX Developer User Guide is a living knowledge document that details all the latest improvements and optimizations to ray tracing in Unreal Engine 4 (UE4).

Figure 1. Reflection, refraction and translucency in a ray traced setting. Note the soft shadows and ambient skylighting ALT beveled cubes reflecting light and being translucent with a sun light casting soft penumbra shadows

We maintain several branches of UE4, which includes a DLSS 2.0 branch with all current RTX improvements.  Our optimizations can improve ray tracing performance by up to 30%, and DLSS can double your frame rate over that. The capability for dramatically improved performance is there, and we are constantly working to take that further. Learn more about DLSS here

Beyond improved performance, there are also new features for ray tracing.  In this post,  I highlight the following features so that you have a sense of what’s there:

  • Hybrid translucency. This is a form of translucency that uses ray tracing for some aspects of rendering, and raster for other aspects. While it doesn’t support ray tracing translucent refraction, it is faster and more compatible than raster translucency. Bottom line:  It provides you with another way to do translucent effects in a ray tracing setting while keeping quality and performance high.
  • Support for light functions and light channel masking in ray tracing reflections.  Ray tracing reflections are a significant effect. These improvements mean that your light functions and channel masks appear in reflections correctly.

You need Git access, but then access to the code is yours.

Figure 2. The NVIDIA RTX DLSS branch can dramatically improve ray tracing performance and quality ALT photoreal forest scene using DLSS 2.0 to achieve high framerates

Some of these features may go into the Epic main release at some point in the future. For now, they’re available to you. 

Getting the RTX DLSS branch involves pulling code and compiling it from Git. We’ve included instructions  for developers without much coding experience or those who have artist-driven Blueprint projects.  If you’re used to doing your own code integrations, getting on the branch is straightforward.

Understanding how RTX-Dev can help your game

The RTX-Dev branches help your game in the following ways:

  • Improved performance
  • Enhanced content compatibility
  • Enhanced scalability

Improved performance 

This is obviously an important win for using RTX-Dev improvements in your game. The gains can vary dramatically based on your content and features. These gains change over time as new UE4 releases make improvements, sometimes by integrating pull requests originating in the RTX-Dev branches. 

Content using ray-traced translucency benefits substantially from the stencil masking support to cull unnecessary rays. Translucency content can also gain from hybrid translucency by ignoring particles in ray tracing. With RTX-4.24, some of the largest gains can be observed from improved software efficiency. We have measured over 20% improvement in frame rate tied to improved software efficiency in a real ray-tracing game.

Enhanced content compatibility

In the arena of content compatibility, hybrid translucency stands out as allowing content developed on legacy pipelines to function correctly. The ability to mix ray-traced and raster translucency in the same scene allows older Cascade particle systems to continue to work. They won’t be ray-traced, but most games likely won’t want them to be ray traced anyway. The refraction behavior also matches what was set up for raster. 

Shadowing also benefits greatly from a content compatibility perspective. First, ray tracing fires rays from the scene to the light to perform shadow testing, whereas shadow maps project them from the light. This reverses the cull direction of primitives, and it can have challenges with single-sided geometry like you might have placed over a lamp. RTX-Dev allows the game to switch the cull direction to match the effective cull direction used for raster avoiding the issue. The base engine doesn’t do this presently, as the cull direction it uses produces more accurate penumbras. Finally, shadow compatibility is improved by lights in reflections properly obeying the shadow-casting flags applied to lights in the scene, preventing extra lighting on your reflected geometry. 

Finally, RTX-Dev helps your game with content scalability beyond what the base UE4 offers today. The additional screen percentage levels supported for ray-raced effects provide a very clear example. Instead of having a choice of 100% of pixels tracing reflections or 25% of pixels tracing reflections, it offers an additional level of 50% of pixels. Further, the light priorities enable the option to scale the number of ray-traced lights considered for both direct, in-scene lighting and reflection lighting.

If you’re just starting out, you’ll also want to take a look at our blog, Introducing Ray Tracing in Unreal Engine 4

Good luck! We want to see your projects succeed!

Discuss (0)

Tags