Have you ever watched a movie from Pixar or DreamWorks and wondered if we will ever get video games with graphics that look as good as the visuals in those films? Or perhaps you have watched a cutscene in a video game and wondered why the game’s graphics noticeably drop in quality when the scene is over? Microsoft has been working to address this gap in visual quality. Today at GDC they announced an entirely new API to use with DirectX 12 which could lead to the most realistic video game graphics we have ever seen. The API is called DXR which stands for DirectX Raytracing.
In order to understand why DXR is a big deal, it is necessary to understand how video game graphics work today. Don’t worry – this will not be an overly technical article.
If you were to play a 3D video game produced within the last twenty years and let your character stand still for a minute, you will see an in-game environment that was probably produced with a process known as rasterization. This process uses triangle shapes to construct everything from your character, NPCs, vehicles, buildings and any other three-dimensional model on the screen. These tiny triangles are given textures and illuminated with light sources carefully placed in the game by developers. This scene within your game is drawn by starting with the farthest objects in the back and then objects closer to your position are added in. For the sake of comparison, imagine that you want to draw a nice image of a lighthouse with the ocean behind it. You might start with the ocean in the background and then add in waves that appear a bit closer. Then you add some land for the lighthouse to stand on and finally, the lighthouse itself is added to the foreground. Rasterization prioritizes graphics in a similar order.
Rasterization has worked rather well over the years and a number of techniques help make the process suitable for video games. If a game were to use that image of the lighthouse, the ocean and sky behind the lighthouse would not be rendered at all – if we can’t see it then why bother using system resources to render it?
The problem is that rasterization can never produce truly realistic graphics because we do not see objects in the real world the same way it is shown within a game. An object may be outside of our field of view but it can still impact the lighting around you. You might stand with a skyscraper directly behind you and sure, the building is not within your field of view but it may still cast a shadow over the area you are standing in. Rasterization does not account for changes in lighting from objects that are not rendered in the scene. Rasterization is also poor at creating reflected light. Try shining a bright flashlight at a piece of blue paper and reflect the light onto a white wall. You will see a bluish tinge on the wall thanks to that light bouncing off the paper.
That’s because in the real world photons from the sun, a flashlight, a streetlamp or any light source bounce over objects within an area and are reflected into your eyes. This is where raytracing and DXR comes in. This process more closely replicates real world vision by causing in-game light sources to bounce off of the 3D models in the environment. The result is more realistic shadows, lighting and color.
Raytracing is commonly used in movies, television shows and even video game cut scenes but actual gameplay segments rely on rasterization. That is because raytracing is an extremely resource intensive process and video games would essentially be unplayable because a single frame would take a long time to render – let alone thirty or sixty frames within a single second.
The DXR API will currently allow developers to use limited amounts of raytracing in scenes that were produced with rasterization to create more realistic shadows and light reflections. In time the API can be used to add increasinged amounts of raytracing and we may even see some video games that entirely use raytracing to produce unprecedented realistic lighting.
It may be a while before we see the benefits of DXR – a year or so for games with limited tracing. The good news is that these games will run on hardware that is already available on the market. Three or four years from now we may see noticeably better graphics in our video games thanks to DXR.
The DXR API is currently supported by the SEED and Frostbite engines from EA, Unreal Engine, Unity and 3DMark.