Re: [osg-users] Moving a model with NodeCallback

2014-09-23 Thread Chris Hidden
Hey, in case anyone was interested. This was definitely the problem.  For a 
beginner like me it was very unclear that 3ds files or other files did not 
import any of the rigging or bone heirarchy.  Especially considering there was 
a still an empty tree of matrixtransforms with the same names as what the bones 
should have been.

Now with a succesful installation of the FBX program I have working hand models 
that can be affected the way robertosfield () mentioned.   Thanks again for the 
tips! 

I now have a traverse class that goes through the hand model on load up and 
sets callbacks to the appropriate bones.  

/Cheers!

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61116#61116





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Moving a model with NodeCallback

2014-09-18 Thread Ulrich Hertlein
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Hi Chris, hi Mattias,

On 17/09/2014 20:19, Mattias Helsing wrote:
 Hi again, some more 2p I'm not an animator myself but I'm guessing the hand 
 model
 was rigged and skinned in 3ds max

That was my guess as well and a look at the converted lefthand.osgt confirms 
this, I
think.  I can find only two Geodes, HandsREAL_ and nailsFix2.

How skinning works is that there is a skeleton ('bones', made up of a hierarchy 
of
matrices) and a mesh, that is connected to and deformed by the skeleton.  This 
requires
additional information for each vertex to control how much it is influenced by 
a given
'bone' (e.g. a vertex in the left thumb will not be influenced by the bone for 
the left
pinky).

There is support for this in osgAnimation (the osganimationskinning example 
looks like a
starting point), but I don't know which loaders actually support this.

Hope this helps a bit.
Cheers,
/ulrich

- -- 
Fingerprint 0227 8EE1 2C64 8EF4 DA11 9864 FF16 0114 B9DA 3318

-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQEcBAEBCAAGBQJUGoFYAAoJEP8WARS52jMYwgEIAI/FRLnzUCoGIqvUZTmT3FeU
NDtxNc0evZn/ENOtl+f2UxyYptZ6ez0SU+P9FWNaIZyixzN6cOG/gCUlKH706Tun
Itdo2ZNG8ecXW+yPVOLa4tjxM3ATr8zo2jPxLk7tQtlagw8EF3PKy6N45amLB50K
1DZVnW17THXHFsOLNe8yGL+Ux3fNKW1I+8oZ6XNW3YXComLAq1ZsL/B842Nc3eDE
LwDbb53CrTDWerLuifXXtoljT2H2gr9X4dDJwu7aDh2u60OiV+TU4mSDxJF/O/5S
TFpehbQrn3Hr7EGnBk/4Lt9X3L+zbbLS+5V9aSSvJbHDo4T4NekoZ0NqTA4a9Ko=
=gz3B
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Moving a model with NodeCallback

2014-09-18 Thread Chris Hidden
Mattias! That makes so much sense with the results I was getting!

I am trying to rebuild with the FBX plugin enabled right now.  I noticed with 
CMake that the fields:  FBX LIBRARAY and FBX LIBRARY DEBUG can't find the right 
file.  (FBX_INCLUD_DIR is found automatically).

I did some looking around and read in my ReaderWriterFBX.h file that I need the 
FBX SDK v2013.3 or v2014.1. So I downloaded that and installed it.  Then I 
manually added the libfbxsdk.lib path to the FBX_LIBRARY field from the x64 
release folder in the vs2012 folder of the sdk.  Also added the libfbxsdk.lib 
path to the FBX_LIBRARY_DEBUG from the x64 debug folder in the vs2012 folder.  

I configure and generate successfully and then when I try to build the OSG I 
get the error Error   8   error C1189: #error :  Unsupported 
architecture!C:\Program Files\Autodesk\FBX\FBX 
SDK\2014.1\include\fbxsdk\core\base\fbxstring.h   41

Am I suppose to be linking a different lib or, what am I doing wrong?

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61072#61072





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Moving a model with NodeCallback

2014-09-17 Thread Robert Osfield
Hi Chris,

Rather than try and understand your approach it is probably best to say how
I'd tackle it.

