Light as the starting point
What you see in the real world is light that has left a source, bounced off surfaces and arrived at your eye. Ray tracing copies that idea inside a computer. It follows imaginary rays of light through a scene and works out what they hit, so the image can reflect how light would behave there.
For decades, real-time games did not do this. They relied on clever shortcuts that approximate lighting. Ray tracing is an attempt to calculate it more directly, which is why it can look more convincing and also why it asks so much of the hardware.
The traditional approach
Most games have long used a method called rasterization. In simple terms, the game takes the 3D shapes in a scene, projects them onto the flat grid of screen pixels and decides what color each pixel should be. It is fast and well suited to real-time graphics.
Rasterization does not naturally know about light bouncing around a scene. To fake it, developers use a collection of tricks:
- Shadow maps, which are pictures of the scene from a light’s point of view, used to decide what is shaded.
- Pre-calculated lighting, in which the lighting for a static scene is worked out ahead of time and stored in the level’s data.
- Reflection tricks, such as reusing the part of the screen that is already visible, or placing pre-captured images of the surroundings into shiny surfaces.
These methods can look excellent, and skilled artists use them well. Their limits show up at the edges: a reflection that disappears when the thing being reflected moves off screen, shadows that look too sharp or too soft, or lighting that does not react when an object moves.
How ray tracing differs
Ray tracing starts from the camera, or the screen pixel, and sends a ray out into the scene. The program checks what the ray hits first. From that point it can send more rays: one toward each light to see whether the point is in shadow, another bouncing off a mirror-like surface to find out what is reflected, and so on.
The idea is that the result follows the geometry of the scene rather than a stored approximation. If a character moves, the shadow and reflection can change accordingly. Off-screen objects can still appear in reflections because the rays travel through the whole scene, not just the visible part of the screen.
Rays are traced backward, from the eye toward the lights, because tracing every ray that leaves a light source would waste enormous effort on rays that never reach the camera.
What it can improve
Games use ray tracing for a number of effects, often offered as separate toggles:
- Reflections on water, glass, polished floors and metal that show objects from anywhere in the scene.
- Shadows with more natural softness, where the edge blurs gradually with distance from the object casting it.
- Ambient occlusion, the gentle darkening in corners and crevices where light has trouble reaching.
- Global illumination, in which light bouncing off one surface tints and brightens another, such as a red wall casting a faint glow onto a nearby floor.
How noticeable these are depends heavily on the scene and the art. In some places, a well-built traditional approach looks close enough that the difference is subtle. In others, such as a rainy street full of puddles and neon signs, the effect can be dramatic.
Why it is so demanding
The basic reason is the sheer number of questions the computer must answer. A single frame may contain millions of pixels. Each may need several rays, and each ray must be tested against a scene containing a huge number of triangles to find what it hits first. Those tests have to be repeated for every frame, many times per second.
Some of the main costs:
- Finding intersections. Checking a ray against every triangle would be far too slow, so scenes are stored in special structures that let the program skip large regions quickly. Building and updating that structure for a moving scene takes time.
- Many rays per pixel. Realistic soft shadows and indirect light require sampling from many directions. A game can only afford a few, which leaves the image noisy.
- Scattered memory access. Rays go in different directions, so the data they need is scattered, which suits graphics hardware less well than the orderly work of rasterization.
Modern graphics cards include dedicated circuits to speed up the intersection tests, and consoles of recent generations include similar support. Even so, ray tracing generally costs a significant share of frame time, and players often see their frame rate fall when they enable it.
How games make it affordable
Because pure ray tracing in real time is out of reach for a full, complex scene, games use compromises:
- Hybrid rendering. The main picture is still drawn by rasterization, and ray tracing is added for chosen effects only.
- Few rays plus denoising. The game traces a small number of rays and then uses a filter to clean up the grainy result, often with help from previous frames.
- Lower-resolution rays. Reflections or lighting may be traced at a reduced size and combined with the full-resolution picture.
- Upscaling. Techniques such as image upscaling recover some of the lost speed by rendering fewer pixels in the first place.
- Adjustable quality levels. Many games let you choose between a few settings, trading rays for performance.
These shortcuts can introduce their own flaws: lighting that takes a moment to settle, faint shimmering in reflections, or noisy shadows in dark areas.
Whether to turn it on
There is no universal answer. A few questions help:
- Does your hardware have dedicated support, or will it rely on slower general-purpose calculation?
- How much frame rate are you willing to give up for the visuals? Some players prefer a smoother game over richer lighting.
- Does the game actually benefit? Titles built with ray tracing in mind often show more improvement than those with it added late.
- Can you test it? Switching the setting on and off in a familiar spot is the most reliable comparison.
Reviews and comparisons can illustrate what each effect changes, but your screen, your eyes and your priorities decide whether it is worth the cost. Ray tracing is best thought of as one more setting on the quality-versus-smoothness scale, a particularly costly one that continues to become more practical as hardware and techniques improve.