Hardware Ray Tracing

An overview of the features that use hardware to render real-time ray traced results.

Ray tracing techniques have been used in offline rendering for film, television, and visualization because they produce high-quality, natural-looking results with soft shadowing for lights, accurate ambient occlusion, interactive global illumination, reflections, and more. However, rendering images at those quality levels have often required powerful computers and long periods of time to render even a single frame.

With Unreal Engine, ray tracing is made possible with supported hardware allowing for interactive experiences rendered with subtle lighting effects in real-time. Unreal Engine's hardware ray tracing capabilities are coupled with those of traditional raster rendering techniques. Combining the two means tracing rays for fewer samples per pixel and utilizing denoising algorithms to achieve results perceptually close to the results of an offline renderer.

Real-time rendering of Ray Tracing features in the Archviz Interior sample project available on the Epic Games Launcher.

Enabling Hardware Ray Tracing

In the Project Settings under Engine > Rendering > Hardware Ray Tracing, enable Support Hardware Ray Tracing and restart the editor for the changes to take effect.

ProjectSetting_EnableRT

When Ray Tracing is enabled, it also enables Support Compute Skin Cache for the project, if not already enabled.

Some features of hardware ray tracing, such as Ray Traced Shadows and Ray Traced Skylight, can be enabled independently of other ray tracing features. In the same Hardware Ray Tracing section of the Project Settings, you can enable the features you need for your project.

ProjectSetting_EnableRT_Shadows_SkyLight

Features of Hardware Ray Tracing

The following hardware ray tracing features are supported.

Ray Traced Shadows

Ray Traced Shadows simulate soft area lighting effects for objects in the environment. This means that based on the light's source size or source angle, an object's shadow will have sharper shadows near the contact surface than farther away where it softens and widens.

Raster Shadows using Shadowmaps

Ray Traced Soft Shadows

Ray Traced Ambient Occlusion

Ray Traced Ambient Occlusion (RTAO) accurately shadows areas blocking ambient lighting better grounding objects in the environment, such as shadowing the corners and edges where walls meet or adding depth to the crevices and wrinkles in skin.

Screen Space Ambient Occlusion (SSAO)

Ray Traced Ambient Occlusion (RTAO)

When compared with Screen Space Ambient Occlusion (SSAO), RTAO grounds objects and adds depth to the scene to produce natural looking shadowing in indirectly lit areas.

Ray Traced Ambient Occlusion | Intensity: 0.5

Ray Traced Ambient Occlusion | Intensity: 0.85

By varying the Intensity and Radius properties of the Ambient Occlusion effect, you can control its size and strength.

Ray Traced Reflections

This feature of ray tracing is deprecated and may be removed in a future release.

Ray Traced Reflections (RTR) simulates accurate environment representation supporting multiple reflection bounces.

This example shows a single bounce of ray traced reflections compared to multiple bounces of ray traced reflection. Using multiple bounces creates real-time inter-reflection between reflective surfaces in the scene.

Ray Traced Reflection Single Bounce

Ray Traced Reflections Multiple Bounces

In contrast, Screen Space Reflections (SSR), Planar Reflections, or even Reflection Capture Actors cannot capture the entire scene dynamically nor does it have some of the limitations present in these other reflection methods.

In this comparison, SSR is only capable of a single reflection bounce and is limited to what is visible on the screen for representation. On the other hand, RTR is capable of multiple bounces and is not limited to what is visible, meaning that we can visibly see the sides of the book, reflected floor behind the camera, and additional lightings being reflected on surfaces coming through the window.

Screen Space Reflections

Ray Traced Reflections

Ray Traced Translucency

This feature of ray tracing is deprecated and may be removed in a future release.

Ray Traced Translucency accurately represents glass and liquid materials with physically correct reflections, absorption, and refraction on transparent surfaces.

Raster Translucency

Ray Traced Translucency

Ray Traced Global Illumination