First up I'd establish whether the hand API you are using generates
transforms for the finger joints relative to each each or relative to world
coordinates.  If the matrices are relative then you'll want to mirror the
transform structure provided by the API with the scene graph with nested
Transfroms with the hand geometry elements placed under the appropriate
leaf Transform.  If the matrices you get are relative to world coordinates
then use a flat group containing all the Transforms and then have the
individual bits of the geometry below the approach Transform.

Next up you'll want to pass your data from the hand API on each new frame
as part of the update traversal.  There various ways you can do this:

  1) Push the data to the scene graph in a single method that has a map
from the source matrix to the osg::MatrixTransform (or other transform
type) via an viewer Update Operation, or via a update NodeCallback attached
to the
 root node of the hand.

  2) Pull the data from the hand API via a series of update callbacks, each
attached to approach Transform.

Approach 2 is closest to your current method, the key difference is that
I'd create multiple callbacks each with set up with what matrix to pull
from the hand API, rather than have the callback work it out on the fly.
Using multiple callbacks will keep them simple and focus on the just the
task of pulling and applying the appropriate matrix.  The memory cost of
the callbacks will be negligible - we are only talking about something like
32 matrices+ associated callback in total, pretty trivial.

If you are building the scene graph via C++ then I'd suggest you build the
scene graph structure and apply the callbacks with the appropriate wiring
as you build it rather than post process with a custom NodeVisitor.

If you are creating your scene graph in a modelling tool then you'll need
to using naming or scene graph structure to allow you to determine the
mapping.  You current NodeVisitor uses this approach.

Setting the DataVariance on the Transform nodes will help tell the
osgUtil::Optimizer not to optimize away these Transforms as it does for
static Transform, but beyond this isn't used by the OSG. However, it is
still a good practice even if you don't use the osgUti::Optimizer.

And that's all there should be to it.  If you are struggling to get things
working I would start simple such as controlling the whole hand with a
single matrix and steadily add the full implementation.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Moving a model with NodeCallback

2014-09-17 Thread Chris Hidden
Hi Robert!

Thank you so much for taking the time to try and break down the approach for 
me.  Right now our API gives us the left hand and right hand positions in world 
coordinates.

So with this I have managed to get the hands moving around on the screen using 
a callback on the hand node. 

Similar to how you described it I use one method to pull the data from the api 
each frame and apply its world coordinate position to the node of the hand 
using a PositionAttitudeTransform and setPosition(). That works great!

Now, I am still very confused with the indiviual parts of the handmodel 
transforms.  I have not made the model.  I am using a model from LeapMotions 
SDK.  The model as mentioned is a hand.  I tried to attach the model with this 
post but I cant attach .3ds files.  Its available with leapmotions SDK.  Or via 
the Unity store as well I think, if you want to look at the model and how they 
have structured it.  

The naming convention is something that LeapMotion have implemented.  What I am 
unsure of is how to wire the right callbacks to each fingerpart.  

If I do run a nodeTraversal on the hand model, I get a large list of 
matrixTransforms.  The only geometry it finds are a nails_fix and a HandsReal ( 
Again LeapMotions naming conventions ).  

This makes me think, well ok I can move around matrices of the hand but the 
geometry always stays the same because whats telling it to look different?  
Then I though maybe the model was not right.  Im not sure.  

Also how do I attach a callback to different sub nodes of the hand model 
without traversing through it?  How do I access subnodes without knowing what 
they are?  

Also I am using c++ to establish the scene graph:


Code:

ref_ptrViewer viwer   = new Viewer();
ref_ptrGraphicsContext::Traits traits;
ref_ptrGraphicsContext gc;
ref_ptrCamera cam;

viwer-setUpViewInWindow(0, 0, desktop.right - desktop.left, desktop.bottom - 
desktop.top);


traits = new 
GraphicsContext::Traits(*(viwer-getCamera()-getGraphicsContext()-getTraits()));

traits-alpha   = true;
traits-doubleBuffer= true;
traits-blue= 8;
traits-red = 8;
traits-green   = 8;
traits-depth   = 24;
traits-windowDecoration = false;
gc = GraphicsContext::createGraphicsContext(traits.get());
cam = new Camera(*(viwer-getCamera()));

