Original Post
I am implementing a Scene Graph into my 3D engine. I understand how to get the culling benefits using a scene graph but am struggling with how to minimize Render State changes. My first thought was to have everything in the game rendered using Fx files. Each leaf in the scene graph would contain an UINT that represents an ID for a loaded/compiled Fx effect. The render call would traverse the tree in the normal manner and nodes that are to be rendered would be added to a list. The list would be ordered first based on the fx ID and secondly on texture IDs. The renderer would then traverse the list from front to back thereby grouping together objects that share render states. Additionally, two lists could be created one for opaqe and one for transparent objects so that the opaqe objects can be rendered first. Two questions: 1) Does this seem reasonable? How have others approached this issue. 2) What if I am not using fx files? I could create a structure, that contains all of the renderstate information (vertex shader, pixel shader, culling, alpha blending, etc) then assign these to each object based on an ID and follow the same procedure outlined above. Any suggestions are appreciated. Todd