With Nvidia’s RTX 2000 series graphics cards, ‘ray tracing technology’ entered our lives, but today the cards that support this technology are not limited to RTX only. It is worth noting that GTX graphics cards also partially support this technology. So what is RTX and Ray Tracing? Before answering this question, let’s take a look at how lighting and shadows work in games without Ray Tracing.
Creation of Game Graphics
Creating a virtual simulation of a properly functioning and visible world is a complex process. Let’s leave the laws of gravity and physics aside and think about what the world looks like. The unlimited light beam spreading around, their reflections on the surfaces and their passage through the objects are shaped according to the molecular properties of each object. It is currently not possible to solve such an infinite resource with the processing power of computers. That’s why today’s graphics renderers have developed different approaches.
Polygons, and in particular triangles, are often used in the process called pixelation. Games use millions of polygons, and the pixelation process transforms all this data into two-dimensional frames to be displayed on the screen.
In this process, which includes intense mathematics, the screen ratio of each polygon is determined. A single triangle can cover the entire screen or just a few pixels. When pixels are decided, textures and lighting are also applied. Over the years, hardware and techniques have made the pixelation process faster, and modern games have millions of visible polygons. Moreover, they are processed at incredible speeds.
The appearance of objects has become more realistic with shadow maps, soft shadows, ambient lighting and more graphic techniques. Although billions of calculations are required for each frame, modern GPUs can perform trillions of calculations per second. But despite all this, the lighting and shadows in the games do not move according to the objects. This is where Ray Tracing comes in, bringing real lighting and shadow support to games.
What is Ray Tracing?
Ray Tracing is a technique used in three-dimensional computer graphics to create images by tracing the path of light as pixels on an image plane and simulating the effects of its encounter with virtual objects. RTX, on the other hand, is the name NVIDIA gives to the Ray Tracing technology used in its graphics cards.
The ray tracing approach was first introduced by Turner Whitted in 1979. Turner; explained how to calculate impressive images, including shadows, reflections, and more. That’s why Turner currently works in Nvidia’s research unit. The most important problem of the Ray Tracing method was that it needed more complex operations than pixelation.
In short, Ray Tracing is the process of simulating the lighting in games to the real world, the lighting provided by sunlight. A single light source illuminates the world. Other lights and shadows are created from reflections and shadows from this source. The logic of Ray Tracing is to make the graphics as realistic as possible by calculating the path of the lights, their reflection and the shadow and lighting ratio it creates accordingly.
Hybrid Graphics Processing
Computer hardware has been trying to make the pixelation process faster for more than 20 years, and game designers are seeing good results. But decent lighting, shadows and reflections still pose problems.
Hybrid graphics processing uses traditional pixelation technologies to render polygons in a frame and combines the results with Ray Tracing where needed. Ray Tracing becomes less complex and allows high FPS values. However, the balance between performance and quality never disappears.
Let’s review specific techniques to better understand how ray tracing works and the reason for computational complexity.
Reflections
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.
For Battlefield 5, it was intended to create reflections using ray tracing. An attempt was made to create a reflection that should appear using one ray per pixel when the frame is graphically rendered. However, most surfaces were not reflective, and this brought an overload. The optimized Battlefield 5 algorithm, on the other hand, calculates the required rays only for reflecting surfaces and uses one beam for two pixels on semi-reflecting surfaces.
Shadows
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.
There are many light sources. Different light sources behave differently, from small light sources such as candles or light bulbs that emit light in one direction, to spotlights and neon signs. Ray Tracing allows shadows to be formed more accurately in a softer and more complex range.
Ambient Lighting
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 rays into a region and a cloud around it. The intersection with surrounding objects is also calculated. The greater the intersection, the darker areas are obtained. 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.
Caustic
Caustic is the effect caused by the reflection or reflection of light from curved surfaces. An example of this is the light beam formed by the light reflected from a glass of water at noon on a bright day.
The caustic effect is calculated similarly to standard reflections. Rays are generated and beams interacting with a surface are recorded. Reflections and refractions are also created accordingly. While the superficial caustic effect does not require much processing power, the volumetric caustic effect can require a lot of computation.
Universal Lighting with Ray Tracing
The ray tracing technique that requires the highest processing power is universal lighting and it serves to adapt to even minor changes in light by spreading the rays for each pixel throughout the entire scene. The concept of universal lighting is more about indirect lighting.
For example, imagine opening a sliding window in a dark room. The opening of the window will not only illuminate a rectangular area on the wall or floor, but will also brighten the entire room. The universal lighting feature emits a complex beam of rays and creates additional beams to illuminate a scene.
The Future of Ray Tracing Graphics World
Big names in graphics processing like Epic and Unreal Engine, Unity 3D, Frostbite started using Ray Tracing technique. Microsoft has also teamed up with hardware companies and software developers to create an entirely new DirectX Ray Tracing API on top of the DirectX 12 architecture.
While Nvidia’s RTX 2000 series GPUs were the first Ray Tracing-accelerated hardware available to end users, Ampere GPUs took Ray Tracing performance to a much higher level. Although it is very difficult to predict where this will lead, we see that AMD is joining this caravan with the RX 6000 series. Cards that come with RX 6800, 6800 XT and 6900 XT Ray Tracing support. The company will continue to use RT technology in its RDNA3 architecture.
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.