If you’ve been a little familiar with gaming and graphics news lately, then you’ve heard the latest buzzword: ray tracing. You may have also heard a similar-sounding word called path tracing. And you can be completely forgiven for not fully understanding what one of the processes is.
The simple explanation is that both path tracing and ray tracing are graphical techniques that lead to more realistic images at the expense of significantly more processing power. There is a YouTube video about Minecraft that demonstrates some aspects of ray tracing, but also demonstrates the load it puts on the system.
If that’s the only explanation you need, great! But if you want to dive deeper and find out how each method works and why GPU hardware companies charge a fortune for ray-traced cards, read on.
Rasterizing and computer graphics
Any image you see on the computer screen did not start up as this image. It starts out as a bitmap or vector image. A bitmap is composed of a set of shaded pixels.
A vector image is based on mathematical formulas, which means that the image can be enlarged almost indefinitely. The downside of vector art is that it is difficult to achieve more precise detail. Vector images are best used when only a few colors are needed.
The main advantage of rasterization is its speed, especially when compared to methods such as ray tracing. Your GPU or GPU will tell the game to create a 3D image from small shapes, most often triangles. These triangles are transformed into individual pixels and then passed through a shader to create the image you see on the screen.
Rasterization has long been a popular option for video game graphics because of how fast it can be processed, but as current technologies begin to push their limits, more advanced techniques are needed to take them to the next level. This is where ray tracing comes in.
Ray tracing looks much more realistic than rasterizing, as shown in the image below. Look at the reflections on the teapot and spoon.
What is ray tracing?
On a superficial level, ray tracing is a generic term that means everything from a single intersection of light and object to complete photorealism. However, in the most common context used today, ray tracing refers to a rendering technique that follows a ray of light (in pixels) from a given point and mimics its reaction when it encounters objects.
Take a moment and look at the wall of the room you are in. Is there a light source on the wall or is light reflected off the wall from another source? Ray-traced graphics will start at your eye and follow your line of sight to the wall, and then follow the path of light from the wall back to the light source.
The diagram above shows how this works. The reason for simulating “eyes” (camera in this diagram) is to reduce the load on the GPU.
Why? Well, ray tracing isn’t new. In fact, it has been around for quite some time. Pixar uses ray tracing techniques to create many of its films, but it takes time to get high quality time-lapse graphics at Pixar resolutions.
Lots of time. Some of the shots in Monster University took 29 hours each. Toy Story 3 took an average of 7 hours per frame, with some frames taking 39 hours, according to a 2010 story from Wired.
Since the film illustrates the reflection of light from every surface, creating a graphic style everyone knows and loves, the workload is almost unimaginable. By limiting ray tracing techniques to only what the eye sees, games can use this technique without causing your GPU to (literally) crash.
Take a look at the image below.
This is not a photograph, despite how realistic it is. This is a ray traced image. Try to imagine how much energy is required to create such an image. One beam can be traced and processed without too much trouble, but what if that beam is reflected off an object?
One ray can turn into 10 rays, and these 10 – into 100, and so on. Increase exponentially. After the point, bounces and reflections outside the tertiary and quaternary display are reduced. In other words, they require a lot more power to calculate and display than they are worth. To render the image, you need to draw a limit somewhere.
Now imagine doing this 30 to 60 times per second. This is the amount of energy required to use ray tracing techniques in games. It’s really impressive, right?
The availability of ray-traced graphics cards will grow over time, and eventually this method will become as affordable as 3D graphics. At the moment, however, ray tracing is still considered the cutting edge of computer graphics. So how does path tracing come into play?
What is path tracing?
Path tracing is a type of ray tracing. It falls under that umbrella, but where ray tracing theory was originally theorized in 1968, path tracing was not applied until 1986 (and the results were not as dramatic as they are now).
Remember the exponential growth in the number of rays mentioned earlier? Path tracing solves this problem. When using path tracing for rendering, rays create only one ray at a time. The beams do not follow a set line when bouncing, but rather fly in a random direction.
The path tracing algorithm then takes a random sample of all rays to create the final image. This results in a selection of different types of lighting, but especially global illumination.
The interesting thing about path tracing is that the effect can be emulated using shaders. Recently, a shader patch for the Nintendo Switch emulator appeared that allowed players to simulate path-traced global lighting in games like The Legend of Zelda: Breath of the Wild and Super Mario Odyssey. While the effects look nice, they are not as complete as the actual path tracing.
Path tracing is just one form of ray tracing. While this was the best way to render images, path tracing has its drawbacks.
But in the end, both path tracing and ray tracing produce absolutely beautiful images. Now that the hardware in consumer-grade machines has reached the point where ray tracing is possible in real-time video games, the industry is poised to make a breakthrough almost as impressive as the move from 2D to 3D graphics.
However, it will take some time – at least several years – before the necessary equipment becomes “available.” At the moment, even the necessary video cards cost over $ 1000.