I am using assimp to load model data in order to convert to a proprietary format for my engine. For testing purposes I am using a couple of the Doom3 models in md5 format. Things seem to work ok, until I come to render the data, aside from skinning issues a debug render of the node hierarchy looks incorrect.
Basically I am traversing the node hierarchy generated by assimp and exporting the node information (name, parent, etc) including the node->mTransform, which I assume is the local node transform. When I recursively calculate the world node transform and render the hierarchy a few (not all) of the positions look incorrect.
Am I missing something here? I'm sure I am doing something wrong, but can't spot it. All I want to obtain is the node transforms (either local or world) such that when I use them to transform vector x=0 y=0 z=0 the resulting position appears correct against the original model. Any help would be appreciated.
Below is a code snippet from the code I use to extract the transforms.
aiMatrix4x4 getNodeOffset( const aiNode* node, const aiScene* scene )
for( int i = 0; i < scene->mNumMeshes; i++ )
aiMesh* mesh = scene->mMeshes[i];
for( int j = 0; j < mesh->mNumBones; j++ )
aiBone* bone = mesh->mBones[j];
if( bone->mName == node->mName )
NodeList createHierarchy( const aiScene* scene )
createHierarchyRecurse( scene, scene->mRootNode, -1, nodeList, false );
void createHierarchyRecurse( const aiScene* scene, const aiNode* node, int parent, NodeList& nodeList )
aiMatrix4x4 offset = getNodeOffset( node, scene );
offset.DecomposeNoScaling( quat, pos );
printf( "%s mOffset %f %f %f\n", node->mName.C_Str(), quat.x, quat.y, quat.z, pos.x, pos.y, pos.z );
hn.offset.q = quat;
hn.offset.p = pos;
node->mTransform.DecomposeNoScaling( quat, pos );
hn.trans.q = quat;
hn.trans.p = pos;
nodeList.push_back( hn );
parent = nodeList.size() - 1;
for( int i = 0; i < node->mNumChildren; i++ )
createHierarchyRecurse( scene, node->mChildren[i], parent, nodeList );
Many thanks in advance
Problem solved - issue was with row major -> column major matrices.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.