Wednesday, February 22, 2012

Playing with Deferred Rendering in XNA

Deferred Rendering

I've been meaning to do a deferred rendering of my graphics pipeline for a while, but hadn't gotten around to it until recently.

In standard forward rendering, your geometry shaders directly output the image that the user sees. In deferred rendering, they output an intermediate buffer (called a "G-Buffer") that contains more information for each pixel - generally color, normal and depth. The advantage to this is that it allows you to do various processing (most notably lighting) on the scene as a whole after all of the geometry has been rendered.

The simplifies the shaders significantly. In Block Zombies, for example, I have three main geometry shaders - one for the terrain, one for models and one for particles. In forward rendering, each shader needs to independently handle lighting, fog and shadowing. With deferred rendering, they don't need to do any of this - it gets done once on the entire scene.

Another huge benefit is the ability to have more lights in the scene. Block Zombies only has a single, directional light source. I would have loved to have more lighting - muzzle flashes, glow from flares, flashes from explosions - but it just wasn't practical in the forward rendering model. With deferred rendering, I can have pretty much as may lights as I want.

In the screenshot above, I have a very subtle directional light, a spotlight from a flashlight and point lights for all of the windows in all of the houses.

Overall, moving to deferred rendering is a big win for me and I think I'll use it as my primary rendering model going forward.

Monday, February 20, 2012

"Quiet, Please!" Almost Finished

QuietPlease 

 I'm getting close to completion on my little adventure game, "Quiet, Please!". Above is an overview shot of the current gameplay area.

I'm aggressively trying to control the scope on this project - my goal is to keep development time under a month (time actually spent on it - not calendar time). So far, I'm in pretty good shape.

The resulting game will, as a consequence, be fairly short. Hopefully it will still be enough to convince people to part with one of their precious dollars. We'll see.