Winter plans: Real-Time Raytraced Pacman

As part of the raytracer I wrote for my CS488 (graphics) course, I rendered a pacman scene. This was fun enough that I’ve decided one of my projects over this next work term will be to try and write a real-time raytraced pacman clone, almost certainly using CUDA. I haven’t used CUDA before, so I’ll undoubtedly end up learning a lot. The goal will be to be able to render it at 30FPS on my laptop, which has a NVidia 8500 as a graphics card. I don’t know how feasible this is, but I can try.

While my raytracer had a few performance enhancements, it still took about three minutes to render my final scene. Clearly, this isn’t nearly fast enough, and I don’t think I’ll be able to get anywhere close to necessary on my CPU; an order of magnitude *may* be possible, but certainly not three. The natural solution is to try using the GPU; CUDA seems to be the most popular way of doing this, and I’ve wanted to learn it for a while.

A few additional things I’m going to have to add to my raytracer while porting it to CUDA:
CSG and better KD-Trees, for one. I didn’t end up implementing constructive solid geometry at all, although I have a pretty good idea of how to do that. Unfortunately, it’s going to require a decent amount of refactoring of my raytracer; currently, my Intersection objects only store one intersection point; this will have to change to store ranges of points. I may not have to end up doing this, depending on how much it helps; I’d probably only end up using it to render Pacman, who was a polygon I created using CSG in blender for my project.

The other main optimization I’ll probably have to make is to improve my KD-Trees. I used a good traversal algorithm for my project (Havran’s T_REC_B from his thesis, if you were wondering). However, I use the naive median tree-splitting algorithm instead of implementing SAH. Implementing a correct tree for a scene as complex as a Pac-Man level will probably give me enough of a performance boost that I’ll want to do this properly.

Those are my current concrete plans; I probably won’t be able to work on it very much for the next week or so due to finals, but I may be able to get started. If you know of any good resources, or have any advice, please let me know.

Leave a Reply