Archi's Academy

GetStarted

GetStarted
Get in touch

Computer Graphics

Ray Tracing is a graphic rendering method that draws an image of a scene by considering how light moves in the real world. However, in this method, the processes follow the opposite path in the real world. In the real world, light rays emerge from a light source and illuminate objects.

According to Nvidia, the most commonly used ray tracing algorithm is BVH (Bounding Volume Hierarchy) Traversal. It uses the DirectX Raytracing API and accelerates Nvidia's RT cores. Optimizing the calculation of the intersection of rays and polygons is critical. When we consider a scene with hundreds of objects, we have thousands of potential polygons and we try to calculate which polygons the ray intersects. This normally creates a search problem and takes a very long time. BVH, on the other hand, speeds up this process by creating a tree of objects in which each object is enclosed in a box.

For example, when we consider a rabbit model, the BVH box first contains the entire rabbit. The calculation of the rays crossing this box is made. If there is no intersecting beam, no further processing is done for this box. When there is an interrupting beam, the BVH algorithm examines the smaller boxes inside the interrupted box. This process continues until the desired point is reached.

Despite its complexity, today's movies often use ray tracing and produce high-detail computer images. A 90-minute movie shot at 60 frames per second requires 324,000 frames, and each frame requires hours of computer processing. It is not possible to capture this with a single GPU in games. So you can't get the resolution and quality you see in a Hollywood movie - at least not for now.

HOW IT WORKS

REFLECTION

Ray Tracing 2.jpg

Previous mirroring and reflection techniques, such as Screen Space Reflections (SSR), had a number of disadvantages. These techniques could not show objects that were not in the frame, or partially show what was. Since the shadows created using Ray Tracing are created in the three-dimensional world, smooth reflections can be obtained without being limited to what appears on the screen.

SHADOWS

Ray Tracing 3.jpg

It is possible to use multiple approaches with Ray Tracing for shadows as well as reflections. Shadows created with ray tracing require a ray emanating from a light source for each pixel on the surface. If the ray intersects an object before it reaches the surface, that pixel will be darker. The distance to the light source, the brightness and color of the light are also included in the calculation.

Ray Tracing offers developers many tools to manipulate shadows. There are also techniques that are more complex than the one just mentioned, but close to real world perception. For example, below, you can see the shadow difference created by Ray Tracing for the Shadow of the Tomb Raider game.

Ray Tracing 4.jpg

AMBIENT LIGHTING

Ray Tracing 5.png

Ambient lighting is a very special category of shadow graphics rendering. It serves to reproduce the grayish shadows we see in corners, crevices, and small areas in and around objects. It is obtained by sending very short and many light into a region and a cloud around it. The intersection with surrounding objects is also calculated. The greater the intersection is, the darker areas are obtained more. Actually this method does not consume much resources because beams are only tested for local objects and BVH trees are smaller and easier to process.

When you think of simple shadows and reflections, you might question how the concept of Ray Tracing is creating the future of graphics processing. However, in reality, the correct modeling of light is very important in imitating the real world. Light plays a critical role in shaping our perceptions in the real world. Although this is a difficult problem to solve, Ray Tracing is a big step towards realistic gaming.

Here’s the link that NVIDIA made a video about real time ray tracing.

That was all about Ray Tracing, drop a like and share it if you found it informative.

Goodbye have a nice day!

archis-trainee

Emre Kaan Bahçeci

Wednesday, Oct 20, 2021