Sunday, 5 June 2011

A new (Deferred) Renderer [Part 1]

For a long time I have used SunBurn as my primary rendering solution. This helped a great deal while developing Needle Juice, Over Night and more recently: Project Sunburn. With no new game projects lined up with Core Engine, I have decided to experiment with my own rendering solution, based on Catalin’s Deferred Rendering sample along with information from many other sources including a Killzone 2 presentation from 2007.

The above images shows the most recent unit-test of filling the hardware DepthBuffer with the Gbuffer-depth to draw post-deferred geometry (i.e. using forward rendering for transparent surfaces) and other visuals such as vertex-lines. This is done during the final combining pass of the geometry data and lighting using the ‘DEPTH’ semantic. This fills the depth-buffer as all depth is lost after switching RenderTargets (something that can be prevented on the PC using PreserverContents, but does not work on the Xbox - this solves the problem entirely)

Some other experiments include texture projection as seen below.

Texture projection has several great uses, including Deferred Decals, light shapes and video projection on the scene's geometry (as seen in Splinter Cell: Conviction) Back while developing Over Night we used shadow-mapping in places where texture projection could have been much cheaper. A good example of this is the blue light coming from outside through the shaded window, covering most of the room as seen below. The second image uses a texture to simulate a similar effect, without having to re-draw the entire shadowmap every frame, instead simply sampling from the texture and projecting it into screen-space.

Looking back at Needle Juice, where we used a directional light with shadows to draw light coming through the windows, another place where texture projection would have been a cheaper and more elegant solution to our problem (also preventing light-leaking, which is very common with directional lighting)

Needle Juice: directional-light coming through the window, required shadow-mapping.

I will continue working on the renderer for the time to come, with such a wealth of presentations, papers and samples on deferred rendering (and graphics programming in general) it will keep me busy for a while…Until next time! :)


  1. This is all looking very cool! Are you considering releasing the core engine as a product at all? I've been following your progress with great admiration for your work! :)

  2. Thanks, I don't expect to release this as a product any time soon :) I might release some more components separately though, who knows. :)

  3. Awesome. I am actually going down this road now. I didn't hit a wall until I tried to create shadows as nice as sunburn's. I have been using many different types of shadow casting techniques with nice results but casting long distance shadows and creating a nice fall off (fading the shadow out) is where I've stumbled.

    I'll be following your progress. :)

    Speaking of progress I guess it's about time I update my blog too...

  4. Yep, shadows mapping can be quite complex, and there are just so many options available...

    I must say that currently only the most basic of features are supported by the renderer, but I've already learned so much in a short time about graphics programming in general - I don't regret taking this path at all.
    Maybe I'll post about some of the great resources I found on the topic of Deferred Rendering, there are quite a few :)

  5. But none of XNA ones supports all lights, some of them supports point and directional, but not spot or viceversa.

  6. Please post your references I am enjoying your progress btw

  7. Hi,

    Thanks for the feedback - I will try to list all references and sources in the next post :)

    The most important ones for the above post were:

  8. Interesting, but why switch away from Sunburn for this?

    Sunburn's deferred rendering uses the same scene information, and texture projection in it is trivial.

  9. Hi,

    Since I'm no longer actively working on a game project I wanted to learn more about graphics that's really the main reason to do this :) I'm still excited about all the things happening with SunBurn and if I had to start a game project tommorrow...I would definately use SunBurn for it.