Parallel Real Time Ray Tracing

 

Excecutable (21.5Mb)       Progress blog


This was my fourth year Honours project for university. It took a very long time and a huge amount of effort to complete but I'm pleased to say that all aspects of the work done towards it achieved an A. The full and complete dissertation is here for anyone who might want a gander. For now I'll post up an abstract, explain a little more and leave a few screen-shots and a video.

Abstract


The graphical abilities of computer games continue to advance as the industry grows. Given the advent of multiple core home computers, interest around ray tracing as a viable algorithm for rendering games has seen a recent surge. While ray tracing may not be able to match the combined graphical capabilities and speed of rasterisation today, it may soon be a contender and even a possible successor, given its ability to adapt to parallel processing. This project investigates the feasibility of ray tracing as a real time rendering algorithm and investigates how it might benefit from parallel processing, while keeping a focus on computer games. A multi-threaded ray tracing engine is built to examine the potential apparent in three different parallelisation techniques and comparative results are obtained from experimental data. The results show that overall, tile based screen space partitioning proves the best method for concurrent rendering, providing near perfect linear scaling across available cores. This serves as proof that advances in software and hardware (particularly of a parallel nature) might be the key to real time ray traced games in the future.


Basically...


My aim was to figure out whether or not, through the use of multiple core computers and advances in technology, Ray Traced computer games might come about. After a whole load of research I wrote a ray tracing engine that could render 3D scenes with triangle meshes, custom materials, point lighting, shadows, anti-aliasing, ambient occlusion, depth of field and a bunch of other things interactively (through the use of a keyboard and mouse first person camera). To answer my research question,

“Can parallelisation techniques allow ray tracing to become a feasible rendering algorithm for future computer games?”

I built into it the ability to split the rendering task over any number of threads (synonymous with cores, if certain rules are followed) with three different multithreading techniques:

  • Pixel Cyclic (each core renders every nth pixel)
  • Split Screen (each core renders an equal, large portion of the screen)
  • Tile Based (each core renders a number of small tiles throughout the screen)

These methods are shown below. Red, blue, green and yellow colours are assigned to individual threads to show work distribution.

These methods were compared under strict test conditions over three scenes and the tile based method was found to give the best scaling at around 3.91x over 4 cores and the split screen method being the worst.

Throw into this an attempt at vectorising the engine to use SIMD extensions, giving the ability to trace four rays at once, some spatial partitioning algorithms and a lot of graphs and mathematics, you have my complete honours project. For reasons that might be obvious, my source code isn't available to download. If you would like to see it, please email me and I'd be glad to send it to you