Ball Race – Days 8 and 9

I just couldn’t stop thinking how cool it would be if the walls of the maze would cast realistic shadows, so on Day 7, I began implementing stencil shadow volumes in my little game. Generating the silhouettes, something I was scared of, has been extremely easy since all you need to do is find all neighboring triangles in a mesh where one triangle is facing away from the light source and the other is facing towards the light source.

Generating quads for the silhouette edges wasn’t exactly difficult either after I already generated the entire maze geometry programmatically. However, I didn’t know what to do about the shadow caps, so I just left them be. This is not a problem because the camera will never enter a shadow volume and the caps will always be clipped by the Z buffer.

Screenshot of a programmatically generated maze with stencil shadows

Finally, it was time to start with the gameplay code. I still needed to a main menu, level selector, the game itself, maze/ball collision detection and some dummy physics to make the ball behave in a realistic manner.

If you’re wondering why this screenshot now shows a Windows Vista frame, this afternoon Windows XP self-destructed and took the whole partition with it. Forced to reinstall from scratch, I decided to check out Windows Vista RC2…