advice on my rendering system

Started by
0 comments, last by jkleinecke 17 years, 6 months ago
In the past, I've had a data structure that contains game objects, which point to their meshes. I then traverse the data structure and call render on each of the meshes. Right now I'm considering a new strategy, because I'm now using XNA which requires me to do everything with shaders, and I don't feel like passing the extra data needed to render with shaders. My new idea is traversing the data structure and adding the geometry to some sort of linked list. Then I just go through the list and do the render code for each. For some reason, I'm blanking on pros and cons. Are there any advantages to doing it one way vs the other? Other than separating my rendering code from the scene storage, I can't think of anything else. Thanks. -Nick
Advertisement
Most advanced render systems I know of use a render queue. To build the queue they traverse the scene graph (same as your data structure) and build a queue of all the meshes that need to be rendered. Then for performance reasons they sort the queue based on material and depth. With hardware z-culling it's better to render the closest objects first and then the ones furthest away.

Each material contains the render state the the device needs to be in and any shaders and textures that the object needs. Someone correct me if I'm wrong, but the idea is to minimize the number of changes between materials. A shader change is the most expensive, followed by a texture change, then followed by a render state change.

I think you are on the right path, research some more on scene graphs and render queues and I think you will come up with a good solution.
-----------------------------------Indium Studios, Inc.

This topic is closed to new replies.

Advertisement