Rendering design. How can I effectively deal with forward, deferred and transparent rendering?

Posted by user1423893 on Programmers See other posts from Programmers or by user1423893
Published on 2012-10-07T23:26:40Z Indexed on 2012/10/08 15:52 UTC
Read the original article Hit count: 224

Filed under:
|

I have many objects in my game world that all derive from one base class.

Each object will have different materials and will therefore be required to be drawn using various rendering techniques.

I currently use the following order for rendering my objects.

  • Deferred
  • Forward
  • Transparent (order independent)

Each object has a rendering flag that denotes which one of the above methods should be used.

The list of base objects in the scene are then iterated through and added to separate lists of deferred, forward or transparent objects based on their rendering flag value.

The individual lists are then iterated through and drawn using the order above. Each list is cleared at the end of the frame.

This methods works fairly well but it requires different draw methods for each material type.

For example each object will require the following methods in order to be compatible with the possible flag settings.

object.DrawDeferred()
object.DrawForward()
object.DrawTransparent()

It is also hard to see where methods outside of materials, such as rendering shadow maps, would fit using this "flag & method" design.

object.DrawShadow()

I was hoping that someone may have some suggestions for improving this rendering process, possibly making it more generic and less verbose?

© Programmers or respective owner

Related posts about c#

Related posts about design