What is Ray Tracing – IGN
In modern gaming, lighting is king and there’s never been a more wondrous thing than ray tracing. Ray tracing is an old, but now widely, available technology that realistically renders light and shadow to create almost real-life images.
Until recently, whenever our graphics cards or game consoles needed to generate visuals to send out to our screens, they’d use rasterization. This technique translates 3D graphics into the 2D pixels seen on our screens, and then shaders apply lighting. But ray tracing is an alternative approach that, while currently more taxing on hardware, can generate impressive visual results by literally tracing every virtual ray of light. Nvidia provides a technical comparison of the two technologies here.
Let’s get this out of the way upfront: ray tracing is actually any number of different technologies. But for our purposes, we’re defining ray tracing based on the implementations of it we’re seeing in games, where it matters most to us.
How does ray tracing work?
In video games, ray tracing is essentially a system of simulating how light travels, interacts with various objects in the environment, and ultimately reaches our eyes. Light bounces off things, travels through things, bends, and sometimes gets absorbed. All of these interactions can take a lot of work to simulate, but that’s what ray tracing tries to do in the quest to create a more life-like picture.
Epic Games has a bunch of great demonstrations of ray-tracing effects side-by-side with other traditional effects in its ray tracing guide for Unreal Engine. You can also see the impact it can have adding realism to even the least realistic graphics in our side-by-side comparison of Minecraft with and without ray tracing.
Now, normally, we’d think of light as coming from a light source and bouncing around until it ultimately reaches our eyes. But a lot of that light never reaches our eyes, and would therefore not be valuable when ray-tracing a scene in a video game, as it would go unseen. So the implementation of ray-tracing in games works backwards.
The Walt Disney Animation Studios have a great visual demonstration of this process in action for creating 3D animation. A ray of light is cast from your perspective and is sent out into the scene. It may hit a character in the game, an object, or perhaps fly off into the sky and interact with nothing.
Depending on what it hits, any number of things could happen. If the ray hits a reflective object or surface it will bounce off and head toward something else. If the surface was rough instead, it may still bounce off but perhaps at a different angle or even split and refract into several new rays. After a few bounces, if that ray hits a light source, then all the information gathered along the way is turned into the pixel the player will see on their screen. For instance, if the ray hit a gray rock next to a green wall, bounced into that green wall, and then hit a light source, the result might be a gray with a hint of green.
By giving objects in the game world various material properties, games can simulate this realistic lighting behavior to create visuals that ring true to how we see things in reality, where light is really bouncing all over the place.
There are some complicating factors for using ray-tracing for everything, though. It can take a lot of rays making a lot of bounces to actually get a full picture. That can mean millions, if not billions, of rays to trace just to figure out what to show – something like that would slow down the rendering and make ray tracing unusable for real-time applications like gaming. Or it can mean rays that don’t go far enough to ultimately reach a light source.
Games can use some part-way solutions, such as relying on rasterization to create most of the picture, but throwing in a bit of ray-tracing to create realistic reflections or shadows. Another way to make up for a lack of visual information is denoising. Raw ray tracing looks like a pixelated mess of individual colored dots, but denoising intelligently smooths everything out by mixing colors as well as the differences in brightness and darkness. Nvidia showcases denoising in action here, demonstrating how bridges the gap in visual quality between an image with just a little bit of ray tracing and one with substantially more.
What’s this all mean for you?
Ray tracing is finding its way into more and more games. While it can take some heavy lifting to actually deliver, requiring high-end graphics cards and every bit of juice the latest consoles can muster, it can provide a huge leap in graphical quality and avoid some pitfalls of current graphical effects.
If you don’t mind taking a hit on frame rates, you can enjoy ray tracing in a fair number of games right now, though not the vast majority. It’s likely the tech will appear in more games going forward though, especially as the hardware necessary to realize ray-traced visuals becomes more accessible.
Mark Knapp is a regular contributor to IGN and an irregular Tweeter on Twitter @Techn0Mark