Ray Tracing is a method of calculating optics used in computer science. In 3D computer graphics, ray tracing is a light transport modeling technique used to generate digital images.
In nature, light starts from a source, bounces off objects and ends up in the eye, which sees the objects. Light can be reflected, refracted, diffused or absorbed. In a 3D universe, ray tracing consists of going the opposite way. Rays start from the camera (the “eye” of 3D computer graphics), bounce off objects and travel back to the light source. Thus, only the rays seen by the camera are calculated, saving resources.
Table of Contents
The idea behind ray tracing dates back several centuries, and its invention is attributed to German artist Albrecht Dürer and his perspective machine.
The first use of a computer dates back to 1968. But it was the work of Turner Whitted in the 1970s that later allowed computer-generated imagery to be true-to-life through ray tracing. Requiring significant computing power, it is only recently that we have seen this technology appear on game consoles or PC graphics cards.
What is ray tracing used for?
Ray tracing makes the brightness of a 3D computer graphics more logical, more realistic. It’s a way to physically simulate light. Ray tracing is used in many creative fields that use computers.
In video games
In video games, ray tracing allows the complex behavior of live light to be calculated faithfully and automatically. A video game then seems more beautiful and more realistic. It is notably used by next-generation console games.
Here is an example of a very old and famous video game “Minecraft”. You can see the difference between a picture of an active ray tracing feature and a picture without ray tracing feature base game.
Ray tracing can be used to add effects such as reflection and shading, which are often difficult and time-consuming for traditional artists to produce. It is also able to render photorealistic images.
Architects today use ray tracing to create lifelike renderings. Some programs allow you to modify this light. For example, the light in a room can be simulated at different times of the day.
In theater and cinema
Ray tracing can be used by film and theater directors, set and lighting designers to create intricate lighting before a production begins.
Ray tracing is used by mechanical engineers, lighting designers and solar energy researchers to predict illuminance levels, luminance gradients and visual performance criteria. This makes it possible to analyze the distribution and directionality of light and to study the transfer of heat by radiation. It is especially useful for aerospace applications.
How does ray tracing work?
Ray tracing is a particularly complex algorithm. It builds an image by extending rays into a scene and bouncing them off surfaces and toward light sources.
It relies on a realistic simulation of light transport, compared to other rendering methods, such as rasterization, which focuses more on realistic simulation of geometry than on that of light, requiring the addition of various effects of light.
Reflection, refraction and shadow effects are instead a natural result of ray tracing.
The primary ray from the camera reconstructs the image. When a ray hits a surface, secondary rays can be projected depending on the type of the surface (called recursive tracing):
- a ray of reflection strikes the nearest object so that it can be seen;
- a refractive ray passes through a transparent material and deflects;
- a ray of shadow traced to each light source is used to determine whether a surface receives light from a source or shadow from an intermediate object.
Other technologies are used in addition to ray tracing, such as denoising or photon mapping.