cam-setGraphicsContext(gc);
cam-setViewMatrixAsLookAt(Vec3d(0, -100, 0), Vec3d(0, 0, 0), Vec3d(0, 
0, 1));
cam-setClearColor(osg::Vec4(0., 0., 0., 0.));
cam-setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);


viwer-setCamera(cam.get());
viwer-setSceneData(root);

viwer-realize();

while (!viwer-done())
{
viwer-frame();
}

return 0;




What I can't understand still is just why I can read and access the 
osg::MatrixTransform casted object of the hand model.  I can even move them 
around with our in house API, as when I attach a visual to them they move 
around the screen, and yet the model does not ever change.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61061#61061





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Moving a model with NodeCallback

2014-09-17 Thread Robert Osfield
Hi Chris,

Too many questions for me to answer on my own.

I think it might be best for you to take a step back and learn a little
more about the basic of scene graphs, gain a bit of confidence with how to
create and manipulate the scene graph and then once you are a bit more
experienced then dive into solve the particular problem you have in front
of.  The problem is actually quite straight forward, I've given you some
pointers, but in the end you need more background knowledge to make sense
of it, this thread really isn't the appropriate place to attempt to teach
you everything about scene graphs.

There are 170 examples in the OpenSceneGraph distribution to learn from.
We have several books published that you can purchase.  There is docs
online.  There are over a decade of discussion here on osg-users
mailing/forum as a resource as well.

While it might all seem pretty daunting, you don't need to learn it all at
once.  If you want to learn about transforms then doing a search with the
OpenSceneGraph/examples for any reference to Transform would be a good
place to start.  Same applies to Callbacks.  One of examples that jumps out
at me as one place it might be worth looking at is the osgrobot example -
this has a nested hierarchy of transform and geometry.

Best of luck,
Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Moving a model with NodeCallback

2014-09-17 Thread Chris Hidden
Thanks agin for helping me with this.

While I am very new to all of this, I have spent the better part of the last 5 
weeks learning open scene graph.  I have a basic knowledge of a fair chunck of 
it I believe.  My problem is, is that I have gone through many of the examples, 
I have worked through the majority of the OpenSceneGraph for Beginners book and 
scoured the forums many a time. 

The osgrobot example is a good example, except it shows you how to assemble 
your own shapes and add them to global MatrixTransforms.  I suppose I could 
build a simple hand model of capsules and shapes as well and get them to 
function similarily. 

But why put the time into rebuilding a lower quality hand model when I already 
have one.  My problem is just that with the .3ds hand model I haven't built it 
myself and don't know the exact structure.  Also I am doing this for my company 
and I unfortunately have a time pressure over my head.  

In the osgRobot example, its very clear that we have a group of 
MatrixTransforms that have drawables as children to the MatrixTransforms.  So 
when a rotation is applied to the transform it is also applied to its children 
hence moving a part of the model.

The hand model is not made up of clear indivudal parts however.  If it is, I 
don't know how to access them.  I can traverse through the hands parts and see 
how its built and what parts have what names.  This doesn't help me understand 
how to manipulate its geometry though. 

For example the hand is made up of 5 fingers.  Each finger has 4 joints and an 
end aside from the thumb which has 3 joints and an end.  These joints and ends 
show up as MatrixTransforms when I call className() on them from a given Node 
in a traversal class.

Ex:


Code:

class TestTraverser : public osg::NodeVisitor
{
public:
TestTraverser() : NodeVisitor(TRAVERSE_ALL_CHILDREN), spaces(0){}

virtual void apply(osg::Node node)
{

OSG_NOTICE  std::string(spaces * 2, ' ')  Traverse Class.  
This node is a:   node.libraryName()  ::  node.className()   and 
has the associated name:   node.getName()  std::endl;

spaces++;
traverse(node);
spaces--;
}

protected:
int spaces;
};




For the Index finger I would get this output:

Traverse Class.  This node is a: osg::MatrixTransform and has the associated 
name: L_IndexA
  Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_IndexB
Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_IndexC
  Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_IndexD
Traverse Class.  This node is a: osg::MatrixTransform and has 
the associated name: L_IndexEND
  Traverse Class.  This node is a: osg::Geode and has the 
associated name: 
Traverse Class.  This node is a: osg::Geode and has the 
associated name: 
  Traverse Class.  This node is a: osg::Geode and has the 
