Graphics sub system

Nov 3, 2007 at 2:47 PM
Will the user be able to call 'graphicsSystem.DrawModels()' and 'graphicsSystem.DrawSprites()' in the main draw call of their game, or will it all go into the base draw method of QuickstartGame?

If we put it all into the QuickstartGame, then it may be difficult to make it very flexable. For example, how will the user draw all the models, then apply bloom, then draw sprites, then apply a colour correction shader?
Nov 3, 2007 at 3:20 PM
Ideally, a render queue will be set up in the renderer. So, instead of DrawX() methods, the renderer will expose methods for manipulating the render queue. Then, at render time, the renderer will internally iterate through the render queue and render the necessary models, sprites, etc.. This allows for shadowing, reflective surfaces, etc. all without the need for the client code to explicitly call render methods in the correct order. The renderer can also sort the render queue based on texture, shader, geometry, or however else to get maximum performance out of the current graphics hardware.

Ordering will also be done in the render queue by the renderer. There can be several "layers" to the render queue. So, all the world geometry will be on a layer, the post-processing can be on another, and the sprite overlays can be on yet another. The renderer will be smart enough to handle this.
Nov 3, 2007 at 11:59 PM
Is't rendering determined by the scenegraph and the rendering order set on the scene nodes? Similar to update?
Nov 4, 2007 at 2:41 AM
The scene graph can be used to build the render queue, but it still needs to be sorted according to material, model, etc. and rendered in an efficient manner. The scene graph is traversed spatially, not according to material, geometry, etc.
Nov 4, 2007 at 1:19 PM
I understand, but once the graph has been traversed spatially wouldn't the resulting queue be rendered according to DrawOrder, if you would would calculate the order based on material and geometry?
Nov 4, 2007 at 4:31 PM
It just depends on where you want the functionality. I don't see it being the scene manager's job to ultimately determine the exact render order. It shouldn't care how the renderer operates.
Nov 4, 2007 at 6:35 PM
The DrawOrder can be determined somewhere else, a delegate could be invoked to generate the value. This way the queue could simply be sorted once the queue has been filled.
Nov 4, 2007 at 6:53 PM
What's wrong with just having the renderer sort the data according to whatever is going to be efficient for the given hardware? There's going to be many passes in the renderer for one frame, and what gets drawn and how it gets drawn in each pass may be different. It makes more sense for the renderer to handle these differences than to have the scene manager know about the graphics hardware and how to do z-passes, reflection maps, refraction maps, etc.
Nov 4, 2007 at 7:10 PM
Nothing prob the right way to go, I'm just spawing ideas.