What is Ray Tracing?
Ray tracing is a rendering technique that produces highly realistic lighting effects in 3D computer graphics. It simulates the physical behavior of light by tracing individual rays of light as they interact with objects in a scene.
In the real world, light rays originate from a light source, bounce off surfaces, and ultimately reach our eyes. Ray tracing aims to simulate this process by tracing rays from the camera through each pixel, calculating the color and brightness of that pixel based on the rays interaction with objects.
Key characteristics of ray tracing:
- Traces individual rays of light
- Simulates real-world optical effects
- Produces photorealistic graphics
- Computationally intensive technique
Ray tracing calculates lighting effects like shadows, reflections, refraction, global illumination, and ambient occlusion much more accurately than previous rendering techniques like rasterization. This is why ray tracing is considered the next big leap in creating ultra-realistic graphics for games.
Brief History of Ray Tracing
The concepts behind ray tracing have been around since the 1960s, but it wasn’t until the 1980s that ray tracing started being used for photo-realistic image synthesis.
Some key events in the history of ray tracing:
- 1968 – Arthur Appel describes the basic algorithm for ray casting.
- 1979 – Turner Whitted develops recursive ray tracing, allowing effects like reflections and refractions.
- 1980s – Ray tracing is used in films, R&D, and academia for realistic rendering.
- 2010s – Real-time ray tracing hardware becomes feasible with GPU advancements.
- 2018 – NVIDIA introduces RTX technology and hardware accelerated ray tracing in consumer graphics cards.
- 2020 – Ray tracing features launch in next-gen consoles like the PS5 and Xbox Series X/S.
So while ray tracing itself is not new, only recently has consumer hardware been powerful enough to do ray tracing in real-time for gaming. This has opened up a new era for ray traced graphics.
Why Ray Tracing is a Big Deal for Games
Ray tracing is a huge leap forward for in-game graphics due to the heightened realism it offers. Some of the key benefits:
Photorealistic Lighting Effects
- Natural shadows – Soft, diffuse shadows that spread naturally across surfaces
- Accurate reflections – Precise recreation of reflective and glossy materials
- Advanced global illumination – Indirect lighting from light bouncing between surfaces
- True-to-life ambient occlusion – Subtle shadowing in small crevices and corners
This more realistic lighting creates much more immersive game environments.
Improved Spatial Rendering
Ray tracing also improves techniques like audio rendering and depth-of-field effects by better simulating the 3D space. This enhances realism through auditory and visual cues.
High Dynamic Range (HDR)
The lighting information provided by ray tracing supports HDR rendering. This produces a wider range of colors and luminosity for an image, closer matching human vision.
More Natural Materials
Ray tracing can render the unique reflective properties of various real-world materials very accurately. It is great for surfaces like metal, glass, water, skin, and more.
Overall, the visual quality unlocked by ray tracing is a huge leap over previous real-time rendering techniques. It brings us meaningfully closer to photorealism in games.
How Ray Tracing Works
At a high level, here is how ray tracing works to render a single frame:
- Rays are traced from the camera through each pixel into the 3D scene.
- Rays interact with objects, calculating intersections and material properties.
- Color and brightness values are calculated for each pixel based on ray interactions.
- The final 2D image is rendered pixel-by-pixel.
Ray tracing simulates the physical properties of light. When a ray hits a surface, algorithms determine properties like absorption, diffusion, reflection, refraction, and transmission of light energy.
This is repeated for a large number of rays to determine pixel colors. Additional rays are spawned recursively to handle effects like reflections, shadows, and global illumination.
A basic ray tracing diagram showing shadow, reflection, and camera rays.
Some key computations involved:
- Ray-surface intersection – Detects which objects a ray intersects with. Uses acceleration structures for efficiency.
- Shading calculations – Materials and textures determine how light rays interact with a surface.
- Global illumination – Indirect lighting simulated by tracing many diffuse rays all around a scene.
The computational complexity arises from tracing large numbers of rays interacting with a detailed 3D scene. Powerful GPU hardware is required to make this feasible in real-time.
Ray Tracing vs Rasterization
Ray tracing is often compared to rasterization, the previous dominant rendering technique for games. Here are the key differences:
| Ray Tracing | Rasterization |
|-|-|
| Traces rays of light | Renders 3D models to a 2D image |
| Simulates optical properties | Uses “faked” lighting and shaders |
| Physically accurate | Approximate visual effects |
| Very computationally intensive | Works well in real-time |
| Naturally handles reflections, shadows, etc | Requires special code for advanced effects |
For real-time graphics, rasterization has been favored historically for its better performance. But ray tracing produces much more realistic results.
Modern GPUs now use a hybrid of rasterization and ray tracing. Rasterization handles the base rendering, while ray tracing adds the advanced lighting effects. This makes real-time ray traced games possible.
Ray Tracing Hardware – RTX and Beyond
Dedicated hardware is required to make ray tracing feasible in real-time. Let’s look at the evolution of ray tracing capable GPUs:
-
NVIDIA RTX 2000 Series – First consumer GPUs in 2018 with dedicated ray tracing cores called RT cores. Supported in RTX 2060 through RTX 2080 Ti cards.
-
NVIDIA RTX 3000 Series – 2nd gen RTX 3000 series (2020) doubles down with more RT and tensor cores. Significant performance gains over 2000 series.
-
AMD RDNA 2 – AMD’s RX 6000 series GPUs (2020) support hardware accelerated ray tracing via Ray Accelerators. Competes with NVIDIA’s RTX cards.
-
Intel Arc GPUs – Upcoming Intel discrete GPUs will support ray tracing via ray tracing units (RTUs).
-
PlayStation 5 and Xbox Series X/S – Next-gen consoles (2020) include dedicated ray tracing hardware in their custom system-on-chip (SoC).
As more GPU vendors add dedicated ray tracing hardware, it will continue becoming more mainstream. But we are still in the early stages – expect rapid evolution of ray tracing technology and capabilities in the years ahead.
Ray Tracing in Games
With capable hardware available, ray tracing is now coming to major game titles. Here are some examples:
-
Control – First game built from the ground up for RTX. Uses reflections, shadows, global illumination and NVIDIA’s DLSS 2.0.
-
Call of Duty: Black Ops Cold War – Ray traced shadows, ambient occlusion, global illumination, and NVIDIA DLSS.
-
Minecraft – Ray tracing enabled dramatic lighting improvements in this voxel-based game. Reflections, shadows, global illumination added.
-
Microsoft Flight Simulator (2020) – Makes extensive use of ray traced global illumination and ambient occlusion to model realistic lighting.
-
Forspoken – Upcoming action RPG and flagship PS5 title using Luminous Engine ray tracing for reflections, shadows, GI, etc.
-
Atomic Heart – Upcoming shooter game harnessing RTX ray tracing for advanced lighting effects.
And this is just the beginning. Expect ray tracing to become a standard graphical feature in major games this decade as the hardware penetration increases.
Performance Considerations
The computationally heavy nature of ray tracing does impact real-time performance. Here are some techniques used to improve ray tracing performance:
-
Limited ray recursion – Only allow rays to bounce a few times to limit exponential growth. Can reduce image accuracy.
-
Resolution scaling – Render at lower resolution and upscale for denoising and anti-aliasing. DLSS uses this technique.
-
Reduced sample count – Trace less rays per pixel to improve speed at the cost of noise.
-
Denosing filters – Clever AI algorithms remove noise and artifacts from low sample counts.
-
Optimization – Better algorithms, GPU utilization, and new hardware all help.
-
Hybrid rendering – Only use ray tracing selectively where it has most impact. Rasterize the rest.
Careful optimization and intelligent usage can make ray tracing feasible today. Performance will keep improving with hardware and software advances.
The Future of Ray Tracing
Ray tracing is still in the early stages, even on cutting edge hardware. Here are some developments we can expect down the road:
-
More accurate effects – Higher sample counts and ray recursion depth will keep improving image accuracy over time.
-
New rendering techniques – Ray tracing will enable new hybrid algorithms and specialized effects.
-
Wider adoption – Support in consoles and standard game engines will drive mass market adoption.
-
Mobile ray tracing – Dedicated ray tracing on mobile chips will bring limited effects to phones and tablets.
-
Cloud gaming – Game streaming could allow ray tracing on any device by using server-side GPU power.
-
Cinematic quality – Ray tracing will keep closing the gap to offline rendered CGI movie quality.
-
Simulation uses – Ray tracing has applications beyond just visual rendering that could be explored more.
Ray tracing is a pivotal advancement that still has much room for growth and innovation. It’s an exciting time for 3D graphics!
Conclusion
In summary, ray tracing revolutionizes real-time rendering by simulating the real-world behavior of light. This unlocks vastly more realistic lighting effects for games. Dedicated GPU hardware in the last few years has finally made ray tracing possible in consumer gaming.
While still early, ray tracing is rapidly evolving to become an integral part of next-generation game graphics. It represents a huge leap towards photorealism. Ray tracing sets the new gold standard for 3D graphics going forward.