RT Cores: What They Are and How They Work on a GPU for Ray Tracing

RT Cores are a piece of hardware that NVIDIA implemented from the RTX 2000 series of graphics cards , and its main job is to speed up Ray Tracing , but at the same time it is almost as efficient as it is mysterious. What is this piece of hardware and how does it work? What advantages does it bring? We explain it to you quickly and easily.

The work of the RT Cores is very simple, they are in charge of calculating the intersection that occurs between the rays and the objects in the scene, but this definition is too simple to explain the entire process that this piece of hardware performs. But before we move on to talking about the RT Cores, let’s start at the beginning.

RT Cores

What is Ray Tracing?

Ray Tracing is a technology that bases its operation on the tracing of light rays in a scene based on the objects in it.

RayTracingBase

The first rays that are executed are the so-called Primary Rays (primary rays) or better known as “Eye Rays” or “Camera Rays”; These serve to check the visibility of the scene, that is, which objects are visible from the camera’s point of view (the user’s point of view). The problem with this is that the most primitive form of the algorithm forces us to have to shoot a ray from the camera towards each of the pixels in the scene, which is highly inefficient, which is why much simpler mechanisms are used.

Bounding Volume Hierarchy, scene optimization

The best thing is to organize the geometry of the scene in a spatial data structure that will help us to speed up the process, the one most used today being the so-called Bounding Volume Hierarchy or BVH.

The idea is to have a three-dimensional map of how the geometry is organized in the scene in the current frame:

BVH

Which is organized in the form of a tree:

Bounding Volume Hierarchy tree

The objects marked with numbers are the boxes that contain other boxes and the triangles that make up the 3D geometry of the scene. Triangles are always at the last level of the binary tree. In the example they are marked with letters to better identify them and differentiate them from the boxes.

The BVH of the scene is created taking into account the position of the objects with respect to the camera, however, other BVH can be created in relation to the indirect rays, product of the bouncing of the light on an object. In that case, another BVH will be created in which the BVH will be reorganized taking the object that creates the indirect ray as the point of origin.

RT Cores functionality

Once we have defined the BVH we can define what the RT Core is: a type of unit in charge of traversing the BVH tree continuously, traversing all the different paths in the tree to give an answer to each of them. .

RT Core Esquema

So that you can visualize it better, taking the tree above as an example, the paths that the RT Core would travel would be the following:

  • 1 → 3 → a
  • 1 → 3 → b
  • 1 → 3 → c
  • 1 → 2 → 4 → d
  • 1 → 2 → 4 → e
  • 1 → 2 → 5 → f
  • 1 → 2 → 5 → g

However, depending on the type of node of the tree in which the RT Core is located when navigating the scene, depending on whether it is a box or a primitive, an intersection calculation or another will be applied. That is why RT Cores have two types of units to calculate the intersection: one for the boxes, which is much simpler, and another for the primitives.

RT Core NVIDIA

Actually, for ray tracing, only the intersection between the ray and the primitive / object matters, since the boxes are only a way to organize the geometry of the scene. It is precisely the intersection with ray / primitive that will inform the type of intersection that the ray has produced with the object and what type of Shader will be executed to manipulate the visual properties of the object, although it is true that this is not the work of RT Core , since it simply informs if there is an intersection or not and in what way, so its work is limited to that task.