Ray tracing as a rendering method has long been a tool only for film production, but with the advent of new high-performance graphics chips, the game industry is now undergoing a significant leap in terms of realism, thanks to the implementation of this technology in modern games.
What is ray tracing or ray tracing?
Ray tracing is a method of rendering in video games that allows you to simulate the reflection of light from objects as accurately as possible, which creates more realistic reflections, shadows and lighting effects.
The first time about the research of ray tracing and artificial intelligence and their application in the visualization of graphics began in the 80s of last century. However, the problem was the lack of computing power of processors at that time. It took decades for video chips such as NVIDIA’s Turing to close this gap and bring the ideas of the past to life.
How it works
In reality, everything in our field of view is essentially the result of light hitting the objects we see. The varying degrees of absorption, reflection, and refraction of light by these objects form a picture to the human eye.
Ray tracing is actually the reverse process, as the name itself indicates: it is a computer-assisted method of creating an image by “tracing” the path of light from an imaginary eye or camera to the objects in that image.
The ray-tracing algorithm takes into account both the type of material and the light source. For example, two basketballs of the same color will not look the same if one is made of leather and the other of rubber, because the light will interact with them differently. Objects in the path of any light rays will cast shadows. In addition, a transparent or translucent substance, such as glass or water, will refract light.
To understand the ray-tracing method, let us imagine the grid in the diagram as a computer monitor. To visualize a scene from a modern video game, the computer displays the game’s three-dimensional virtual world on a two-dimensional plane, the monitor. In doing so, the computer must determine the color for each pixel on the screen.
The process begins by projecting one or more rays from the observer’s side and checking to see if the rays intersect triangles – the components of virtual objects in computer graphics. If the rays do fall into a triangle, the algorithm uses data such as the color of the triangle and its distance from the observer to calculate the result – the color of the pixel.
In addition, you can reflect from or that passes through the triangle rays. This creates more and more rays, which also need to take into account. The more such rays, the higher the quality of the image, but also requires more computing resources.
How to enable ray tracing in the game?
One of the first games to support ray tracing was the computer indie game Minecraft.
On its example, consider how to enable or disable ray tracing in the game settings.
- Launch the game through the Microsoft Store by clicking the Play button;
- Click on Marketplace in the Minecraft main menu;Click on the magnifying glass in the search bar and type “RTX”;
- Choose any of Nvidia’s official RTX packages and install it;
- Go back to the main menu and click “Play.”
- Click “Create” and select one of the RTX World templates;
- Once loaded, press ESC and go to “Settings” and “Video”;
- Scroll down the page and make sure the slider next to “Ray Tracing” is active.
Depending on the video card model, the default ray tracing rendering distance may be less than 24. Change this setting as desired to change the ray tracing distance and find a balance between graphics quality and frame rate.
What improvements does raytracing bring?
Rendering methods used in the past, such as Screen Space Reflections (SSR), had some shortcomings – this is primarily the inability to display objects that are not at a given moment in the frame. Raiting, on the other hand, takes into account the entire three-dimensional world, thereby providing the most accurate reflections possible.
Due to the lack of reflectivity of some surfaces, the effect is often not so noticeable, but it is resource-intensive. For the task of raytracing on the reflections required at least one beam per reflecting pixel.
Along with the drawing of reflections, there are a number of techniques for modeling shadows by raytracing methods. To understand how the image forms, it is enough to imagine the outgoing beam in the direction of the light source. If the outgoing beam hits the surface of the object, before it reaches the light source, such a pixel must acquire a darker shade. The calculations take into account both the distance to the light source and the brightness and color temperature.
Raytracing is also capable of realistically casting shadows through transparent surfaces, such as fabrics of all kinds. These calculations result in softer, more accurate shadows with complex unstructured penumbra.
The shading model replicates the grayish shadows observed in corners, crevices, and small places in and around objects. The algorithm works by observing a number of short rays within one area and checking them for intersections with nearby objects – the more such intersections, the darker the area will be.
Ray tracing opens the possibility to visualize the result of reflection and refraction of light reflected from curved surfaces. Caustics calculates similarly to conventional reflections. The method reduces to the fact that rays generates, places of their interaction with the highlighted surface, and reflections and refractions are drawn.
Although 2D caustics does not require much computing power, 3D caustics can already put a significant load on the graphics card.
Illumination rendering is the most important yet most resource-intensive part of ray tracing. During operation, the algorithm rays pixel by pixel over the entire scene and monitors all transformations to account for even the slightest changes in lighting.
Raiting on NVIDIA and AMD graphics cards
NVIDIA. To support the rendering method, NVIDIA RTX 20-series graphics cards are equipped with a special hardware solution designed for ray tracing. NVIDIA’s Turing architecture on 20-series GPUs uses RT cores along with NVIDIA’s CUDA and Tensor cores. RT cores dedicates exclusively to real-time ray tracing.
Dedicated RT cores in the RTX 20-series GPUs might at first glance seem more suited to provide raytracing, but the performance of such a solution has proven to be insufficient. Even the latest generation 2080Ti card was not able to support raytracing games at launch.
The new RTX 3080 and 3090 GPUs have advanced RT cores, resulting in significant performance gains. Not only are these cards faster than their last-generation counterparts – the new RT cores also outperform their predecessors.
AMD. Over the past few years, AMD has been trying to provide hardware-accelerated ray tracing in its products, which resulted in the release of RX 6800, 6800 XT and 6900 XT series graphics cards. These new GPUs support DirectX 12 ray tracing and provide excellent performance, though AMD is still behind NVIDIA in ray tracing.
In addition, the Big Navy architecture on which the AMD RX 6000 cards run was pretty much the first ray tracing-enabled solution. This same architecture powers the visual effects in the Play Station 5 and Xbox Series X. This delivers an overall lower level of performance than NVIDIA’s flagship cards.
However, since ray tracing is still a feature of next-generation consoles, significant improvements in support and optimization expects for the near future with the arrival of AMD FidelityFX Super Resolution (FSR) for gaming PCs as well as the latest versions of Microsoft Xbox.
Advantages and disadvantages of raytracing
Ray tracing is quickly becoming the preferred method of rendering. One of the advantages of ray tracing is that it is a more realistic rendering mode. Many physically correct phenomena can easily be simulated using ray tracing because the algorithm simulates the movement of light in the real world.
- This is largely due to the considerable advantages of this method:
- Support for rendering smooth objects directly without an auxiliary polygonal approximation;
- The possibility of parallel ray tracing, which significantly speeds up the calculations;
- The complexity of the scene in the three-dimensional world is less correlates with the complexity of calculations.
- On the other hand, still a huge disadvantage of ray tracing method is its speed, which affects the performance in games. To this day, ray tracers are still quite slow. In this area, a lot of work on paralleling and various kinds of optimization, but the computing power of equipment plays a much bigger role in the speed of rendering than possible software solutions to this problem. For performance reasons, most 3D applications use a hybrid of ray tracing and line scan rendering engines.
Is ray tracing the future of game graphics?
Real-time ray tracing in video games is in its infancy. NVIDIA RTX graphics cards are currently the only consumer GPUs to offer hardware support for this technology, so the number of games using this feature is small.
However, as more and more manufacturers begin to adopt rarescreening technology, realism in video games could eventually reach a completely new level. It is likely that over time AMD will catch up with its competitor in raytracing, creating a solid foundation for game developers and a compelling reason to create games that support raytracing features. In turn, from a perspective of even 5-10 years, this promises future games to reach an unprecedented level of realism