Introduction to Ray-Tracing in Unreal Engine
Events
Subscribe:  iCal  |  Google Calendar
Kyiv UA   22, Sep — 23, Sep
Valletta MT   23, Sep — 29, Sep
24, Sep — 27, Sep
Tokyo JP   25, Sep — 27, Sep
San Diego US   27, Sep — 30, Sep
Latest comments

there is no need to create a vdb, but it works yes

by Laurent BIAL
16 hours ago

Super taf! ;)

Ted Bundy's car? :D

Introduction to Ray-Tracing in Unreal Engine
2 August, 2019
Environment Art
Interview

Michelangelo Cellini showed how to make the most out of the new real-time ray-tracing features in UE4.

The main shot of the showcase scene with ray-tracing enabled

Introduction

In this tutorial, I will showcase the new ray-tracing features made available to all users in Unreal Engine version 4.22.2. To compare the changes introduced by ray-tracing I have built from scratch a unique environment that includes a variety of materials and modular assets.

I am always excited to share my discoveries on new software and techniques, and I feel like ray-tracing is a great tool that can give you greater control over the visual aspect of your scenes.

I will personally continue experimenting with these features and I hope to see them integrated into more games and projects in the coming years, as well as wish for continuous support from hardware manufacturers to the development of amazing technologies like these.

Step 1: Basic Requirements and Setup

To enable ray-tracing in your project you will need to install Unreal Engine version 4.22.2 (or newer), Windows Build 1809 (or the most recent update) and an Nvidia graphics card (either RTX or 10 series) with the latest drivers installed. Not all the 10 series cards are currently supported, check Nvidia’s official website to see if yours is compatible.Step 1: Basic Requirements and Setup

Inside the Engine, in the Project settings force DirectX mode, enable ray-tracing and enable skin cache if you haven’t already, then restart the engine.

Settings to enable ray-tracing in Unreal

Step 2: Ray-Traced Shadows

Ray-tracing should now be enabled in your project. If you had any pre-existing lights in the scene make sure that Cast Raytraced Shadows is enabled in the light’s Details panel. Any newly created lights will have this setting enabled by default.

I decided to lit my scene with a single directional light to be as true to a real-world scenario as possible, where the ruins would be lit by the sun only.

A default light on the left compared to the same light with ray-traced shadows on the right

Step 3: Shadows Control

To control the sharpness of the shadow, change the Source Angle (or Source Radius) in each light’s Details panel: a higher value will result in a softer shadow.

Notice how the shadows are progressively softer the further they are from the contact point between objects, just as in real life.

How the Source Angle value affects the shadows

Step 4: Post-Process Volume

All of the new ray-tracing features can be controlled either through Console Commands or the Post-Process Volume. To use it find it in the Volumes tab in the Modes panel and drop it in the level. Then set the volume’s boundaries to Infinite Extent to affect the whole scene or scale it to your preference.

Check Unbound in the Post Process Volume

Step 5: Ray-Traced Reflections

After enabling ray tracing, the reflection type has been changed. As you can see in the screenshot, all of the elements that are present in the level appear in the reflection on the globe on the right, despite being outside the frame.

Ray-traced reflections have a very big impact on performance but, there are many ways to reduce their computation cost.

Difference between Screen Space reflections and Ray-Traced reflections

Step 6: Reflections Control Max Roughness

To improve performance we can limit the number of reflections that are going to use ray-tracing by setting a limit in the Ray-Tracing Reflection section inside the Post Process Volume. In the Details panel, look for Max Roughness, (set to 0.6 by default) in my case I lowered it to 0.2 since I don’t have many materials that require accurate reflections. To visualize the roughness values in your scene you can switch to Roughness in the Buffer Visualization dropdown menu at the top of the Viewport. To go back to the default view mode press Alt+4.

Roughness Buffer Visualization and Max Roughness settings

Step 7: Ray Distance

To further improve performance, we can limit the distance that the rays that are scattered throughout the scene to trace the reflections will travel. We can do this thanks to the command “r.RayTracing.Reflections.MaxRayDistance”, where the input value indicates the distance from the camera. By lowering the value, objects further away from the camera will not show up in the reflections. As you can see in the screenshots, after lowering the value to 3500 units, the temple in the distance is no longer visible in the reflections.

