Totally newbish question on scenegraphs, trees, etc..

Started by
21 comments, last by klajntib 20 years ago
quote:Original post by klajntib
In reply to Sander:
Ooops.. I seem to have missed Sanders last reply completely.. must get more sleep.


Yes you should, since you got my name wrong too

quote:What you are proposing is cool, but it kind of breakes the concept of a scenegraph, if my idea of it correct. Or I could be completely wrong


Not really - I was thinking that in the absence of any other kind of ''logical'' hierarchy, grouping by ''object type'' would be a good alternative in order to avoid having a wide, flat tree. Since objects of the same type aren''t necessarily spatially coherent, you could then break them up with some kind of spatial tree in order to make culling them all easier. However, I''m not so sure that that''s the best way to go now.

quote:
Root|-ships  |-carrier  |-smaller ship|-turrets  |-turrets (10x)|-planes.. etc  


Is this how you imagined it?


Not quite, as I said above I was thinking of hierarchy-by-type being useful in the absence of any other logical hierarchy, in order to avoid a scenegraph that''s stupidly wide and only a couple of levels deep.

Root|-ships  |-carrier     |-turrets (10x)     |-planes  |-smaller ship     |-turrets.. etc  


While this might work pretty well for static objects, I''m not so sure about the dynamic ones now. After all, should the planes be chidren of the carrier, children of the inevitable ''planes'' node, or both, or what?

In fact, I think with a bit of thought, you can probably find logical categories for these things, or at least, logical categories should develop as the game goes on. So you might end up with something like this:

Root|-fleet   |-convoy      |-carrier        |-turrets (10x)        |-air squadron           |-planes          |-smaller ship        |-turrets      |-submarines|-air squadron   |-planesetc. 

Advertisement
What the ..??!? How the hell did I manage to get your name wrong... I was looking at your post while COPYING your name! Must use copy/paste next time.

Your ideas on constructing the scene graph are very helpful.. now I just have to figure out exaclty how to do collision detection and culling efficiently along with it.

Lots of hard work to come.
Any other ideas are welcome!
quote:Original post by klajntib
And about sorting - what I''m having problems is the fact that if I apply transformations and draw everything as I traverse the scene graph, I have no way of sorting by texture and stuff... so I should traverse the scene graph and store world transformation matrices and compute other stuff (skeletal animation matrices and soforth) and then have another class (for example the renderer) go through all objects, sort them by shader for example and then draw them using the data previously computed by the scene graph traversal?


My mesh data structure "surfaces" which are groups of polygons, dots, patches etc. all with the same material (which contains texture data, alpha values, colours, shaders and stuff). When traversing all the visible mesh structures it''s really easy to split everything up by material. Currently the only reason I''m doing it is to separate out all the alpha blended surfaces so I can sort and render them last but the process seems to be quite useful for other reasons too.
[teamonkey] [blog] [tinyminions]

This topic is closed to new replies.

Advertisement