associated name: 
Traverse Class.  This node is a: osg::Geode and has the associated 
name: 
  Traverse Class.  This node is a: osg::Geode and has the associated 
name: 

Notice how the Goeds don't have names.  I am assuming this because they don't 
need names when someone is modelling in a modeling program they worry only 
about labeling the joints.  The Geodes are actually just representations of the 
geometry that makes up a fingers appearence, correct?

So I can then grab say for example a single node and create a reference to it, 
something like:

   
osg::ref_ptrosg::MatrixTransform indexB = new osg::MatrixTransform;
if(node.getName() == L_IndexB)
indexB = node;   

Then in later on assuming indexB is global I can do
indexB-setMatrix(osg::Matrix::translate(1,0,0));
in an Update() method that runs every frame.


This should move the matrixTransform, and I would expect the finger to look 
weird on the screen when running the application.  Assuming B is the middle 
knuckle of the finger, the left index finger knuckle should be bowed out to the 
left.  But it never is.

So to make sure I was actually moving something I added an axes to all the 
MatrixTransforms.  Like in the osgrobot example where it shows axes arrows on 
each shape.   So then I could see all the matrixTransforms on my hand model 
because the axes are on there.  AND! I could now see that the axis that would 
normally be where the left index finger joint is now over to the left.  So the 
matrix is actually moved but the hand itself is visually unchanged.  

I can even do something like 
indexB-setMatrix(osg::Matrix::rotate(50, osg::Z_AXIS) * 
indexB-getMatrix());

And then the axes will spin around and around, but the finger never does.  What 
I don't understnad is why.  Thats whay I was hoping to get at.  

Also, because Im new my terminology 

Re: [osg-users] Moving a model with NodeCallback

2014-09-17 Thread Mattias Helsing
Hi Chris,
A quick look at your model (after converting it to .osg) shows that
the MatrixTransforms are there alright but there are no drawables
connected to them. Instead the 2 existing Geodes (each with 1
Geometry) are located in a separate node tree parallel to the
MatrixTransforms that you are trying to use. I suggest you do this:
export OSG_NOTIFY_LEVEL=INFO
export OSG_OPTIMIZER=OFF
osgconv lefthand.3ds lefthand.osg
...
osgconv will print lots of useful information and then you can inspect
lefthand.osg in your favourite text editor.

/Mattias