From left to right, I decreased the Max Ray Distance value by half each time

Step 8: Reflection Control Max Bounces

The Max Bounces setting sets the maximum number of bounces that the reflections use. In my scene, increasing the value to 2 allows the reflections that affect the stone trim to be reflected on the golden artifact, if you have multiple highly reflective surfaces in your scene this change would be even more drastic.

Max Bounces value comparison on a reflective surface

Step 9: Reflection Control Sample per Pixel

Increasing the sample per pixel improves the accuracy of the reflections. In my scene, the reflected shadows get slightly brighter and are not pitch black if I raise the samples per pixel to 4.

Samples Per Pixel value compared

Step 10: Reflection Shadows Control

This setting has 3 options here illustrated in my screenshots. I found Area Shadows to look quite noisy in most cases, but their quality can be improved by tweaking the previous settings.

Reflection shadows type comparison

Step 11: Reflection Denoiser

This feature allows for fewer rays to be used for computation by intelligently refining the final ray-traced reflection output. The denoiser is enabled by default, and you can disable it with the command “r.Reflections.Denoiser 0”.

Reflection Denoiser in action

Step 12: Ray-Traced Ambient Occlusion

The Ambient Occlusion type can be changed from the Post Process Volume’s Details panel as well. The ambient occlusion looks more intense using the default settings but additional controls allow the ray-traced version to be more apparent too.

Ambient occlusion types compared

Step 13: Ray-Traced GI

Ray-traced GI is dynamic and reacts beautifully to real-time material changes. Enabling this setting in my scene drastically improved the quality of the shadows and the realism of the materials. In any scene with moving objects or dynamic materials, you will notice how the GI updates in real-time, which could be crucial for gameplay and visual storytelling.

GI type comparison

Step 14: GI Controls

Max Bounces controls the bounces of the rays used to calculate GI. Increasing this value further brightens up the shadows and improves the accuracy of their shading. As with most of the ray-tracing settings, I don’t recommend increasing this value further unless you are rendering a static image.

GI Max. Bounces increase affecting a broken column

Step 15: Ray-Traced Translucency

Two options are available for translucency type in the Details panel, Raster, and Ray-Traced. Enabling ray-traced translucency makes the glass sphere in my level look properly refractive.

Translucency type compared

Step 16: Translucency Controls

The shadow settings for translucency resemble the reflection shadows controls. Two different types of shadows are available, or alternatively, they can be completely disabled. In this scene, the shadows are mostly cast by the statue’s hands holding the spheres.

Translucency shadows affecting a spherical mesh

Step 17: Shader Complexity

Having the same type of shader can improve performance when using ray-tracing. You can visualize the shading types through the Ray-Tracing Debug options in the View Mode dropdown in the Viewport. In this case the sphere on the right is using a translucent shader and the fern in the center a masked shader, which appear red and violet respectively, contrasting with the green of the default shader.

Shading Model ID buffer type

Step 18: World Position Offset and Foliage

World Position Offset is currently not supported by ray-tracing. This material feature is used in most foliage shaders that use it to emulate the wind movement, and activating ray-tracing will make the affected meshes render incorrectly.

The issue with ray-tracing and World Position Offset

Step 19: Volumetric Fog

Another feature that unfortunately is not yet supported by ray-tracing is volumetric fog. In my environment, I use the fog to enhance the shininess of the golden artifact, and as you can see the yellow glow is completely absent from the reflection in the water.

Ray-traced reflections don’t support volumetric fog

Step 20: Ray-Tracing Quality Switch in the Materials

To simplify calculations and optimize your scenes further, a new node has been introduced in the Material Editor that allows you to indicate an alternative input for each material parameter to be used with ray-tracing. This node can be very useful for example to simplify materials with panning textures or to set a specific roughness value.

The “RayTracingQualitySwitchReplace” node in the material graph

Step 21: Geo Complexity Affecting Ray-Tracing Calculations

Having a lot of highly detailed geometry in your scene can greatly affect performance when using ray-tracing. Smooth and clean surfaces will make the casted rays bounce off uniformly and simplify calculations. In my scene, replacing the two statues (containing a lot of crevices) with a simpler mesh improved performance by almost a full-frame per second.

