Hi Jamie,

I contributed the morphing code, but first had to check how it worked again.
In the OpenSceneGraph-Data directory is a file morphing.osg that contains a 
base face with two morph targets. You can load it in osganimationviewer to see 
how it animates. 
If you open up the .osg file you can experiment with the Animation.
The Animation contains two FloatLinearChannels. The first one contains the 
contribution of morph target "0" and the second contains the contribution of 
morph target "1".

If you look for osgAnimation::MorphGeometry you will see "method NORMALIZED" 
which uses this formula
base * (1 - (sum of weights)) + (sum of (weight * target))
to calculate the morphed vertex positions.

Applying your example to this file
A (base) to B (0) to C (1) would look like this:

...
name "0"
...
Keyframes 3 {
   key 0 0
   key 1 1
   key 2 0
}
...
name "1"
...
Keyframes 3 {
   key 0 0
   key 1 0
   key 2 1
}
...

Of course this can also be done from code.


kind regards,

Roland Smeenk

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





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

Reply via email to