On Wed, Sep 17, 2014 at 4:15 PM, Chris Hidden ch...@erghis.com wrote:
 Thanks agin for helping me with this.

 While I am very new to all of this, I have spent the better part of the last 
 5 weeks learning open scene graph.  I have a basic knowledge of a fair chunck 
 of it I believe.  My problem is, is that I have gone through many of the 
 examples, I have worked through the majority of the OpenSceneGraph for 
 Beginners book and scoured the forums many a time.

 The osgrobot example is a good example, except it shows you how to assemble 
 your own shapes and add them to global MatrixTransforms.  I suppose I could 
 build a simple hand model of capsules and shapes as well and get them to 
 function similarily.

 But why put the time into rebuilding a lower quality hand model when I 
 already have one.  My problem is just that with the .3ds hand model I haven't 
 built it myself and don't know the exact structure.  Also I am doing this for 
 my company and I unfortunately have a time pressure over my head.

 In the osgRobot example, its very clear that we have a group of 
 MatrixTransforms that have drawables as children to the MatrixTransforms.  So 
 when a rotation is applied to the transform it is also applied to its 
 children hence moving a part of the model.

 The hand model is not made up of clear indivudal parts however.  If it is, I 
 don't know how to access them.  I can traverse through the hands parts and 
 see how its built and what parts have what names.  This doesn't help me 
 understand how to manipulate its geometry though.

 For example the hand is made up of 5 fingers.  Each finger has 4 joints and 
 an end aside from the thumb which has 3 joints and an end.  These joints and 
 ends show up as MatrixTransforms when I call className() on them from a given 
 Node in a traversal class.

 Ex:


 Code:

 class TestTraverser : public osg::NodeVisitor
 {
 public:
 TestTraverser() : NodeVisitor(TRAVERSE_ALL_CHILDREN), spaces(0){}

 virtual void apply(osg::Node node)
 {

 OSG_NOTICE  std::string(spaces * 2, ' ')  Traverse 
 Class.  This node is a:   node.libraryName()  ::  node.className() 
   and has the associated name:   node.getName()  std::endl;

 spaces++;
 traverse(node);
 spaces--;
 }

 protected:
 int spaces;
 };




 For the Index finger I would get this output:

 Traverse Class.  This node is a: osg::MatrixTransform and has the associated 
 name: L_IndexA
   Traverse Class.  This node is a: osg::MatrixTransform and has the 
 associated name: L_IndexB
 Traverse Class.  This node is a: osg::MatrixTransform and has the 
 associated name: L_IndexC
   Traverse Class.  This node is a: osg::MatrixTransform and has 
 the associated name: L_IndexD
 Traverse Class.  This node is a: osg::MatrixTransform and has 
 the associated name: L_IndexEND
   Traverse Class.  This node is a: osg::Geode and has the 
 associated name:
 Traverse Class.  This node is a: osg::Geode and has the 
 associated name:
   Traverse Class.  This node is a: osg::Geode and has the 
 associated name:
 Traverse Class.  This node is a: osg::Geode and has the 
 associated name:
   Traverse Class.  This node is a: osg::Geode and has the associated 
 name:

 Notice how the Goeds don't have names.  I am assuming this because they don't 
 need names when someone is modelling in a modeling program they worry only 
 about labeling the joints.  The Geodes are actually just representations of 
 the geometry that makes up a fingers appearence, correct?

 So I can then grab say for example a single node and create a reference to 
 it, something like:


 osg::ref_ptrosg::MatrixTransform indexB = new osg::MatrixTransform;
 if(node.getName() == L_IndexB)
 indexB = node;

 Then in later on assuming indexB is global I can do
 indexB-setMatrix(osg::Matrix::translate(1,0,0));
 in an Update() method that runs every frame.


 This should move the matrixTransform, and I would expect the finger to look 
 weird on the screen when running the application.  Assuming B is the middle 
 knuckle of the finger, the left index finger knuckle should be bowed out to 
 the left.  But it never is.

 So to make sure I was actually moving something I added an axes to all the 
 

Re: [osg-users] Moving a model with NodeCallback

2014-09-17 Thread Mattias Helsing
Hi again,
some more 2p
I'm not an animator myself but I'm guessing
the hand model was rigged and skinned in 3ds max, When you load a
3ds file with OSG that information is lost and what remains is the
empty tree of MatrixTransforms. I think that you need to export the
3ds MAX model to osg using a plugin that someone was working on.
Search this list for 3ds max exporter.
Grepping RigGeometry in src/osgPlugins/**/* shows that only the dae
and fbx plugins care about Rigs. Thus your options are those 2
plugins or getting 3dsmax to export directly to native OpenSceneGraph
using the previously mentioned plugin.
Again - I'm not an animator. Someone please correct me if I'm wrong.
cheers
/Mattias

