Pen and paper: next-gen design tools
Add comment!January 5th, 2009
When designing algorithms for 3D rendering, it's often tricky for me to visualize what I'm doing. I find that if I stop for a few seconds and sketch the idea out using pen and paper, it helps understand how it all fits together. There are all sorts of computer programs that let you make charts and outlines really efficiently, but for graphics tech, nothing beats drawing on paper. This is an example of some of the scribbling I did today while optimizing the ray-traced terrain shadows.
The shadows are cached, so the player never waits for them to calculate anyway, but it's important to streamline the map creation process as well! The basic idea is that I wanted rays cast from each terrain texel to take advantage of the information we already have from previous raycasts. This worked, but only cut the shadow calculation time from 22 seconds to 16 seconds for the 2048*2048 terrain. That wasn't enough, so I used OpenMP to parallelize it, and now it takes only 6 seconds on my quad-core. That's a pretty big improvement!
Next I will try calculating the shadows on the GPU: ideally I would like all the static object shadows to update in real-time in the editor, even though they're all pre-calculated when actually playing.