What is ray tracing?
Ray tracing is an advanced rendering technique that simulates the physical behavior of light by tracking individual light rays as they interact with surfaces, creating realistic reflections, shadows, and ambient lighting for significantly more authentic virtual environments.
How does ray tracing work?
Ray tracing works as a computationally intensive approach that calculates how light rays travel from sources through an environment, accounting for reflections, refractions, scattering, and absorption based on material properties and physical light behavior.
The technology enables true global illumination where light bounces between surfaces, color bleeding where bright objects tint nearby surfaces, and physically accurate caustics from light focusing through refractive materials.
While historically too demanding for real-time applications, recent hardware advances and hybrid rendering approaches have made ray tracing increasingly accessible for interactive experiences.
Unity's own High Definition Render Pipeline (HDRP) has supported ray tracing since Unity 2019.3. See Unity's guide to getting started with ray tracing in HDRP for setup and hardware requirements.
Ray tracing vs. rasterization
Unlike rasterization, which approximates lighting effects, ray tracing models actual light paths to produce physically accurate results. Shadows show proper penumbra, reflections capture the surrounding environment, and refractions correctly bend light through transparent materials.
Most modern implementations use a hybrid approach, applying ray tracing selectively to specific effects like reflections or ambient occlusion while relying on rasterization for everything else, balancing visual quality with performance.
How is ray tracing used?
Ray tracing is used across architectural visualization, product design, virtual production, and high-end gaming, wherever physically accurate lighting matters more than raw frame rate. In Unity, developers can enable ray-traced effects selectively in HDRP, including reflections, ambient occlusion, and global illumination, rather than switching an entire scene over at once. Unity's Reality vs. Illusion demo, built with NVIDIA and BMW, rendered a CG version of the 2019 BMW 8 Series Coupe that's visually indistinguishable from the real car.
What are the benefits of ray tracing?
- Physically accurate lighting: Reflections, shadows, and global illumination behave the way light actually does, not an approximation of it.
- Fewer manual workarounds: Artists spend less time faking effects like reflections and soft shadows that ray tracing produces naturally.
- Dynamic lighting changes for free: Since lighting is calculated per frame rather than pre-baked, scenes respond correctly when lights, time of day, or objects change.
What are the challenges of ray tracing?
- Real hardware requirements: Full ray tracing acceleration needs a GPU with dedicated ray tracing hardware, not every player's system qualifies.
- Measurable performance cost: Enabling ray tracing typically lowers frame rate, which is why most real-time applications apply it selectively rather than across an entire scene.
- More setup than rasterization: Configuring ray tracing correctly means additional project setup, like enabling the right graphics API and render pipeline settings.
Frequently asked questions (FAQ)
Does ray tracing reduce frame rate?
Yes, generally. Ray tracing is computationally intensive, and enabling it typically lowers frame rate compared to rasterization alone. Most real-time applications manage this by applying ray tracing only to specific effects, like reflections, rather than the entire scene.
Do you need special hardware to use ray tracing?
For real-time ray tracing, yes, you need a GPU with dedicated ray tracing hardware, such as an NVIDIA RTX or AMD RDNA2-based card. Ray tracing can still be used without this hardware for offline, non-real-time rendering, just much more slowly.