Sunday, August 29, 2010

Deferred Rendering Done!



Just a quick update - finally finished the deferred rendering system for Battle Balloons! Guerilla Games has a good presentation for Killzone 2 on the theory behind it - but mine is not as advanced. Not much to show as it's pretty much all under-the-hood at the moment. But this excites me because I no longer need to worry about how to limit the number of lights in the game - they can now be practically unlimited. I went with a fairly simple approach:
  1. the scene normals are rendered in RGB as-is (if it's good enough precision for Insomniac Games' Resistance 2, then it's good enough for me!),
  2. pixel world position is derived from the 2D screen co-ordinates and depth buffer value, and
  3. lighting happens in two stages: a spherical mesh is first rendered for each light onto the stencil buffer and the light shading is then calculated for each pixel not masked out by the stencil.
In the process of doing so I also removed all legacy, fixed-functionality OpenGL code. Everything is now pretty-much OpenGL ES v2.0 compliant. Now with this out of the way, it is on to adding networking support; the last, major, technical hurdle for this project! :)