Ray Tracing

Technology — James William Steven Parker

Ray Tracing is a computer graphics technique that models image formation by tracing mathematical rays through a scene and calculating their interactions with objects. A conventional ray-tracing algorithm commonly starts with rays associated with pixels or camera samples, determines which scene surface each ray intersects first, and then evaluates the contribution of light and material interactions at that location. Additional rays can represent shadows, reflections, refractions or indirect illumination.

The method is particularly powerful because optical relationships can be expressed naturally through geometric intersection tests and recursive or iterative ray paths. The term can describe simple ray-casting systems as well as sophisticated physically based path-tracing systems, so not every implementation of Ray Tracing produces physically realistic lighting. Its importance comes from providing a flexible framework for visibility and light transport that can reproduce effects that are difficult to obtain efficiently with purely raster-based methods.

The mathematical basis of Ray Tracing involves representing a ray by an origin and direction and determining where that ray intersects geometric primitives. For a simple ray, a point along its path can be represented mathematically as an origin plus a scalar multiple of the direction vector. A renderer tests the ray against scene geometry and selects the closest valid intersection in the direction of travel.

Efficient implementations cannot simply test every ray against every object because scenes may contain millions of primitives and images may require millions or billions of rays. Spatial acceleration structures such as bounding volume hierarchies organise geometry into hierarchical regions so that large portions of the scene can be rejected without testing every primitive. Other acceleration structures can partition space differently, but the general objective is to reduce unnecessary intersection calculations.

Ray Tracing can simulate several important optical phenomena by generating secondary rays from surface intersections. A reflection ray follows the direction obtained from reflecting the incoming direction around the surface normal, while a transmission or refraction ray follows a direction determined by the material's optical properties and the relative refractive indices of the media. Shadow rays can test whether a light source is directly visible from a surface point, allowing opaque objects to cast shadows.

Multiple generations of secondary rays can represent increasingly complex indirect interactions, although the computational cost rises rapidly as the number of paths expands. Recursive formulations historically described these interactions as calls that generate additional rays, while modern implementations often use iterative path-management systems better suited to massively parallel hardware.

Path tracing is a closely related but more comprehensive form of Ray Tracing that estimates the rendering equation by sampling possible paths through a scene. Instead of evaluating only selected direct effects, a path tracer can allow light to bounce between surfaces repeatedly, producing global illumination, indirect shadows, colour bleeding and other physically plausible phenomena. Because the solution is estimated statistically, path-traced images can contain Monte Carlo noise when insufficient samples are used.

Increasing the number of samples generally reduces variance, while importance sampling attempts to spend more computation on paths that are likely to contribute significantly to the final result. Multiple importance sampling can combine different sampling strategies to improve efficiency. Modern physically based renderers therefore use Ray Tracing not merely as a visibility algorithm but as a framework for estimating complex light transport.

Ray Tracing has historically been associated with offline rendering because tracing large numbers of rays was computationally expensive. Advances in CPUs, GPUs and dedicated ray-intersection hardware have made interactive Ray Tracing increasingly practical. Modern graphics processors can accelerate common ray-tracing operations while traditional rasterisation remains useful for other portions of the pipeline.

Hybrid renderers may therefore rasterise primary visibility and use rays selectively for reflections, shadows or global illumination, or they may trace most visibility while retaining raster techniques for particular effects. Real-time performance still depends heavily on scene complexity, resolution, ray count, material complexity, denoising and acceleration-structure quality. Hardware acceleration does not make Ray Tracing computationally free; it changes the practical balance between image quality and rendering time.

Ray Tracing provides visual effects that can be difficult to approximate with conventional raster techniques. Reflections can naturally show objects that are not directly visible in the camera view, such as geometry reflected from behind the viewer or around corners of reflective surfaces. Transparent materials can produce physically motivated refraction, while soft shadows can be estimated by sampling different positions across an area light.

Global illumination can create indirect colour transfer between surfaces, such as a strongly coloured wall influencing nearby diffuse illumination. However, the realism of these effects depends on the underlying material models, light sources, geometry and sampling strategy. Ray Tracing is therefore not synonymous with photorealism; poor assets, inaccurate materials or insufficient samples can still produce unrealistic results.

Ray Tracing has applications in film production, product visualisation, architectural rendering, scientific imaging, games and other graphics-intensive fields. Offline path tracing is widely useful when a production can afford substantial computation per frame and needs accurate lighting relationships. Interactive applications benefit when ray-based reflections, shadows or illumination substantially improve visual quality while maintaining acceptable frame rates. Ray Tracing can also support computational imaging and simulation tasks in which rays represent physical trajectories rather than merely visual camera paths.

Its advantages include a coherent treatment of visibility, reflections, refractions and indirect transport and a strong conceptual relationship to geometric optics. Its disadvantages include computational expense, memory and acceleration-structure requirements, sampling noise in stochastic methods and the need for denoising or approximation in time-constrained applications.

Ray Tracing is frequently confused with rendering as a whole, but it is a rendering technique rather than a synonym for rendering. It is also frequently equated with path tracing, although path tracing is a particular class of stochastic ray-based rendering rather than the only possible form. Ray-casting can trace rays to determine visibility without recursively simulating full illumination, while more advanced systems can follow extensive light paths.

Another misconception is that more rays always guarantee a visibly better image; sample placement, importance sampling, reconstruction and scene complexity all influence quality. Ray Tracing has become increasingly significant because hardware and algorithms have reduced its historical performance barriers, but rasterisation remains highly relevant, particularly where deterministic real-time performance and extremely high throughput are priorities.