On Wed, Sep 17, 2014 at 7:12 PM, Mattias Helsing helsin...@gmail.com wrote:
 Hi Chris,
 A quick look at your model (after converting it to .osg) shows that
 the MatrixTransforms are there alright but there are no drawables
 connected to them. Instead the 2 existing Geodes (each with 1
 Geometry) are located in a separate node tree parallel to the
 MatrixTransforms that you are trying to use. I suggest you do this:
 export OSG_NOTIFY_LEVEL=INFO
 export OSG_OPTIMIZER=OFF
 osgconv lefthand.3ds lefthand.osg
 ...
 osgconv will print lots of useful information and then you can inspect
 lefthand.osg in your favourite text editor.

 /Mattias

 On Wed, Sep 17, 2014 at 4:15 PM, Chris Hidden ch...@erghis.com wrote:
 Thanks agin for helping me with this.

 While I am very new to all of this, I have spent the better part of the last 
 5 weeks learning open scene graph.  I have a basic knowledge of a fair 
 chunck of it I believe.  My problem is, is that I have gone through many of 
 the examples, I have worked through the majority of the OpenSceneGraph for 
 Beginners book and scoured the forums many a time.

 The osgrobot example is a good example, except it shows you how to assemble 
 your own shapes and add them to global MatrixTransforms.  I suppose I could 
 build a simple hand model of capsules and shapes as well and get them to 
 function similarily.

 But why put the time into rebuilding a lower quality hand model when I 
 already have one.  My problem is just that with the .3ds hand model I 
 haven't built it myself and don't know the exact structure.  Also I am doing 
 this for my company and I unfortunately have a time pressure over my head.

 In the osgRobot example, its very clear that we have a group of 
 MatrixTransforms that have drawables as children to the MatrixTransforms.  
 So when a rotation is applied to the transform it is also applied to its 
 children hence moving a part of the model.

 The hand model is not made up of clear indivudal parts however.  If it is, I 
 don't know how to access them.  I can traverse through the hands parts and 
 see how its built and what parts have what names.  This doesn't help me 
 understand how to manipulate its geometry though.

 For example the hand is made up of 5 fingers.  Each finger has 4 joints and 
 an end aside from the thumb which has 3 joints and an end.  These joints and 
 ends show up as MatrixTransforms when I call className() on them from a 
 given Node in a traversal class.

 Ex:


 Code:

 class TestTraverser : public osg::NodeVisitor
 {
 public:
 TestTraverser() : NodeVisitor(TRAVERSE_ALL_CHILDREN), spaces(0){}

 virtual void apply(osg::Node node)
 {

 OSG_NOTICE  std::string(spaces * 2, ' ')  Traverse 
 Class.  This node is a:   node.libraryName()  ::  node.className() 
   and has the associated name:   node.getName()  std::endl;

 spaces++;
 traverse(node);
 spaces--;
 }

 protected:
 int spaces;
 };




 For the Index finger I would get this output:

 Traverse Class.  This node is a: osg::MatrixTransform and has the associated 
 name: L_IndexA
   Traverse Class.  This node is a: osg::MatrixTransform and has the 
 associated name: L_IndexB
 Traverse Class.  This node is a: osg::MatrixTransform and has 
 the associated name: L_IndexC
   Traverse Class.  This node is a: osg::MatrixTransform and has 
 the associated name: L_IndexD
 Traverse Class.  This node is a: osg::MatrixTransform and 
 has the associated name: L_IndexEND
   Traverse Class.  This node is a: osg::Geode and has the 
 associated name:
 Traverse Class.  This node is a: osg::Geode and has the 
 associated name:
   Traverse Class.  This node is a: osg::Geode and has the 
 associated name:
 Traverse Class.  This node is a: osg::Geode and has the 
 associated name:
   Traverse Class.  This node is a: osg::Geode and has the associated 
 name:

 Notice how the Goeds don't have names.  I am assuming this because they 
 don't need names when someone is modelling in a modeling program they worry 
 only about labeling the joints.  The Geodes are actually just 
 representations of the 

Re: [osg-users] Moving a model with NodeCallback

2014-09-16 Thread Chris Hidden
Hey guys I really need some help with this.  I must just have a 
misunderstanding of how to manipulate things. 

To show exactly what I am doing I want to manipulate the LeapMotion handmodels 
offered with their SDK.  

The hand models come as FBX format.  I have opened it in 3DS max and saved them 
as a osgb file with the OpenSceneGraph Max Exporter. 

Then if I run a Node Traversal on the hand I get a list of all the 
MatrixTransform nodes and thier names.  

So to test it I am trying to use a callback class to simply move one section of 
the hand.  I do an if conditional like:

if(node.getName() == L_PinkyD)

Then I use a matrix to setMatrix and apply it to the node. 

If I attach axes to each transform node I can see that the specific axis is 
moved.  But the hand model itself remains unchanged.  Am I suppose to be 
accessing it with osgAnimationBones?  because I can't see any bones when i do a 
ClassName() and LibraryName() on the nodes.  Only matrix transforms.  In fact 
this is the print out of the hand model I get in my log file:


Code:

Traverse Class.  This node is a: osg::MatrixTransform and has the associated 
name: L_ThumbA
  Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_ThumbB
Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_ThumbC
  Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_ThumbEND
Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_MiddleA
  Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_MiddleB
Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_MiddleC
  Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_MiddleD
