[osg-users] about the state of the BVH plug-in, when used with CMU MoCap files

Christian Buchner christian.buchner at gmail.com
Fri Apr 1 07:45:36 PDT 2016


I've tried the OSG 3.2 branch and this version exhibited the same problem.

Then I had a closer look at the BVH files supplied by that web site. I am
finding that it defines
rotational parameters always in the order Z, Y,  X.  That is different from
the sequence I expect
from various online sources that use Z, X, Y.

in the plugin code, hence I adjust the sequence of keyValues read from the
file to read z, y, x
in this order.

            if ( ch&0x08 ) fr.readSequence( keyValue[2] );  // Z
            if ( ch&0x20 ) fr.readSequence( keyValue[1] );  // Y
            if ( ch&0x10 ) fr.readSequence( keyValue[0] );  // X

But this alone wasn't sufficient to get correct results.

I also had to swap the order in which we generate the rotation matrix to
X*Y*Z.

            osg::Matrix rotMat =

osg::Matrix::rotate(osg::DegreesToRadians(keyValue[0]),
osg::Vec3(1.0,0.0,0.0))
                               *
osg::Matrix::rotate(osg::DegreesToRadians(keyValue[1]),
osg::Vec3(0.0,1.0,0.0))
                               *
osg::Matrix::rotate(osg::DegreesToRadians(keyValue[2]),
osg::Vec3(0.0,0.0,1.0));

This appears to be the opposite order in which the above Euler angles are
specified.

Now the animations play out correctly, as far as I can tell.

I will have to do some more online research to understand whether the BVH
spec actually allows
to specify rotation in an arbitrary order and what the definitive answer
about the sequence of applying
the Euler angles is.

The first change could certainly determined automatically from the input
file, but whether or not the
sequence of matrix multiplications shall always occur in the opposite order
is up for debate.

I might propose a suitable patch to the BVH plug-in later.

Christian



2016-04-01 14:38 GMT+02:00 Christian Buchner <christian.buchner at gmail.com>:

>
> This is how I call the osganimationviewer to display a skeleton from the
> motion data.
>
> osganimationviewer --drawbone C:\mocap\motionbuilder\01\01_02.bvh -O solids
>
> Just the result is a bit unexpected...
>
> 2016-04-01 14:33 GMT+02:00 Christian Buchner <christian.buchner at gmail.com>
> :
>
>> Hi all,
>>
>> I've been trying to get the BVH files from this site to import into the
>> current OSG 3.4 branch
>>
>> https://sites.google.com/a/cgspeed.com/cgspeed/motion-capture/cmu-bvh-conversion
>>
>> These are conversions of the original motion capture data that CMU
>> provides for free in a different format, optimized for the three
>> applications MotionBuilder, DAZ Studio and 3DS MAX.
>>
>> I've tried replaying the animations in osganimationviewer using the
>> --drawbone flag. Usually one needs to zoom out the camera to get the full
>> skeleton into view. The issue that I am having is that I see weird and
>> unexpected rotations of the entire skeleton, as well as specific joints -
>> regardless of the version of the BVH files I download.
>>
>> Has the OpenSceneGraph BVH plug-in ever worked on these mocap files?
>> Could it be that a code regression has recently broken the plug-in?
>>
>> Christian
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20160401/d66ef86e/attachment-0003.htm>


More information about the osg-users mailing list