Jump to content
  • Advertisement

Sung Woo Yeo

Member
  • Content Count

    11
  • Joined

  • Last visited

Community Reputation

3 Neutral

About Sung Woo Yeo

  • Rank
    Member

Personal Information

  • Interests
    Education
    Programming

Social

  • Github
    https://github.com/yeosu0107

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Sung Woo Yeo

    Assimp Model Load (FBX) Help!

    thanks for your comment!
  2. Sung Woo Yeo

    Assimp Model Load (FBX) Help!

    Sorry... There was a problem with the model;;;I got a new model from the modeler and this is not a problem. Thanks for all Reply! ps. I'm making a game using DirectX12 and etc... as a collage graduation research project I don't have a lot time, so i'm using the assimp to process fbx
  3. I have something wrong that loading fbx model using assimp some meshes are located in unusual place this is result about my renderer. (the face is off) but other programs (like 3dmax, assimp viewer, and etc...) the face is well attached. (this is assimp viewer image) I folloew the reading of vertex while debugging, and The x-coord of all vertices in the face mesh were added to 200 (this is return value about aiMesh.mVertices) my import setting is that. m_pScene = aiImportFile(fileName.c_str(), aiProcess_JoinIdenticalVertices | // join identical vertices/ optimize indexing aiProcess_ValidateDataStructure | // perform a full validation of the loader's output aiProcess_ImproveCacheLocality | // improve the cache locality of the output vertices aiProcess_RemoveRedundantMaterials | // remove redundant materials aiProcess_GenUVCoords | // convert spherical, cylindrical, box and planar mapping to proper UVs aiProcess_TransformUVCoords | // pre-process UV transformations (scaling, translation ...) //aiProcess_FindInstances | // search for instanced meshes and remove them by references to one master aiProcess_LimitBoneWeights | // limit bone weights to 4 per vertex aiProcess_OptimizeMeshes | // join small meshes, if possible; //aiProcess_PreTransformVertices | aiProcess_GenSmoothNormals | // generate smooth normal vectors if not existing aiProcess_SplitLargeMeshes | // split large, unrenderable meshes into sub-meshes aiProcess_Triangulate | // triangulate polygons with more than 3 edges aiProcess_ConvertToLeftHanded | // convert everything to D3D left handed space aiProcess_SortByPType); // make 'clean' meshes which consist of a single type of primitives); Note that if aiProcess_PreThransformVertices flag is used, The model is rendered perfactly! but this model has animation, so i can't use this flag and There is one thing that takes This model's face mesh is made up of rect polygons. (not triangle) Could this be a problem? Please please help me about this problem! If you want other codes, I'll gladly provide all the code Thanks!
  4. Sung Woo Yeo

    Use assimp for skeletal animation HELP!

    Hey Guys I've completely fixed everything! It's matter about transpos matrix Previously, I applied transpos function to the bone offset and mTranslation of the node (that is, i applied transpos when I read aiMatrix4x4) but after trying many different things, I found it to be wrong Exactly, there is an aiMatrix4x4 which should apply transpos and aiMatrix4x4 should not apply In my case, I applied transpos only result of transformation This is my codes void LoadAnimation::ReadNodeHeirarchy(float AnimationTime, const aiNode * pNode, const XMMATRIX& ParentTransform) { string NodeName(pNode->mName.data); const aiAnimation* pAnim = m_pScene->mAnimations[0]; XMMATRIX NodeTransformation = XMMATRIX(&pNode->mTransformation.a1); //I just read aiMatrix4x4 (aiMatrix to XMMATRIX format) const aiNodeAnim* pNodeAnim = FindNodeAnim(pAnim, NodeName); XMMATRIX anim = XMMatrixIdentity(); if (pNodeAnim) { aiVector3D s; CalcInterpolatedScaling(s, AnimationTime, pNodeAnim); XMMATRIX ScalingM = XMMatrixScaling(s.x, s.y, s.z); aiQuaternion q; CalcInterpolatedRotation(q, AnimationTime, pNodeAnim); XMMATRIX RotationM = XMMatrixRotationQuaternion(XMVectorSet(q.x, q.y, q.z, q.w)); aiVector3D t; CalcInterpolatedPosition(t, AnimationTime, pNodeAnim); XMMATRIX TranslationM = XMMatrixTranslation(t.x, t.y, t.z); NodeTransformation = ScalingM * RotationM * TranslationM; NodeTransformation = XMMatrixTranspose(NodeTransformation); //I applied transpos } XMMATRIX GlobalTransformation = ParentTransform * NodeTransformation; for (auto& p : m_Bones) { if (p.first == NodeName) { p.second.FinalTransformation = m_GlobalInverse * GlobalTransformation * p.second.BoneOffset; break; } } for (UINT i = 0; i < pNode->mNumChildren; ++i) { ReadNodeHeirarchy(AnimationTime, pNode->mChildren[i], GlobalTransformation); } } If I read bone offset and mTransformation about node(aiMatrix4x4), I simply transformed it into XMMATRIX format // XMMATRIX(&aiMatrix4x4.a1) second, If current node is a node belonging to the animation channel, and S R T transformation is performed, transpos is applied to the transformation The important this is that we don't apply the transpos to the parent nodes matrix (if parent node conduct transpos function, there is a risk that it will be performed twice) This is the result PS. I hope this post helps people using directX and assimp assimp library has some bugs that some models using fbx format are broken I know that the assimp team is fixing it I was able to observe that, in general, if the viewer provided by assimp show broken results, my result are also broken.
  5. Sung Woo Yeo

    Use assimp for skeletal animation HELP!

    You inspired me! thanks I ignored the animation imported from assimp and just tried rotation the bones and As a result, I found the axis of rotaion to be strange. As I predicted above, the axis was applied differently from the original (the center of the second mesh) So many of the advice and functions we've got from above seem to have been inadequately applied And i have one question Maybe i misunderstood, Are you telling me not to apply all animations from root node? I think that read all child nodes from the root node and multiply the transformations( rot, scaling, shifting) and if current node is bone, apply the multiplied transformation value up to now It is wrong???
  6. Sung Woo Yeo

    Use assimp for skeletal animation HELP!

    I accept the idea of testin with a simple model so got simple models of two bone first It is ideal result It has a blue circle with its aixs of rotation (com up and down around the axis) but my result ( fix transpos ploblem and GlobalTransformation and etc...) is like this the axis is center of the cube it also come up and down but different axis give completely different results I attach my modified codes 1. load bone data void LoadModel::InitBones(UINT index, const aiMesh* pMesh) { for (UINT i = 0; i < pMesh->mNumBones; ++i) { int BoneIndex = -1; string BoneName(pMesh->mBones[i]->mName.data); int tmpIndex = 0; for (const auto& p : m_Bones) { if (p.first == BoneName) { BoneIndex = tmpIndex; break; } tmpIndex++; } if (BoneIndex < 0) { BoneIndex = (int)m_Bones.size(); Bone bone; bone.BoneOffset = aiMatrixToXMMatrix(pMesh->mBones[BoneIndex]->mOffsetMatrix); m_Bones.emplace_back(make_pair(BoneName, bone)); } const aiBone* pBone = pMesh->mBones[BoneIndex]; for (UINT b = 0; b < pBone->mNumWeights; ++b) { UINT vertexID = pBone->mWeights[b].mVertexId; float weight = pBone->mWeights[b].mWeight; m_meshes[index].m_vertices[vertexID].AddBoneData(BoneIndex, weight); } } } 2. ReadNodeHeirarchy void LoadAnimation::ReadNodeHeirarchy(float AnimationTime, const aiNode * pNode, const XMMATRIX& ParentTransform) { string NodeName(pNode->mName.data); const aiAnimation* pAnim = m_pScene->mAnimations[0]; XMMATRIX NodeTransformation = aiMatrixToXMMatrix(pNode->mTransformation); const aiNodeAnim* pNodeAnim = FindNodeAnim(pAnim, NodeName); if (pNodeAnim) { aiVector3D s; CalcInterpolatedScaling(s, AnimationTime, pNodeAnim); XMMATRIX ScalingM = XMMatrixScaling(s.x, s.y, s.z); aiQuaternion q; CalcInterpolatedRotation(q, AnimationTime, pNodeAnim); XMMATRIX RotationM = XMMatrixRotationQuaternion(XMVectorSet(q.x, q.y, q.z, q.w)); aiVector3D t; CalcInterpolatedPosition(t, AnimationTime, pNodeAnim); XMMATRIX TranslationM = XMMatrixTranslation(t.x, t.y, t.z); NodeTransformation = ScalingM * RotationM * TranslationM; } XMMATRIX GlobalTransformation = NodeTransformation * ParentTransform; for (auto& p : m_Bones) { if (p.first == NodeName) { p.second.FinalTransformation = m_GlobalInverse * GlobalTransformation * p.second.BoneOffset; break; } } for (UINT i = 0; i < pNode->mNumChildren; ++i) { ReadNodeHeirarchy(AnimationTime, pNode->mChildren[i], GlobalTransformation); } } aiMatrixToXMMatrix function is like your(Ivan Terziev) function i want you to take a look at it very thanks!
  7. Sung Woo Yeo

    Use assimp for skeletal animation HELP!

    Thanks for your response I have some questions First you say that I shouldn't be transposing matrices when read them from assimp, but I think that assimp is opengl format so would i have to do transpose to get the correct col/row ? Actually, I tried removing transpos function when using assimp to read my model, but the result is very bad (It was completely disassembled) second I agree that you told me to do S * R * T because I saw it in my book when i was studying but strangely the result of S * R * T and T * R * S were same, so i didn't fix it hmmm..... assimp is very useful library to load fbx format but load anmation, it's very hardly... I don't have enough English skills to read it so you would be inconvenient to read it Thank you for your faithful reply!
  8. Sung Woo Yeo

    Use assimp for skeletal animation HELP!

    First thank for your Idea I don't know when quaternion is xyzw or wxyz Many articles just tell them to be careful It is very difficult...
  9. Sung Woo Yeo

    Use assimp for skeletal animation HELP!

    thank you for your answer I'll take your idea and try to test it wiht a simple model
  10. Sung Woo Yeo

    Use assimp for skeletal animation HELP!

    first Thank you for your answer I have some questions for you. you told me to count 'BoneOffset * GlobalTransformation * m_blobalInverse' but if I calculate that equation, the model is completyely broken And I use this function to load XMMATRIX from aiMatirx4x4 XMMATRIX(&pNode->mTransformation.a1); 'pNode->mTransformation' is type aiMatrix4x4 I think it is no ploblem because XMMATRIX can put the argument values of the array please, I want you to tell me what method you used thank you
  11. Guys, I've spent a lot of time to load skeletal animation but It is very difficult... I refer to http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html but I didn't get the results I wanted Please Help Me This is my codes void LoadAnimation::BoneTransform(float time, vector<XMFLOAT4X4>& transforms) { XMMATRIX Identity = XMMatrixIdentity(); float TicksPerSecond = (float)(m_pScene->mAnimations[0]->mTicksPerSecond != 0 ? m_pScene->mAnimations[0]->mTicksPerSecond : 25.0f); float TimeInTicks = time*TicksPerSecond; float AnimationTime = fmod(TimeInTicks, (float)m_pScene->mAnimations[0]->mDuration); ReadNodeHeirarchy(AnimationTime, m_pScene->mRootNode, Identity); transforms.resize(m_NumBones); for (int i = 0; i < m_NumBones; ++i) { XMStoreFloat4x4(&transforms[i], m_Bones[i].second.FinalTransformation); } } void LoadAnimation::ReadNodeHeirarchy(float AnimationTime, const aiNode * pNode, const XMMATRIX& ParentTransform) { string NodeName(pNode->mName.data); const aiAnimation* pAnim = m_pScene->mAnimations[0]; XMMATRIX NodeTransformation = XMMATRIX(&pNode->mTransformation.a1); const aiNodeAnim* pNodeAnim = FindNodeAnim(pAnim, NodeName); if (pNodeAnim) { aiVector3D scaling; CalcInterpolatedScaling(scaling, AnimationTime, pNodeAnim); XMMATRIX ScalingM = XMMatrixScaling(scaling.x, scaling.y, scaling.z); ScalingM = XMMatrixTranspose(ScalingM); aiQuaternion q; CalcInterpolatedRotation(q, AnimationTime, pNodeAnim); XMMATRIX RotationM = XMMatrixRotationQuaternion(XMVectorSet(q.x, q.y, q.z, q.w)); RotationM = XMMatrixTranspose(RotationM); aiVector3D t; CalcInterpolatedPosition(t, AnimationTime, pNodeAnim); XMMATRIX TranslationM = XMMatrixTranslation(t.x, t.y, t.z); TranslationM = XMMatrixTranspose(TranslationM); NodeTransformation = TranslationM * RotationM * ScalingM; } XMMATRIX GlobalTransformation = ParentTransform * NodeTransformation; int tmp = 0; for (auto& p : m_Bones) { if (p.first == NodeName) { p.second.FinalTransformation = XMMatrixTranspose( m_GlobalInverse * GlobalTransformation * p.second.BoneOffset); break; } tmp += 1; } for (UINT i = 0; i < pNode->mNumChildren; ++i) { ReadNodeHeirarchy(AnimationTime, pNode->mChildren[i], GlobalTransformation); } } CalcInterp~ function and Find~ function are like a tutorial (http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html) I think that I'm doing the multiplication wrong but I don't know where it went wrong If you want, i wall post other codes. here is my result (hands are stretched, legs are strange) and it is ideal result
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!