Traverse Class.  This node is a: osg::MatrixTransform and has 
the associated name: L_MiddleEND
Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_RingA
  Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_RingB
Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_RingC
  Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_RingD
Traverse Class.  This node is a: osg::MatrixTransform and has 
the associated name: L_RingEND
Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_PinkyA
  Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_PinkyB
Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_PinkyC
  Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: L_PinkyD
Traverse Class.  This node is a: osg::MatrixTransform and has 
the associated name: L_PinkyEND
  Traverse Class.  This node is a: osg::MatrixTransform and has the associated 
name: group5
Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: HandsREAL_CutOff_Arm1
  Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: HandsREAL_CutOff_Arm1-OFFSET
Traverse Class.  This geode is a: osg::Geode and has the associated 
name: HandsREAL_CutOff_Arm1-GEODE
  osg::Geometry Has name : Hands_Alt_blinn1
Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: nailsFix1
  Traverse Class.  This geode is a: osg::Geode and has the associated name: 
nailsFix1-GEODE
osg::Geometry Has name : blinn2
  Traverse Class.  This node is a: osg::MatrixTransform and has the associated 
name: group6
Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: HandsREAL_CutOff_Arm1
  Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: HandsREAL_CutOff_Arm1-OFFSET
Traverse Class.  This geode is a: osg::Geode and has the associated 
name: HandsREAL_CutOff_Arm1-GEODE
  osg::Geometry Has name : Hands_Alt_blinn1
Traverse Class.  This node is a: osg::MatrixTransform and has the 
associated name: nailsFix1
  Traverse Class.  This geode is a: osg::Geode and has the associated name: 
nailsFix1-GEODE
osg::Geometry Has name : blinn2




Do I need to rig and skin the model programatically? Beause I can see the bones 
in 3ds Max.. if I move a bone in there the model moves with the bone.  But in 
OSG I just cant get the hand models to change with any update... 

HELP! Ill provide more information if its needed... Ive tried to be as specific 
as I can.  Thank yoU!

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61055#61055





___

Re: [osg-users] Moving a model with NodeCallback

2014-09-16 Thread Robert Osfield
Hi Chris,

I tried to follow the original post and the follow up and have ended
puzzled as to why you are going about what you are doing in the way you
are, let alone what is actually amiss with the transforms not taking
effect.  The approach just seems rather more awkward than it should be, it
should however, be possible to get it working in principle.  As for parts
not transforming when you expect it, well only subgraphs of transform will
be modified by it, any chance you haven't added all the nodes you want to
move?

I'll have to defer to Cedric Pinson on osgAnimation as he's the author and
guru on this part of the OSG.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Moving a model with NodeCallback

2014-09-16 Thread Chris Hidden
Oh it is most definitely a very awkward way of doing things.  I am very much a 
novice at this and thats why.  

I have been following along the tutorials in the Open Scene Graph for beginners 
and trying to understand how the engine works as well as get a better grasp on 
graphics programming as I go along. 

As mentioned I am getting data from an API my company is developing from the 
leap motion.  I want to animate the model hands provided by leap motion 
depending on position tracking data we get from the leap motion sensor.  

How would I go about doing this in a less awkward way.  Also in regards to me 
not maybe have added all the nodes I need to, I don't really add any nodes.  My 
impression was that the NodeTraverser was able to traverse through a given 
models parts and access them. 

I am very open to advice and or being pointed in the right direction.  So my 
next steps are?  Do I try to handle callbacks differenyl or how should I 
restructure my approach?

Right now it follows this: 

1.  Establish Logging mechanism as shown in OpenSceneGraph for Beginners.
2.  Instanciate a callback class
3.  Load the model. 
4.  Set the models datavariance to dynamic
5.  Add the callback class to the model.
6.  Set up viewer and camera (standard)
7.  Run 

8.  In the callback all I want to do is traverse through each of the nodes of 
the hand and reposition certain fingers.  So I:
9.  Instanciate a traversal class. 
10.  Get my node in the callback to accept it.

11. In the traversal class I check if its the node I want to reposition
12.  If it is reposition it. 

I can see already this seems a weird way to do it, but I am uninspired as to 
how to properly approach this.  All advice and tips appreciated!!

:D thanks!

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61057#61057





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org