Jump to content
  • Advertisement
Sign in to follow this  

Is there a set of local "basis" vectors in a matrix?

This topic is 973 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Let me express myself.
In terms of a local space, when you have a set of canonical basis vectors for
this space describing where x, y and z are going to go. Say x is going right,
y is going up and z is going outward (Left-handed system),
and you don't translate it or rotate it
it has some sort of matrix to describe it with respect to a origin, hasn't it?

(I draw this conclusion because there is always a transformation describing the local frame of a bone in my character mesh)
say the identity matrix of

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

Then the basis vectors are (1,0,0), (0,1,0), (0,0,1)
Now I got a non-canonical local space with the basis vectors pointing
into various directions.
Then the basis vectors may be pointing to somewhat different than the canonical basis vectors
How do I find those vectors?
And how can I use quaternions or matrix to transform it to turn it into a space that is canonical?
The problem I got on hand is I have a frame hierarchy which I want to map a bvh file to it.
But the frame hierarchy's local frame are oriented in many different ways, I can't tell if their
local basis vectors are canonical, because I don't know how to test them, so I can say
the basis vecs are pointing 0,1,1 for the x etc and it is rotating 1.45 radians about that axis
for example. Now I want to twist it back to the T-pose so that the frame hierarchy local transformations and the bvh local transformations match and I can copy the transformations over.
Is there a way to find this offset to twist the local transformations to identity and the basis
vectors are canonical?
I am not sure I speak all the terminology correctly.
If I am not, please correct me


the only way I can think of to turn back a rigged character into T-pose is to perform the parent-child matrix combination process in reverse order.

Is that right?


Edited by lucky6969b

Share this post

Link to post
Share on other sites

There are a lot of questions in there, but it's not very clear to me what you're asking or what your problem is. What do you mean when you use the term canonical?

Share this post

Link to post
Share on other sites

Just to simplify what I am trying to say.

Let's say the local transformation of a bone is

FrameTransformMatrix {

Is there a way to find its basis vectors? (which way these vectors are oriented)


Compared to this one

FrameTransformMatrix {

and a canonical vector is just some form of vector OpenGL and DirectX (right is 1, 0, 0, up is 0, 1, 0 and front is 0, 0, 1 etc) use which doesn't rotate and translate... Just where the start is (just imagine when you fire up 3ds max or blender, the look of the interface when it starts up)


I ask this because the bvh local transformation and the bone's local transformation basis vectors have to match before I can copy the transformations over.



Edited by lucky6969b

Share this post

Link to post
Share on other sites
Lots of questions.

Where are they and how you do find them?

For a row-major format, imagine the transformation matrix looks like this:

a a a s
b b b s
c c c s
p p p v

The values for a are your X axis basis.
The values for b are your Y axis basis.
The values for c are your Z axis basis.
The values for p are your position.
The values for s are your sheer.
The value for v is either 1 for a point (where position matters) or 0 for a vector (where position is irrelevant).

Flip rows with columns if you are column oriented. :-)

How do you use quaternions to turn them into something canonical?

That question doesn't quite make sense. A quaternion can store a 3D orientation. That is, it can encode the a, b, and c vectors, but not the other values.

You might be thinking about normalized quaternions? Quaternions operate in 3D much the same way polar coordinates operate in 2D. In 2D you can go around and around and around many times in polar coordinates, as long as your rotation is modified by any number of complete rotations the position is the same. A normalized polar coordinate has an angle between +pi and -pi. A normalized quaternion is similar, but the math involved is bigger than a forum post. Google for "quaternion normalization" for more.

You might also instead be asking to tell if a transformation matrix is still an affine transformation, that is, if parallel lines are still parallel and straight lines are still straight. You do that by ensuring the basis functions are still perpendicular to each other. No matter what direction your transformation matrix is transforming, it still needs to have each axis be perpendicular. That is a notorious issue with some graphics systems, especially those that accumulate into their transformation matrix, they slowly drift out of being proper affine transformations. Google for "affine transformation" for more.

The T pose stuff sounds like you are trying to describe something but lack the words. Maybe are you are looking for the inverse transformation matrix? A transformation matrix that will undo the earlier transformation matrix? Again, "inverse transformation matrix" for the math involved. Or maybe since you are applying a series of them, many systems will use a series of matrix multiplications put together in a stack. Move out along the branches of a skeletal animation and at each joint you push the old value on a stack and multiply the new transform.When you're done with that set, you can push the value and move out again, or pop the value and move inward on the data structure to the next sibling or pop again to go out to the parent.

Share this post

Link to post
Share on other sites

Thanks frob,

Yes, you're right. I loose my words, sorry about that because I am just a complete beginner in bvh retargetting.

The paper I am referring can be downloaded from here.....




Maybe you can help me out but you need to spend some time on it and I don't know

if you can do that or not

The equation:

q = qinit * RG-1 * q * RG

I don't know how to get the Quaternion of q

which they described as

Quat((0,1,0), 30)


/// qinit local rotation of FH
    D3DXMATRIX matQinit = f->TransformationMatrix;
    D3DXQuaternionRotationMatrix(&qinit, &matQinit);

    //// RG global rotation of FH
    D3DXMATRIX matRG = f->matCombined;
    D3DXQuaternionRotationMatrix(&RG, &matRG);

    // RGInv
    D3DXQuaternionInverse(&RGInv, &RG);

    D3DXQUATERNION q; <<<<<<<<<<<<<<??????????????
Edited by lucky6969b

Share this post

Link to post
Share on other sites
bvh is a file format. You keep using the word like it is something more. It is a file format to encode a series of transformations.

I suggest that if you don't understand that math you spend some time with a few good books on linear algebra, or maybe some khan academy videos, along with a calculator, pencil, and paper. Linear algebra is the mathematics of 3D (and higher order) manipulation, just like trigonometry and basic algebra are the somewhat simpler mathematics of 2D manipulation. If you do not understand linear algebra you will struggle with any type of 3D math you run across.

It may take a few weeks of dedicated study, but if you want to work with 3D systems you need to understand 3D math. If you are just dabbling you might be able to look up an equation now and then, just like someone who never studied trig may look up how to use a sine or cosine to rotate something in 2D without ever understanding the relationship involved. If you want to work with it you must understand the math.

Share this post

Link to post
Share on other sites

To elaborate a bit on what Frob said: the basis vectors in your matrix that are not canonical are all unit vectors and they're all perpendicular to each other. You can view them as rotated standard basis.


I'm guessing you're looking for the following: you have matrices A and B, you need a matrix C so that when A*C = B. Is that a correct assessment? If so, then C = A^-1 * B, where A^-1 is the inverse matrix of A.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!