This feature of ray tracing is deprecated and may be removed in a future release.

Ray Traced Global Illumination (RTGI) adds real-time interactive bounce lighting to areas of your scene not directly lit by a given light source.

Scene Lighting Only

Ray Traced Global Illumination | Brute Force Method

There are two ray-traced global illumination methods to choose from in the Post Process Volume:

  • Brute Force emulates offline renderers indirect lighting, but is slower to render.

  • Final Gather provides a single bounce of indirect lighting, but is faster to render.

Final Gather Method

This feature is experimental.

The Final Gather approach to ray-traced global illumination uses a final gather-based technique that trades some quality for runtime performance. The technique is a two-pass algoirthm, whereby the first pass distributes shading points throughout the scene — similarly to the Brute Force method — but at a fixed rate of one sample per pixel. A history of up to 16 shading point samples are stored in screen space during this pass. During the second pass, the algorithm attempts to reconnect to the shading point history, amortizing the cost of the method.

The Brute Force algorithm is intended to emulate the Path Tracer's ground truth reference and is similar in how it executes the result. The Final Gather method trades that emulation for performance. This has it's own limitations, like being limited to a single bounce of indirect diffuse global illumination, and reprojection from the previous frame sample data is susceptible to ghosting when the camera is moving fast.

To aid in suppressing temporal ghosting artifacts, you can use the following command to modify the world space rejection criteria.

    r.RayTracing.GlobalIllumination.FinalGatherDistance [number of units]

It is currently based on a world distance measured from the original shading point. This rejection crieteria defaults to 10 units.

The Final Gather method also requires the following settings to be used in the Post Process Volume for it to work effectively:

  • Max Bounces: 1

  • Samples Per Pixel: 16

Any additional Max Bounces beyond 1 are silently discarded and when adjusting the Samples Per Pixel. It's best to increase the value by powers of two (8, 16, 32, 64).

Using Ray Tracing Features

The sections below provide details for using ray tracing features in your project using the Post Process Volume and individual light properties.

Post Process Volume

Use Post Process Volumes provides controls for some ray tracing features:

  • Ambient Occlusion

  • Global Illumination

  • Reflections

  • Translucency.

Click image for full size.

For additional information about the available post process settings, see Ray Tracing and Path Tracer Properties.

Lights

Lights support casting soft area shadows for all types of lights when Cast Ray Traced Shadows is enabled. The soft shadowing of the light is based on the size of the light source and its distance from the shadow-casting object.

Ray Traced Shadows: Directional Light | Source Angle: 0.5357

Ray Traced Shadows: Directional Light | Source Angle: 1.25

Control the softness of the shadow by adjusting the following:

  • On a Directional Light, set the Source Angle.

  • On Point and Spot Lights, set the Source Radius.

  • On a Rect Light, set the Barn Door Angle and Barn Door Length to shape the light and soften the shadow softness.

Sky Lights

Sky Lighting supports soft ambient shadowing when Cast Ray Traced Shadow is enabled and the Source Type is specified. The Sky Light captures the distance parts of the level and applies that to the sene as a light.

RT_SkyLight

For Ray Traced Global Illumination to work with sky lighting, enable the experimental console variable r.RayTracing.GlobalIllumination.EvalSkyLight.

Standalone Ray Traced Sky Lights has been deprecated and the project setting removed. It can still be enabled by setting the console variable r.RayTracing.SkyLight 1.

Performance and Debugging

The following sections suggest starting points and basic tooling you can use to debug and inspect the performance of hardware ray tracing in your projects.

Stat GPU

Use the stat command GPU Stats to check relevant GPU performance of ray tracing features. It provides relevant information about ray tracing features which are enabled and how much frame time is being spent on each to render the current scene view.

GPUStats1

Stat D3D12RayTracing

Use the stat command Stat D3D12RayTracing to check relevant ray tracing resource usage.

