Glossary

Ray Tracing

What is Ray Tracing?

Often described as the ‘holy grail’ of computer graphics, ray tracing is where a 3D scene is generated using a technique that mimics how light behaves in the real world. This has two main benefits. It provides developers with the tools to make incredibly realistic visuals, such as reflections and shadows, and it simplifies the workflow for the developers.

With rasterisation, accurate lighting can only be “faked”, with developers placing artificial light sources into a scene, which has limitations in terms of realism. A scene might be over-lit, and surfaces in a scene cannot respond to lighting realistically. Additionally, traditional lighting techniques only work inside screen space. For example, an object outside of screen space, will not appear in a reflected surface that is on screen and therefore viewable to the viewer. Equally, creating realistic soft contact shadows via traditional means involves complex shader processing, but with ray tracing, these are created naturally and dynamically, without any need to precompute them.

Ideally, a 3D scene would be lit entirely by ray tracing for the greatest realism. However, ray tracing is computationally very expensive, even on the latest hardware, which is a huge challenge when trying to create a game running at 30, or even, 60 frames per second. Instead, current mainstream games are constructed using hybrid ray tracing, where the main geometry of the scene is constructed using traditional rasterisation, and certain elements, such as reflections and shadows, are ray traced.

In this method, sometimes known as “backwards ray tracing”, rays are cast from the viewer or ‘camera’, into the scene and when it hits surfaces it is then traced back to the light source. If the light cannot reach the light source it doesn’t need to be calculated, vastly reducing computational complexity. Power-efficient ray tracing has arrived on desktop PCs, and it is making its way to mobile devices too.