Ahead of the Alan Wake 2 release, a review of path tracing is in order. Is it better than ray tracing (yes, for sure)? Why is it better than ray tracing, and what are the differences between ray tracing and path tracing? In the end, we’ll have a look at screenshots comparing the two real-time rendering technologies. Path tracing is technically an extension of ray tracing.
Both start the same way and require the same resources, but with path tracing, after the intersection, instead of terminating, each ray repeats the ray tracing process recursively multiple times. So essentially, each path-traced ray equals multiple ray-tracing rays with a common starting point.
Alan Wake 2 won’t be the first game to support path tracing. A while back, CD Projekt Red rolled out a path-tracing update for Cyberpunk 2077. Other popular titles that also support it include Portal RTX, Quake RTX, and Metro Exodus Enhanced Edition.
The primary difference between ray tracing and path tracing boils down to the post-intersection stage. The rays are first cast into the scene through the viewport. Each ray is tested against the BVH structures of the objects in the scene for intersection, namely a hit or a miss. With ray tracing, this is the last step, followed by the necessary calculations and shading of the pixel in question. Path tracing repeats the intersection stage multiple times to gather additional data before returning with the results.
A BVH structure is used to simplify the geometry in a scene. Each object is divided into box-shaped structures which are further divided into smaller structures. The process is continued till you reach triangle-level precision. BVH structures save GPU and CPU processing power by simplifying the scene into boxed structures instead of millions of pixels.
Each ray is tested against the upper section BVH (bigger boxes) first. A miss ends the draw call. In the case of a hit, the ray traverses the lower sections of the BVH (smaller). As long as there are hits in every level, the process continues till the triangle-level structures are reached, and the shading then proceeds ahead.
With path tracing, the ray acts as if newly launched (albeit with color/light data from the first intersection) repeating the whole process.
In practice, a path-tracing ray is usually treated as multiple ray tracing rays that pick off right where the first one ends. Suppose you have a mirror or a shiny metal frame. A path-tracing ray would strike it once, get reflected, and bounce off to a nearby object as a second independent ray. In this case, it would also act as a secondary light source.
In path tracing, light-reflecting objects also behave as secondary light sources. As a result, the total number of luminous objects affecting the lighting of the scene significantly increases. Each point source of light gets its own shadow, and the number of rays present in the scene simultaneously increases triple or quad-fold.
Path tracing generally makes the scene more illuminated as the additional ray bounces result in better penetration of the light rays. This is especially notable in indoor scenes. There’s another important step in ray and path tracing called denoising. It involves temporal accumulation to fill the spots in the ray-shaped blanks (not literally).
Here are some examples of how path-traced global illumination improves image quality. You may click on the image to view the high-resolution version:
The impact of path tracing is most prominent in indoor scenes, with exteriors also getting a decent uplift at night. The above example shows that the vegetation and other complex structures are shadowed much more accurately with path tracing.
In the above shot, you can see that path tracing also affects the outside. The sun’s rays better illuminate the scene, adding a slight orange tint to the concrete structures. Dense vegetation is also better shaded.
Here’s an example where path tracing has less of an impact on image quality. While the shadows and AO are more accurate, it’s not something that you’ll notice unless you know what to look for.
Here are two interior scenes where path tracing adds a fresh coat of paint, transforming the image altogether:
The penthouse looks very well-lit with path tracing, while ray tracing looks dim and lifeless. This is path traced global illumination at its best. The artificial light sources (electric lighting) are diffused uniformly, making the lighting look more realistic. Interestingly, indirect lighting or multiple bounce lighting is also called diffuse illumination.
Here’s another example of indoor diffuse lighting. Path tracing results in better ambient shadows where the lighting is well-spread in lit areas while keeping the obstructed ones dark.