Wireframe on top of the geometry

Step 22: Rendering with Ray-Tracing

When rendering an image sequence or a video through the Sequencer Editor, the first few frames might appear extremely noisy, this is because raytraced GI and reflections need a few frames to calculate, even when enabling Warm-Up frames in the Animation settings. Keep this in mind when setting up renders with key-framed elements.

Ray-traced GI in different rendered frames

Step 23: The impact of Ray-Tracing

When positioning the cameras around my level, I came across this great example of how much ray-tracing can improve the visual read of the environment. Of course, there are many ways to improve the Global Illumination without enabling ray-tracing, but remember that ray-traced GI is dynamic, so changing the color of the terrain would update the indirect lighting immediately without having to rebake the lightmaps.

Ray-traced GI affecting the temple’s ceiling

Step 24: Path-Tracing

The new Unreal update also includes an experimental Path-Tracer. This tool casts a much higher amount of rays in the scene and uses them to calculate every aspect of the meshes, from the base color to normals, working essentially like a traditional rendering engine like V-Ray.

Path-Tracing can be accessed in the View Mode dropdown menu in the Viewport and as you can see it renders a decently defined image that can be used as a comparison for how the scene would look like in a traditional renderer.

Path-tracing compared to the default rasterization and ray-tracing render

Top Tip 1: Generated LODs

I highly recommend having different LOD (level of detail) meshes for each of your assets. Fortunately you can generate them directly in the Engine from the Details panel in the Static Mesh Editor.

Top Tip 2: Color Grading

To improve the quality of your renders a wide array of tools are available in the Post Process Volume. I recommend starting from the Global Color Grading settings inside the Details panel of the Volume and always having a reference at hand to match.

Top Tip 3: Show FPS

A crucial tool to keep you in control of the performance in your scene is the FPS counter. Press Ctrl+Shift+H in the viewport and you will now have a constant indication on how the level will perform once you build the project, press the shortcut again to hide the counter.

Top Tip 4: View Modes and Buffer Visualization

In the Viewport you have access to a wide array of View Modes, the ones I use the most are Roughness and Ambient Occlusion, found inside the Buffer Visualization category.

Conclusion

I hope you found this article interesting and start testing out ray-tracing in your projects, you can find me active on these socials for any questions and feedback: Artstation, LinkedIn, and if you are interested in purchasing the assets I used to build this scene you can buy them on Gumroad.

Michelangelo Cellini, Associate Environment Texture Artist at Naughty Dog

ENVIRONMENT PROP MASTER MATERIALS FOR UE4
Save yourself endless time and technical hurdles in the material editor, with my pack of Prop Master Materials for UE4!
 
Comments

9
Leave a Reply

avatar
3 Comment threads
6 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
8 Comment authors
MichelangeloMaxivy meldaanonPoorfag Recent comment authors
Max
Guest
Max

Excellent overview of unreal Ray-Tracing stuff, thank you!
Any chance you can add the scene to the asset pack?

Michelangelo
Guest
Michelangelo

Hi Max, glad you enjoyed the article! I’ve just added the scene to the pack 🙂

ivy melda
Guest
ivy melda

Term Paper Help Services
We are the best writing company providing Best Essay Writing Service in USA written by the highest skilled writers. A perfectly matching writer with a proven track record in your discipline or degree is assigned to research and write your Best Custom Term Paper Writing Services which in turn allows the article to be written with maximum accuracy and efficiency.
https://researchpapers247.com/best-custom-term-papers/

Poorfag
Guest
Poorfag

Well I’m a poor piece of shit who can’t afford a card that supports rtx so this is stupid and pointless

Richfag
Guest
Richfag

Runs on older cards to not just rtx

Poorerfag
Guest
Poorerfag

At cinematic 2 fps

anon
Guest
anon

Still can make screenshots, or release map for people who have RTX.

joules
Guest
joules

Is not stupid and pointless at all, actually it’s pretty useful. Your attitude sucks though.

Poorfag
Guest
Poorfag

Sorry I’m just a poor fag. I can never have a card that does ray tracing so it makes me angry

Related articles
Environment Art
Environment Design
Interview
Environment Art
Environment Design
Interview
Materials
Education
Environment Art Program
Education
Electives