Re: [osg-users] modelling geodes with children?
Hi Cory, In my mind, I'm equating the thing with the thing's geometry. And so if something is attached to the thing, I want the data structure to mimic that. I can understand where you're coming from, but I think keeping things separate (at least conceptually) makes them more flexible. It's a matter of opinion, of course, as most design decisions are. :-) Think of the Transform node as being just a change in coordinate systems. I tend to picture the graph upside down, or at least read it going from the leaves to the root (instead of the opposite). The geometry itself is modeled in its local coordinate system (that's just the Geode), then it's transformed to place it where it should be relative to some other thing (that's just the Transform). And so on. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] modelling geodes with children?
Are you suggesting that my root would be a group node and under that would be all the leaf nodes? I don't like that idea because it loses the hierarchy: streamer is attached to grip, grip is attached to handlebar. If I delete the grip node, the streamer should go away as well. Well, I didn't really mean to forego the hierarchy and have a flat scene graph. If you really need the functionality of having the streamers disappear when you remove the grip, then by all means you should use hierarchy to achieve that. I could've implemented my HandNode using existing core functionality, but my client specifically wanted a Hand Node that they could reuse in many applications specifically for rendering a hand. If your HandlebarNode will be used in many apps to render handlebars (I don't know, maybe you intend to make a series of bicycle simulators), then yes, maybe it is best to encapsulate it in its own class. But if you are just using it as an example of some general hierarchical structure, then I doubt you want to create a new class for each unique piece of hierarchical geometry. Perhaps I'm not fully understanding your use case. -Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] modelling geodes with children?
On Wed, Feb 4, 2009 at 10:48 AM, Paul Martz pma...@skew-matrix.com wrote: If your HandlebarNode will be used in many apps to render handlebars (I don't know, maybe you intend to make a series of bicycle simulators), then yes, maybe it is best to encapsulate it in its own class. But if you are just using it as an example of some general hierarchical structure, then I doubt you want to create a new class for each unique piece of hierarchical geometry. Perhaps I'm not fully understanding your use case. My use case was just a fabricated example (and a poor one at that). I'm working on software for mechanical equipment and I was afraid using an example from the actual domain would have been mired down in domain specific terminology. We don't have a particular arrangement of components that would be repeated, but the equipment in general does have a natural hierarchical order to it (A is connected to B is connected to C etc...). I confessed to Jean-Sebastien that the source of this notion of all-in-one nodes was HOOPS - the first scene graph tool I investigated. I'm starting to come around to the OSG viewpoint though. Not that I dislike HOOPS- it's a fantastic piece of software. It's just a little overkill for what we need. -cr ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] modelling geodes with children?
Use Group nodes. One child is a Geode for the handlebars, the other children are the attachments. This doesn't seem clumsy to me, this seems clean and straightforward. If you want to derive your own class from Group that has a built-in Geode member variable, this is also an option, and useful in some cases. For example, I have a HandNode that derives from Transform and displays an articulatable hand model. The hand is a scene graph that is owned by the HandNode, but not exposed other than via an interface for articulating the fingers. Because HandNode is a Transform, you can add children, which are then transformed as the hand is transformed (position and orientation in space), useful for adding a text label or debugging/visualization aids. Traversing both the hand subgraph and the actual children is handled by overriding the traverse() method. However, I'd never do something like this for the general-purpose case you describe with the handlebars and attachments; just use off-the-shelf OSG for that and save yourself a code maintenance headache. Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com http://www.skew-matrix.com/ +1 303 859 9466 _ From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Cory Riddell Sent: Tuesday, February 03, 2009 1:09 PM To: OpenSceneGraph Users Subject: [osg-users] modelling geodes with children? I'm looking for advice on typical patterns when modeling something that has attachments (which may in turn have other attachments). I first looked for a node type that was a composition of Geode and Group but of course I didn't find anything. An example might help here. Say I want to model bicycle handlebars. Attached to the handlebar are grips, a light, and a bell. Attached to the grips are streamers. So, the handlebars have geometry and has children (grips, light, and bell). The light and bell have geometry, but no children. The grips though, have geometry and a child (the streamers). The streamers have geometry only. How could I model this? I thought about using a group node for any item that has both a geometry and children, but that seems clumsy (see the attached pic). I have a feeling that there is a simple solution that I'm just not seeing here. Cory ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] modelling geodes with children?
Are you suggesting that my root would be a group node and under that would be all the leaf nodes? I don't like that idea because it loses the hierarchy: streamer is attached to grip, grip is attached to handlebar. If I delete the grip node, the streamer should go away as well. Your HandNode example is very similar to what I'm talking about. The streamer location is relative to the grip. If the grip is moved, the streamer should maintain is relative position. In my original picture, I think all the group nodes are actually transform nodes. It seems like I really do want a Group node with geometry. I guess my choices are to do something like your HandNode (probably using object composition rather than inheritance) or pair every Geode with a Group node. Cory On Tue, Feb 3, 2009 at 3:46 PM, Paul Martz pma...@skew-matrix.com wrote: Use Group nodes. One child is a Geode for the handlebars, the other children are the attachments. This doesn't seem clumsy to me, this seems clean and straightforward. If you want to derive your own class from Group that has a built-in Geode member variable, this is also an option, and useful in some cases. For example, I have a HandNode that derives from Transform and displays an articulatable hand model. The hand is a scene graph that is owned by the HandNode, but not exposed other than via an interface for articulating the fingers. Because HandNode is a Transform, you can add children, which are then transformed as the hand is transformed (position and orientation in space), useful for adding a text label or debugging/visualization aids. Traversing both the hand subgraph and the actual children is handled by overriding the traverse() method. However, I'd never do something like this for the general-purpose case you describe with the handlebars and attachments; just use off-the-shelf OSG for that and save yourself a code maintenance headache. Paul Martz *Skew Matrix Software LLC* http://www.skew-matrix.com +1 303 859 9466 -- *From:* osg-users-boun...@lists.openscenegraph.org [mailto: osg-users-boun...@lists.openscenegraph.org] *On Behalf Of *Cory Riddell *Sent:* Tuesday, February 03, 2009 1:09 PM *To:* OpenSceneGraph Users *Subject:* [osg-users] modelling geodes with children? I'm looking for advice on typical patterns when modeling something that has attachments (which may in turn have other attachments). I first looked for a node type that was a composition of Geode and Group but of course I didn't find anything. An example might help here. Say I want to model bicycle handlebars. Attached to the handlebar are grips, a light, and a bell. Attached to the grips are streamers. So, the handlebars have geometry and has children (grips, light, and bell). The light and bell have geometry, but no children. The grips though, have geometry and a child (the streamers). The streamers have geometry only. How could I model this? I thought about using a group node for any item that has both a geometry and children, but that seems clumsy (see the attached pic). I have a feeling that there is a simple solution that I'm just not seeing here. Cory ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] modelling geodes with children?
Hi Cory, It seems like I really do want a Group node with geometry. I guess my choices are to do something like your HandNode (probably using object composition rather than inheritance) or pair every Geode with a Group node. I think the image you sent is a logical arrangement. A Group (or a Transform) does not itself have any geometry, it just specifies how it's children are arranged (in the case of a Transform). So yes, your groups in your image would actually be Transforms, and you would have one or many Geodes under that, and also more Transforms for the sub-objects. That's a very standard scene graph structure, used all the time, and very general/flexible. A Transform does not itself have any geometry, because its job is just to transform its children (whatever those children may be). I don't know why you think it's clumsy... Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] modelling geodes with children?
On Tue, Feb 3, 2009 at 4:43 PM, Jean-Sébastien Guay jean-sebastien.g...@cm-labs.com wrote: I think the image you sent is a logical arrangement. A Group (or a Transform) does not itself have any geometry, it just specifies how it's children are arranged (in the case of a Transform). So yes, your groups in your image would actually be Transforms, and you would have one or many Geodes under that, and also more Transforms for the sub-objects. That's a very standard scene graph structure, used all the time, and very general/flexible. A Transform does not itself have any geometry, because its job is just to transform its children (whatever those children may be). I don't know why you think it's clumsy... Perhaps the clumsy comment isn't fair. My first exposure to scene graphs was by reading about HOOPS and they support the idea of a geometry node having pointers to child nodes (they call them segments). You can get a pretty good idea of their model by reading this: http://developer.hoops3d.com/documentation/Hoops3DGS/prog_guide/01_2_database_dbase_structure.htmlhttp://developer.hoops3d.com/documentation/Hoops3DGS/prog_guide/01_2_database_dbase_structure.html In my mind, I'm equating the thing with the thing's geometry. And so if something is attached to the thing, I want the data structure to mimic that. Thanks for the advice. It definitely helps. Cory ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] modelling geodes with children?
I'm looking for advice on typical patterns when modeling something that has attachments (which may in turn have other attachments). I first looked for a node type that was a composition of Geode and Group but of course I didn't find anything. An example might help here. Say I want to model bicycle handlebars. Attached to the handlebar are grips, a light, and a bell. Attached to the grips are streamers. So, the handlebars have geometry and has children (grips, light, and bell). The light and bell have geometry, but no children. The grips though, have geometry and a child (the streamers). The streamers have geometry only. How could I model this? I thought about using a group node for any item that has both a geometry and children, but that seems clumsy (see the attached pic). I have a feeling that there is a simple solution that I'm just not seeing here. Cory attachment: handlebars.png___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org