Method

Ray tracing is a more accurate “photorealistic” rendering technique for calculating lighting, shadows and reflections in a 3D scene.

Raytracing brings to Notch a number of features not previously possible with the traditional renderer and greatly improves others. Accurate one-bounce reflections, area lights can cast shadows and spot, Omni & skylight quality is improved greatly by using raytraced shadows.

Ray tracing in Notch is modular: you can add it to existing projects and turn on select features at will. It does not completely replace the existing renderer & node set, but augments it and works with it.

In order to use ray tracing in a layer, the “Ray Tracing” checkbox must be ticked on the Root Node. There is an additional “Dynamic” option which, if unchecked, will cause the data structure to never be updated – a useful optimisation for entirely static scenes only.

Ray Traced Skylight Baked Exterior Example Ray Traced Directional light shadows Example
Ray Traced Skylight, RT Mirror reflections and RT Real-Time Denoiser Example Ray Traced Skylight, RT Mirror reflections and RT Real-Time Denoiser Example

Important

One of the main disadvantages of using raytracing is performance. Ray tracing may work in real-time for some suitable scenes but can quickly reduce performance if used incorrectly. When using ray tracing in realtime scenes it will be down to the user to set up their scene optimally. Notch has developed tools to enable users to use raytracing in real-time.

In order to take advantage of the improved render quality offered by ray tracing even in real-time targeted scenes, a new baking workflow to cache lighting to textures has been developed.

RT mirror reflection is an optimal single bounce ray trace reflection which can be used to simulate mirrors, reflections and specular on any raytraced enabled material/surface. This node is best-used for scenes that need to run more optimally at higher framerates.

RT Skylight enables you to reduce the number of bounces and the denoise has similar parameters where both the bounce and filter iterations can be reduced.

Ray Tracing nodes

Lights

“Ray Traced” options are now available on Sky Light, Area Light, basic spot/omni Light and Directional Light nodes. When this option is enabled, the light is rendered using ray tracing rather than traditional shadow maps.

Ray tracing is generally slower than using shadow maps – but in some cases may actually be faster, depending on scene complexity. Limit the attenuation of lights to improve performance.

Reflections

The RT Mirror Reflections node uses ray tracing to produce a one-bounce sharp mirror reflection on shiny surfaces. This is likely to have a significant performance hit but may be usable even in real-time projects. Rays are only cast for reflective pixels on the screen, so reducing the size of reflective surfaces may improve performance.

Mirror reflections in most cases do not require denoising or refining as they’re sharp; one ray per pixel is sufficient. The exception is when mirror reflections see bounces from lights with ray traced noisy shadows. To enable denoising/refining on the Mirror Reflections there is a checkbox on the node.

Materials

A new set of material nodes have been added which simplify the setup of common surface types, including when used in ray tracing scenes.

Refining & Denoising

Ray tracing is computationally intensive and some effects – such as soft area light shadows – rely on lots and lots of rays being cast per pixel. In order to make this viable in real-time or while editing interactively, Notch typically casts very few rays per pixel but uses denoising or refining to aggregate the results over time.

Refining

Refining simply rerenders the same view repeatedly but with different ray directions, and averages the results to create a smooth, accurate render. If the play head, the camera, or any objects move, the refining resets and the aggregated result is lost. A new button in the GUI has been added which allows you to toggle infinite refining on and off.

The new Refine Render button in the GUI.

Denoising

Denoising attempts to handle moving objects and views using motion and spatial coherence. This is imperfect; it can lead to ghosting and bleeding artefacts. But it allows a moving scene to appear refined.

RT Real-Time Denoiser

The RT Real-Time Denoiser node is used to control denoising parameters throughout the scene. With no RT Real-Time Denoiser present, the default behaviour is Refining.

Baking

Notch allows you to take static elements in your scene and bake various forms of view-independent diffuse lighting, shadows and ambient occlusion. By removing these calculations for these static elements you can achieve very high-quality lighting looks and even combine baked lighting with other dynamic real-time lights.

This works for any lighting in Notch – but is particularly applicable with slower, higher quality raytraced lighting setups.

The Bake Lighting To Object node allows lighting to be cached for a single 3D object.

Baking only works on static geometry and requires that your imported meshes have well-formed UV maps to bake too. Note that this renders it unsuitable for any generative meshes (Shape 3D, Text etc), cloned objects, dynamic objects or deformed objects.

Optimising Raytracing

We have developed some methods to help optimised ray traced scenes. Below is an example utilising several of these techniques.
The sample comprises of two layers:

Layer 1 – RT
A simple raytraced scene that is running at 15fps (on a GeForce 1080ti)

Layer 2 – RT Optimised
The same simple scene which has been optimised and running at over 70 fps (on a GeForce 1080ti)

The first step is to bake the ray-traced lighting of the scene into lightmaps attached to the 3D meshes. In doing this we are able to turn off the skylight as well as remove the denoiser node.

Step two is to utilise the RT Mirror reflection node because it’s a cheap one sample ray trace node.

Raytraced scene – This scene runs at 15 fps Optimise raytraced scene – This scene runs at over 70 fps