Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Mar 2012
Offline Last Active Apr 09 2012 03:41 AM

Posts I've Made

In Topic: How to get a correct TBN matrix and TBN quaternion?

04 April 2012 - 08:01 AM

For the unit matrix, what is the resulting quaternion ? Can you post some code of the conversation between matrix->quat & quat -> matrix ?

I tried the unit matrix, that is fine.

Here is the codes:
Orthonormlize(vert->tangent, vert->binormal, vert->normal );
Matrix33f tSpaceMat = Matrix33f::GetIdentity();
tSpaceMat.SetAxisI( Vec3f(vert->tangent.x, vert->tangent.y, vert->tangent.z) );
tSpaceMat.SetAxisJ( Vec3f(vert->binormal.x, vert->binormal.y, vert->binormal.z) );
tSpaceMat.SetAxisK( Vec3f(vert->normal.x, vert->normal.y, vert->normal.x) );
Quaternion4f quat;
quat.FromMatrix( tSpaceMat );
Matrix33f tMat;
quat.ToMatrix( tMat );

In Topic: How to get a correct TBN matrix and TBN quaternion?

04 April 2012 - 05:24 AM

I'm doing the same and it works. First off, you should accept some error tolerance, then try to detect the error by starting with simple values (unit matrix etc.).

Btw. one pitfall of using quaternion instead of matrixes is, that an automatically generated TBN could change the handness, but you can't really map this to a quaternion (atleast I didn't know how to). I encoded the handness of the resulting matrix in the quaternion/position (i.e. a negativ homogenous coord for flipped handness).

Hi Ashaman73,

Thanks for your advice. the handness I already handled in a same way just like you.

Is the way I build the TBN matrix right? My result is much more than error tolerance. I mean if the tangent, bitangnet and normal is (1,0,0) ,(0,1,0), (0,0,1).
So whether the 3x3 matrix should be like :

And Is the matrix_to_quat() method any different with the regular algorithm?

In Topic: Does boost::pool really header-only in 1.49.0 ?

13 March 2012 - 12:06 AM

The missing file is from boost::thread, which you probably didn't build, not from boost::pool. Maybe there are #defines to disable thread related features and sever the dependency, but I'd try compiling boost::thread first.

Thank you for the information, it's very helpful:)