StatD3D12RayTracing

Ray Tracing Debug View Modes

Hardware ray tracing provides a selection of debug view modes to look at specific areas and features of ray tracing. Use the Level Viewport to access these debug views from the View Modes dropdown under Ray Tracing Debug.

RT_DebugOptions

Force Disable All Ray Tracing Effects

Use the console variable r.RayTracing.ForceAllRayTracingEffects to quickly enable or disable all ray tracing features in the scene.

  • 0 disables all ray tracing features.

  • 1 enables all ray tracing features.

  • -1 uses the state previously set by any console variables and it uses values set in the Post Process Volume. (Default)

Toggle Ray Tracing at Runtime

This feature is experimental.

Hardware ray tracing can be dynamically switched off and on without restarting the game on PC by adding the following to your WindowsEngine.ini configuration file.

  • r.RayTracing.EnabledOnDemand=1

  • r.RayTracing.Enable=1

  • Set your appropriate defaults for the engine to match previous read-only state.

r.RayTracing can now have the following values:

  • 0 disabled

  • 1 enabled all the time

  • 2 enabled dynamic

Supported Ray Tracing Features

This list is intended to give you an idea of what is currently supported and is not meant to be a comprehensive list of supported ray tracing features.

Feature

Supported (Y/N/Partially)

Additional Notes

Rendering Path

Deferred

Y

Forward

N

Types of Lights

Directional Light

Y

Sky Light

Y

Point Light

Y

Spot Light

Y

Rect Light

Y

Lighting Features

Emissive Surfaces

Partially

Supported for reflections on surfaces, but does not emit light or cast shadows.

Light Transmission

N

The translucent shadow is treated as opaque, meaning no colored shadows or light transmission through the material.

Area Shadowing

Y

IES Profiles

Y

Light Functions

Y

Volumetric Fog

Y

Enabled with the console variable r.VolumetricFog.InjectRayTracedLights:

  • 0: disabled (default due to performance cost)

  • 1: lights with Ray Traced shadows are injected into the Volumetric Fog

Image Based Lighting (IBL)

Y

Support for HDRI with Sky Light.

Lumen Hardware Ray Tracing

Y

Materials: Blend Mode

Opaque

Y

Masked

Y

Translucent

Y

Anisotropic

Y

Materials: Shading Model

Default Lit

Y

Unlit

Partially

Masked

Partially

Supports casting of masked shadows.

SubSurface and SubSurface Profile

Y

Preintegrated Skin

Partially

Works but the result isn't correctly raytraced. It uses the raster pipeline.

Clear Coat

Y

TwoSided Foliage

Y

Hair

Partially

Works but the result isn't correctly raytraced. It uses the raster pipeline.

Cloth

Partially

Works but the result isn't correctly raytraced. It uses the raster pipeline.

Material Functions

Y

Two-Sided

Y

World Position Offset

Y

Enabled per-Actor through the details panel with the property Evaluate World Position Offset. Supports, Static Meshes, Instanced Static Meshes, and Hierarchical Instanced Static Meshes.

Geometry Types

Skeletal Mesh

Y

Static Mesh

Y

Nanite Virtualized Geometry

Y

Choose a mode with the console variable r.RayTracing.Nanite.Mode:

  • 0: supports Nanite Fallback Mesh (default)

  • 1: supports Streamed Out Mesh

Geometry Cache (Alembic)

Y

Landscape

Y

Hierarchical Instanced Static Mesh (HISM)

Y

Instanced Static Mesh (ISM)

Y

Splines

Y

Procedural Mesh

Y

This type of geometry can be expensive to render in Ray Tracing.

Levels of Detail (LOD)

Y

Dithered LOD transitions are not yet supported.

Visual Effects (VFX)

Niagara

Partially

Currently supports Sprites, Ribbons, and Mesh emitters.

Platform Support

Multi-View (VR and Split-Screen)

Y

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Cancel