Archived

This topic is now archived and is closed to further replies.

marijnh

Material/state sorting for scene-graph-like scenes

Recommended Posts

My problem is the following: I have a scene that is divided into entities, where each entity has a location and orientation (rotation), and might have sub-entities with their own location and orientation relative to their parent. I am trying to implement a sorted renderlist so that all things with a specific texture or a specific state (lighting, blending, etc) get drawn in a batch (to reduce state switching). This does complicate the matrix management considerably, or rather, makes it less efficient because instead of going down a node in the tree and rendering all of it in the correct place by incrementally adjusting the modelview matrix, I now have to store an absolute matrix for every entity so that I can draw it outside of its tree context (and there are *lots* of little objects in my scenes, think leaves on trees). Question is - is this really more efficient than switing texture and state a lot? I have not been able to compare the performance of both schemes yet because I am too lazy to implement the new scheme before someone assures me that it will really help. On a related note: What would be more efficient - calculating my own transformation matrices for each object and uploading them to openGL, or going through the tree from the root up for each object using openGL's matrix functions? I'm guessing the first is better since i can still exploit the tree structure of the data when calculating the matrices (that happens while normally traversing the tree, at the sorting pass)... [edited by - marijnh on March 21, 2004 1:32:16 PM]

Share this post


Link to post
Share on other sites