Skip to content

What is Ray Tracing and how does it work?

  • by
  • 5 min read

Games are more realistic than ever before, and with every passing year, the gaming experience offered by top tier GPUs and consoles goes up exponentially. Although there are several reasons for this growth, the advancement in graphics rendering technologies has made the gaming industry what it is today.

Generating over 159 million dollars in 2020 alone, the gaming industry is huge. Companies are coming up with new technologies to offer higher resolutions at higher frame rates to target this huge market. Ray tracing is one such technology which is changing the way games are rendered.

Although ray tracing has been around for several years, its primary use was in animated movies’ computer-generated imagery. With the advancement in technology and artificial intelligence, this technology has made way to real-time applications like gaming, and the gaming community is going bonkers over it.

But, what is ray tracing  and what makes it so amazing? Well, if you find yourself asking the same question, this article is for you. In this article, we will be going over ray tracing and the trade-offs it brings.

Also read: How to use Manual mode for DSLR or Smartphone photography?

How are games rendered traditionally?

Before getting into ray tracing, it is essential to understand how games are rendered without ray tracing.

To render a 3D image on your screen, you need to send data from the CPU to the GPU. To perform this task, you need to create a bridge between the GPU and the CPU; this is done by an Application Programming Interface(API). In most cases, the open graphics library is used to set up this bridge. Once this bridge is set up and data is sent to the GPU, the render pipeline kicks in. To understand the rendering process, let’s look at how games are rendered.

What is Ray Tracing and how does it work? | Candid.Technology
  • 3D objects in the game are created using polygons(mostly triangles) and are plotted in a 3D space.  
  • The 3D objects are then mapped to a 2-dimensional plane using various techniques that consider the object’s position from the light source, the properties of the object, the orientation of the object in the 3D space and its position relative to the camera. 
  • This 2D image is then painted to render the game on the monitor

The process mentioned above takes into consideration the parameters which the developer mentions to render a game. It does not consider how light interacts with the objects in real life, making shadows and reflections look unnatural.  

Also read: How to use your laptop as a monitor for PS4?

What is ray tracing?  

Now that we have a brief idea of how the generic rendering pipeline works, we can look at what ray tracing is and how it works.  

In its entirety, ray tracing is a way of rendering 3D graphics with complex lighting conditions. This technique is used to reproduce lifelike shadows and  reflections in a virtual environment.  

As the name suggests, ray tracing traces the path of light beams to render an image. As there are billions of light rays in a scene, tracing every light beam in real-time is impossible. So to counter this problem, ray tracing uses the reciprocity principle of light. According to this principle,  the source of light and observation point can be switched to give the same result.

This means the observation point’s rays are traced to the light source rather than the other way around. Due to this, only those rays are traced, which can be seen by the viewer. This reduces the number of rays which need to be traced, but tracing light rays using this assumption is also computationally intensive. Thus, the newest Nvidia GPUs come with tensor cores designed to run AI algorithms with great efficiency.

In addition to this, the tensor cores are combined with advanced shader technologies enabling Nvidia GPUs to run ray tracing in real-time.

What is Ray Tracing and how does it work? | Candid.Technology
Source: Commons wikimedia

To understand ray tracing, think of it like this, rays of light are projected from the camera, and these rays hit the pixels on a 2D screen. These rays are projected to the 3D space, which defines the object’s properties, and after interacting with the object, it reaches the light source. After interacting with the object and reaching the light source, the ray of light has all the information required to render the scene, recreating realistic shadows and reflections.

Performance and ray tracing  

There is no doubt that ray tracing makes games look extremely realistic, but this realism comes at the cost of lower frames per second. That said, Nvidia uses technologies like Deep Learning Super Sampling (DLSS) to improve ray tracing performance. This technique renders a ray-traced frame at a lower resolution and then upscales it to higher resolutions using machine learning to offer a better gaming experience. 

Also read: What is Cache Partitioning? Does it hamper your privacy?

Nischay Khanna

Nischay Khanna

A tech enthusiast, driven by curiosity. A bibliophile who loves to travel. An Engineering graduate who loves to code and write about new technologies. Can't sustain without coffee. You can contact Nischay via email: nischaykhanna@pm.me

>