3dsmax - Converting coordinates system for FBX model in OpenGL -
i load fbx models using autodesk fbx sdk2013.the models rotated 90 degrees on x-axis default.
the sdk supplies method :
fbxaxissystem::opengl.convertscene(scene);
to perform axis conversion.but doesn't work.calling changes nothing.moreover,it seems fbx exporter uses opengl right hand sytem default,at least says on import:
fbxaxissystem fbxaxis = scene->getglobalsettings().getaxissystem(); if (fbxaxis != fbxaxissystem::opengl) { //.... }
returns false. don't understand;if opengl (right handed system,why models have z axis up? sdk bug?
i found solution.someone here said convertscene() doesn't affect vertices array sets node global/local matrices.with these can transform node geometry or vertices.
so here how done:
fbxmatrix globaltransform = mesh->getnode()->getscene()->getevaluator()->getnodeglobaltransform( mesh->getnode()); dvec4 c0 = glm::make_vec4((double*) globaltransform.getcolumn(0).buffer()); dvec4 c1 = glm::make_vec4((double*) globaltransform.getcolumn(1).buffer()); dvec4 c2 = glm::make_vec4((double*) globaltransform.getcolumn(2).buffer()); dvec4 c3 = glm::make_vec4((double*) globaltransform.getcolumn(3).buffer()); glm::mat4 convertmatr =mat4(c0,c1,c2,c3); convertmatr = inverse(convertmatr); //need inverse otherwise model upside down
then use convertmatr transform mesh's vertices.hope helpful autodesk forum not responsive.
Comments
Post a Comment