Rendering Games with Raytracing

PC Perspective has an excellent article entitled Rendering Games with Raytracing Will Revolutionize Graphics that goes through some of the progress made on real-time ray tracing engines and what the future might hold, at least according to Intel. If you don't know what ray tracing is, the Wikipedia has the dirt as usual.

Ray tracing has always been interesting to me. For one thing it's how "real" rendering works so whenever you render something in Maya or 3D Studio MAX you're most likely seeing ray tracing at work. Ever since reading

[Black Art of 3D Game Programming][1] way back in my youth (nearly a decade ago now) I always wondered why ray tracing wasn't being put into games. The answer was, of course, that the performance is terrible. From the sounds of the article this is slowly becoming a non-issue.

The other obvious question then is that, if ray tracing scales so well on multi-core processors, then wouldn't dedicated hardware such as, I don't know, a GPU allow for real-time rendering? Modern GPUs are essentially hugely parallel processing systems and it seems rendering billions of rays per second with dedicated hardware would be a lot faster and free up the CPU for doing more important things. I haven't heard anything about AMD, NVIDIA or even Intel thinking about adding ray tracing to their GPUs. The closest thing I've heard is a thing called SaarCOR which seems to be designed as an architecture for creating real-time ray tracing hardware. The latest news on the site is from 2005 though so I don't have a lot of hope for them. Back in 2004 the following progress had been made:

Video and images are rendered in realtime on the SaarCOR Prototype FPGA implementation running at 90 MHz.

This small prototype with only one rendering pipeline achieves already realtime frame rates of 15 to 60 fps in 512×384 and 32 bit colour depth and between 5 to 15 fps at 1024×768 in our benchmark scenes as presented on this page. Thus the prototype with on 90 MHz already achieves the performance of the highly optimized OpenRT software ray tracer on a (virtual) Pentium-4 with 8 to 12 GHz!

See here for more info. What this tells me is that dedicated hardware really is capable, already, of performing real-time ray tracing. The aforementioned prototype had a single pipeline running at 90MHz but a modern GPU typically has at least 8 pipelines running at speeds around 500MHz, with high-end cards hitting 32 pipelines and around 700MHz. What kind of frame rates would be possible using that kind of hardware? Seeing as ray tracing seems to scale almost linearly with the number of CPU cores, I'd apply a similar reasoning here and say that speeds of 200 fps at 1024×768 should be possible. If ray tracing scales well with the number of pixels as well, which is seems to do, then even larger displays with 1920×1200 resolutions should run at good speeds (~60 fps).

Of course, this is all purely guesswork on my part but I don't think I'm that far off on my estimates. So why don't we have this hardware? I'd fathom the reason is simply that it'd be too expensive for the graphics chip makers to attempt to come up with a completely new architecture for ray tracing that also has to accommodate the existing rasterisation architectures and capabilities.

In terms of software, I think being able to use high performance ray tracing when building a graphics engine would be a dream come true. Suddenly things that require lots of tricks, techniques and black magic to achieve, such as shadows and reflections, are handled completely automatically by the ray tracing system. All you'd have to do is define the meshes and the materials to be placed upon them along with the lights and cameras (and action?) and almost everything else would be taken care of. Advanced effects would have to be programmed into the pipeline but I don't see many of those being needed often as currently most games are just trying to achieve as much realism as possible in their graphics.

The PC Perspective article also has some information about how anti-aliasing and texture filtering can be efficiently achieved through ray tracing. Collision detection can also be done via ray tracing as the maths is essentially the same.

There is an existing project called OpenRT that aims to provide an API, similar to OpenGL, for interfacing with low-level ray tracing hardware and software which could be used by game developers. I'm a bit dubious about this though since they're not really "open" in the sense of using open source software but that's not really all that different from OpenGL. What we need is an open source implementation so that more people can start playing around with the API. One is already in progress and we'll have to wait and see how successful it becomes.

Overall, I'd say the future looks bright for the use of ray tracing in games but we need to start seeing real commitment from GPU makers to start implementing the functionality. Running on CPUs is alright in the short term for experimentation and development but it's not very viable in the long run.

[1]: http://www.amazon.com/gp/product/1571690042?ie=UTF8&tag=chrisnortonso-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=1571690042