GamingGPUs

Ray Tracing vs Path Tracing: What is the Difference?

Path tracing is the next milestone on the path to 3D graphics realism. Is it better than ray tracing (yes, for sure)? 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. Before we begin, remember that path tracing is an extension of ray tracing.

Both start the same and require the same resources, but with path tracing, after the intersection stage, instead of terminating, each ray repeats the ray tracing process recursively. So essentially, each path-traced ray equals multiple ray-tracing rays with different starting points.

Ray Tracing

Alan Wake 2 isn’t 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 post the intersection stage, repeating the whole process.

Path Tracing

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, the object would also act as a secondary light source.

Path Tracing in Quake RTX

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 in Quake RTX

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:

Path Tracing

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.

Ray Tracing
Rasterization
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.

Ray Tracing
Rasterization
Path Tracing

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.

Ray Tracing
Rasterization

Here are two interior scenes where path tracing adds a fresh coat of paint, transforming the image altogether:

Path Tracing

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.

Ray Tracing
Rasterization
Path Tracing

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.

Ray Tracing
Rasterization

Areej Syed

Processors, PC gaming, and the past. I have written about computer hardware for over seven years with over 5000 published articles. I started during engineering college and haven't stopped since. On the side, I play RPGs like Baldur's Gate, Dragon Age, Mass Effect, Divinity, and Fallout. Contact: areejs12@hardwaretimes.com.
Back to top button