Maximum PC

DirectX Ray Tracing: the Quest for the Holy Grail

- Jarred Walton Jarred Walton has been a PC and gaming enthusiast for over 30 years.

THE NEXT GENERATION of Microsoft’s DirectX API, DirectX Raytracing (DXR), is intended to bridge the gap between rasterizat­ion and ray tracing, allowing for new and increasing­ly realistic renderings. But what exactly is ray tracing, and why do we need it?

The holy grail of computer graphics has been figuring out how to create a perfect rendition of the world around us. Imagine trying model the way the world appears to your eyes. Photons bounce around, emitted from light sources such as the sun, light bulbs, our monitors, or are reflected off other objects. These photons reach the receptors in our eyes, and our brain interprets all of this as an image.

The problem with modeling this is that it all happens on an analog level. Photons are always being emitted, at different rates and wavelength­s. A single light bulb emits around 2 x 1020 photons per second—never mind the sun. Simulating every photon bouncing around the world is impractica­l, and we need something else: ray tracing.

Ray tracing flips the model around and only simulates the photons that would hit a surface— your eye or, in this case, a flat display. Reversepro­ject a path from each pixel of your display into an environmen­t model, then calculate the final color of each pixel based on reflection, refraction, texture, and absorption properties of the materials. This gives you a decent approximat­ion of the physically modeled view of the environmen­t. The problem is that doing this requires a lot of calculatio­ns. The latest Pixar movies are rendered on hundreds of computers, and it still take hours to generate each frame. Games, meanwhile, try to render in real time, at 60fps or more. That’s just a bit faster than six hours per frame.

Games do this by approximat­ing graphics in a process known as rasterizat­ion. It uses 3D models and textures, with various methods of calculatin­g lighting and colors, to create a 2D representa­tion of a 3D environmen­t. It’s generally fast and works well enough, with games becoming increasing­ly realistic every year. Now rasterizat­ion has started using complex techniques such as screen space reflection­s, global illuminati­on, environmen­t mapping, and more.

If the end goal is to get the best approximat­ion of the way things look in the real world, we circle back to ray tracing. Microsoft’s DXR builds on the compute capabiliti­es of the DX12 API, without requiring new hardware, to create a new model for data and graphics. It’s a computatio­nal workload, which is possible now that our GPUs have replaced most fixed function units with general-purpose gear running shader programs.

DXR doesn’t mean we’re going to suddenly start playing fully raytraced games, however. Ray tracing is more computatio­nally intensive than rasterizat­ion, but it allows for new rendering techniques that improve image quality. DXR gives developers a way to shift things like screen space reflection­s and true global illuminati­on to the new API, with better results and less effort.

Ray tracing isn’t a crazy idea that game developers don’t want and will never use. If real-time ray tracing becomes possible without a major performanc­e hit, game developers will investigat­e its uses. Instead of spending resources generating shadowmaps and calculatin­g hacks to simulate the way things should look, ray tracing does the heavy lifting, allowing the artists to focus their energies on creating a great model of their world, and letting the engine do the rendering.

As proof of the interest in DXR, EA, Epic, Unity, and others are already working with it, and early GDC demos show promise. Nvidia has also created Ray Tracing for Gameworks ( RTX) built on DXR, promising enhanced performanc­e on Volta graphics chips. That suggests new GeForce cards with enhancemen­ts for RTX may be near.

We won’t see an immediate transition to ray tracing—GPUs still need to be supported—but we should start seeing forms of it used to improve image fidelity quite soon.

 ??  ??
 ??  ??

Newspapers in English

Newspapers from United States