FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Future idea: possible scenegraph?

 
Post new topic   Reply to topic     Forum Index -> Blaze
View previous topic :: View next topic  
Author Message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Tue Feb 17, 2009 12:11 am    Post subject: Future idea: possible scenegraph? Reply with quote

This may be good to think about for the future, possibly implementing a scenegraph system into Blaze?

Perhaps you can convince Erin Catto over at box2d.org to implement it, or if it seems easy do it yourself.

However, a scenegraph is not the easiest task, and it has the possibility to make the whole project too complex.

I think a scenegraph would be really helpful if it was implemented directly into blaze and allow for Parent + Child nodes + rotation + translation and handling all the calculations needed to accomplish this correctly.

I think scenegraph would be more appropriate being directly built-in to a physics engine than it would be to use as an 'add-on,' since scenegraph deals with the position , rotation, and translation of a given group of objects.

If it can be pulled off, great! I myself don't need this feature anytime soon, but if I do I may try to help out with it myself. Maybe even allowing invisible 'key points' that blaze keeps track of within itself would also be a good idea, so these points can be placed anywhere on an object and would rotate and translate with objects. An example would be placing such a key point on an object and use it as a weapon firing point, or a point to place a lighting effect or particle effect on, while the physics engine will keep track of its position on a given object automatically.

~ Clay
Back to top
View user's profile Send private message AIM Address
SirAlaran



Joined: 19 Feb 2007
Posts: 84
Location: Silicon Valley

PostPosted: Tue Feb 17, 2009 11:07 am    Post subject: Reply with quote

Bodies already keep track of the rotation and translation of their child geometric shapes, so I don't think this would actually be that bad. The code's probably already there, cleverly disguised as something else.

I'll look into this.
_________________
Current projects: Project Fermitas, Arctographer tile map editor, Arclib game library.
Gentoo | Textadept
Back to top
View user's profile Send private message
zzzzrrr



Joined: 17 Feb 2007
Posts: 139
Location: Washington, DC

PostPosted: Tue Feb 17, 2009 7:07 pm    Post subject: Graph Reply with quote

SirAlaran wrote:
Bodies already keep track of the rotation and translation of their child geometric shapes, so I don't think this would actually be that bad. The code's probably already there, cleverly disguised as something else.
I'll look into this.


Box2D / Blaze uses an island system whereby groups of colliding contacts are connected via a contact graph. The sequential impulse solver traverses the graph and applies an impulse to all connected objects in the island.

Is this what you refer to as a scenegraph? If so, it's implemented via. a linked list.
Back to top
View user's profile Send private message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Wed Feb 18, 2009 12:43 pm    Post subject: Reply with quote

It's similar but not quite a scenegraph system.

A scenegraph system would have a tree structure, and would allow for parents with multiple child nodes.

Code:

Parent
  --> Child1
  --> Child2
     --> Childs child
        --> Childs child child
     --> Childs child2


When the parent rotates and moves, all children would rotate and move with the parent. When the child rotates, all children's children would rotate and move with the child.

I may have to think some more if a scenegraph would be appropriate in a physics engine... it may not be. It's usually used for graphics, but the graphics + physics are closely coupled.
Back to top
View user's profile Send private message AIM Address
zzzzrrr



Joined: 17 Feb 2007
Posts: 139
Location: Washington, DC

PostPosted: Fri Mar 06, 2009 11:12 pm    Post subject: Scenegraph Reply with quote

clayasaurus wrote:
A scenegraph system would have a tree structure, and would allow for parents with multiple child nodes.


Do you have any good references? From the definition on Wikipedia, the concept is a little vague. Can you give me specific examples of what a scene graph is used for?

To me, it sounds a little bit like many of the methods employed in broad phase collision detection, and in particular a quadtree:
http://en.wikipedia.org/wiki/Quadtree

If this is what you're referring to, I know where to find a fairly good version that can be ported from Action Script...
Back to top
View user's profile Send private message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Mon Mar 09, 2009 11:20 am    Post subject: Reply with quote

A quadtree is used to speed up collision detection.

A scenegraph would be used to represent a 'scene' in graphics. The parent scene would be composed of the entire scene, where the children in the scene would be represented as objects (rocks, trees, vehicles). Each child may also have children (vehicle tire, vehicle windshield, etc.). Each node keeps track of its own rotation + translation. If the car rotates 90 degrees, all its children will be rotated 90 degrees as well. If the car moves, all its children (tires, windows) will move with it.
Back to top
View user's profile Send private message AIM Address
Nthalk



Joined: 15 Jun 2008
Posts: 8

PostPosted: Fri Mar 20, 2009 10:48 am    Post subject: Reply with quote

Clay,

I think that the best one could hope for with combining a physics engine and a scenegraph is to isolate rigid bodies in the scene and register them with the physics engine independently, and have the phyiscs engine adjust the x,y,z,r and the dx,dy,dz,dr as things it sees fit.

A scenegraph is good for combining objects into rigid bodies that move in unison. A physics engine is good for independent, non-combined objects. Am I right?
Back to top
View user's profile Send private message
zzzzrrr



Joined: 17 Feb 2007
Posts: 139
Location: Washington, DC

PostPosted: Fri Mar 20, 2009 11:52 am    Post subject: Reply with quote

Nthalk wrote:
A scenegraph is good for combining objects into rigid bodies that move in unison. A physics engine is good for independent, non-combined objects. Am I right?


It really depends upon the physics engine. Box2D allows you to attach individual shapes to a rigid body, all of which move in unison along with the parent body's transform. You could build in additional complexity by adding a bounding volume hierarchy that compliments the broad phase collision detection, which as a whole would probably constitute a scene graph.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Blaze All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group