Ray Tracing: The Basics

Ray tracing emulates real-world lighting. The light we see is the result of photons emitted from energy sources, like the sun. Photons can bounce and scatter as they collide with objects. A mirror is all you need to see this in action. Light hitting a mirror creates a reflection. Ray tracing simulates this. The number of rays traced is paltry compared to the real world, where millions of photons bounce across our field of view. Modern games trace somewhere between one and four rays per pixel. Still, that’s enough to simulate the real world. Tracing the path of a ray also lets it interact with the game world. A ray that bounces off a red object can be influenced by that color, casting a red glow nearby. Rays can scatter in different ways based on the properties a game’s artists give to objects, allowing realistic semi-reflective or rough surfaces. Ray tracing is a significant step forward for 3D graphics. It creates a realistic image by simulating the path of rays as they move through a game. This leads to lighting that can interact with the environment even when the environment isn’t visible to the player. Ray tracing doesn’t require purpose-built hardware to function, but it’s only practical on a video card or game console that can accelerate ray tracing because it’s very demanding.

Ray Tracing vs. Rasterization (or, 3D graphics as you knew it)

You may still be confused even if you understand this explanation. Reflections were present in past games, even those now several decades old. How is ray tracing different? Past 3D games, and most modern games, use rasterization. Rasterization combines the elements of a 3D game world visible to the player into a 2D image. It only renders what should be visible to the player, as any performance used to generate what the player can’t see is wasted. However, this creates a problem. Let’s return to the example of a mirror. The player’s environment and the player character aren’t visible to the player (in a first-person game, at least). With rasterization, there’s nothing for the mirror to reflect. Of course, mirrors exist in modern games. They render the scene twice. One pass is from the player’s point of view, while another is from a different perspective. That doubles the performance needed to render a scene, however. Screen space reflections, a technique in popular 3D game engines, use on-screen data to create a reflection. This technique is ideal for reflective surfaces at an angle to the player’s perspective, such as water. However, reflected objects disappear if the item reflected moves off-screen. Ray tracing doesn’t share these problems because, unlike rasterization, it can trace outside the player’s perspective. Also, in games that allow rays to interact with surfaces, ray tracing can display realistic color bleed and semi-reflective surfaces difficult for rasterization to handle.

What Hardware Does Ray Tracing Require?

Ray tracing isn’t a new idea. Computer scientists experimented with ray tracing in the early 1980s, creating static images with realistic lighting, reflections, and shadows. Unfortunately, they took hours to render. A video game needs real-time ray tracing at 30 frames per second or higher. That’s only possible with a video card designed to accelerate ray tracing. Nvidia’s RTX ray tracing relies on silicon called a Tensor Core. Tensor Cores are only found in RTX video cards. Nvidia’s GTX cards can render a game using ray tracing because, as said, ray tracing doesn’t require purpose-built silicon. However, performance is abysmal compared to RTX cards. And some games, like Minecraft with RTX ray tracing, require an RTX video card because of the specific way they enable ray tracing. AMD cards that accelerate ray tracing don’t have specific branding and don’t have dedicated silicon. Instead, they use hardware tweaks and software updates for better results. It’s more difficult to identify AMD cards that accelerate ray tracing, so pay attention to the details. Sony’s PlayStation 5 and Xbox Series X and S have graphics hardware from AMD that can accelerate ray tracing. It’s up to developers to enable, however, and many games don’t. A notable example is Cyberpunk 2077, which supported RTX ray tracing on PC at launch but didn’t support ray tracing on next-gen consoles. The feature is promised for next-gen consoles in a future patch.