• Advertisement
Sign in to follow this  

seperating transformation and object in scene graph

This topic is 4256 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In my graphics engine, I currently have a transformation node which consists of a bunch of matrices (should probably reduce it to 1) and a pointer to a scene graph node. The transformation node is also a scene graph node. I'm just wondering how many people have actually seperated these two things, as I know that a lot of people just include the transformation stuff inside the base class of the scene graph node. Is there really any benefit to having them seperate? Or is there really no point in keeping them this way?

Share this post


Link to post
Share on other sites
Advertisement
I suppose there could be a point, depending on the details of your actual implementation. Generally though, since a scene graph is usually a spatial organization structure, it makes sense to have spatial information in every node (e.g., transformation matrix in the base node class). Otherwise you're just going to have every node pointing to a transformation node that exists somewhere else and create more work for yourself maintaining that link between two pieces of data that should really be just one.

I could see it being split to allow "sharing" of transformation data (all sibling nodes at a given point in the tree share the same transformation) but, in practice, I'm not sure its worth the extra effort as having multiple objects/node in exactly the same position is not a particularly common case, and if one of those objects ever moves, you've got more work to do.

Share this post


Link to post
Share on other sites
I personnaly would have both. One pure transformation matrix, which simply transforms all its children (can be usefull in an editor to move a subtree without modifying each nodes) And all the other nodes that can have a transformation would have their own matrix.

For example, every trimesh node would also have their own world matrices, and if I want to group 3 trimesh nodes, I simply add a transformation node, and link the 3 trimeshes to it. This way, I only have 4 nodes, instead of 7 in your case (if I understood correctly how you do it)

Share this post


Link to post
Share on other sites
It's worth keeping all shapes in a flat array, and then use specific transform nodes to place those objects. The simple reason is that it would allow for instancing of geometry objects.

Consider instancing a geometry object twice. You'd need 2 transforms, and an object. You could include a matrix within the object structure, but what's the point? You'd still need two seperate transform nodes, and the objects matrix would become redundant (ie, it'd need to be the identity matrix for the instancing to work).

Share this post


Link to post
Share on other sites
As I said : why use only one approach when both can coexist in a perfect way ?
Simply have a "shape node" with no transform, and you can then instanciate this one without transformation redundancy, and a "transformed shape node" when you don't need it. And of course, a simple "transform node".

The point is in a big scene you can have a lot of time spent in traversing the scenegraph. So, for all the geometry nodes that aren't instanciated, it can be worth having the transformation directly in the node to avoid another level in the tree.

But as I said, the best solution (in my opinion) is to have both approaches available.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement