If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Basic Orientation Matrix Question

I am the author of bvhacker, a free animation application (see here: www.bvhacker.com)

I'm currently working on a new release, and am trying to change the orientation of bones in a bvh animation file. My problem is this:

I have a bvh file that has it's arms aligned down the y-axis. I need to convert it so that it's arms are aligned along the x-axis.

Or, put another way, when all joint's rotations are set to zero, the figure's arms are by it's sides. I need the figure's arms to be outstreched horizontally when zeroed out.

When I first encountered the problem I tried the naive solutions - e.g. just rotating the arms through 90 degrees. Of course, this didn't work well!

I've researched this as far as I can on the web. The solution *appears* to be in changing the arm bones initial translations from 0,L,0 to L,0,0 (where L represents the length of the arm) and then multiplying all my XYZ rotation data values in turn, each rotation value represented by a 4-element vector (where w=1), by a 4x4 'orientation matrix'. I'm fairly comfortable implementing this in code, but I have no idea of the values that should go into the orientation matrix, other than as follows ('u' is for unknown value)

u u u 0
u u u 0
u u u 0
0 0 0 1

I did study matrix transformations at uni, but it was a long time ago now, and I didn't get a really good grasp on the subject at the time! Can anyone help?

Re: Basic Orientation Matrix Question

Thanks for the reply. I have now (mostly) solved the problem. Wikipedia was a great source of info for this.

I actually found that the shoulder and arms joints could simply be re-aligned by swapping the x and y offsets to align the arms along the x-axis, changing the joint rotation order from ZXY to ZYX and inverting the new X rotations.

However, the resultant ZYX rotation order is next to useless, as many 3D environments cannot use it. Reading up on Wikipedia, I found that there are two ways to change the rotation order, one using matrices and one using quaternions.

The algorithm works great, except it only works within the limits of +/- 90 degrees (i.e. a hemisphere). I've now run out of time to go any further with this (for now) but plan to extend the solution by using Noel Hughes algorithm over two 'back-to-back' hemispheres when I can find some time.

The latest version of bvhacker is now in test and will (hopefully!) be available for download sometime over the next few days at www.bvhacker.com

Re: Basic Orientation Matrix Question

Hi Dave
I'm using BVH hacker for some time and it help me alot. I'm trying to build loader for BVH in AS3.
I've some success but also problems.
Main problem is swing that I get with very big values for example
in frame 315 I can read in the hacker
Z=-174.49
Y=173.50
and visually such big rotation aren't happen and lead to nasty swing of legs in AS3
I imported .bvh in Daz3D(where is all correct) and in same frame I'm reading
Z=-11.63;
Y=-10.45;
what should I do with Z,X,Y Euler angles so swing not happen.
Body in AS3 (Flash) is along Y+(up) hands along X(+-) and looking towards screen Z+
Also I'm bit confused with offsets. Just x,y,z pos of the root is animated. Did offset mean joint offset from parent joint which is actually x,y,z of the joint???
If you could share your experiences would be great
Regards
Alex