Jump to content

asahi

Members
  • Posts

    4
  • Joined

  • Last visited

  • Days Won

    1

Reputation Activity

  1. Like
    asahi got a reaction from DalilaTuP in Need help on bone twisted issue.   
    Hi, 
        Recently I have tried to integrate Spriter to my game by rendering it by myself. Before doing anything further I tried to render all the bone correctly.   Here is the Grey Guy's bone looks like in Spriter: But what I got in my game is something like:   There is a serious twist in the result I got, and I am not sure what goes wrong, seem it is related to non-uniform scale we have in greyguy skeleton.     What I have done basically can be break done into following step: Get the Matrix of each bone by reading scml data. following code is related to bone matrix calculation. void Transform::ToMatrix( glm::mat4& mat ) const{     glm::mat4 scale(1.0f);     scale = glm::scale(scale, m_scale);     glm::mat4 rot = glm::toMat4(m_rot);     glm::mat4 trans = glm::translate(glm::mat4(1.0f), m_trans);     Matrix::Multiply(scale, rot, mat);     Matrix::Multiply(mat, trans, mat);}void Matrix::Multiply( const glm::mat4& mat1, const glm::mat4& mat2, glm::mat4& output ){     output = mat2 * mat1;} Get the bone join coordinate by I am just doing (0.0, 0.0, 0.0, 1.0) * localMat * ParentMat1 * ..... ParentMatN   Can you guys give me some lead about how could I fix this issue?  
  2. Like
    asahi got a reaction from DarrenOl in Need help on bone twisted issue.   
    Hi, 
        Recently I have tried to integrate Spriter to my game by rendering it by myself. Before doing anything further I tried to render all the bone correctly.   Here is the Grey Guy's bone looks like in Spriter: But what I got in my game is something like:   There is a serious twist in the result I got, and I am not sure what goes wrong, seem it is related to non-uniform scale we have in greyguy skeleton.     What I have done basically can be break done into following step: Get the Matrix of each bone by reading scml data. following code is related to bone matrix calculation. void Transform::ToMatrix( glm::mat4& mat ) const{     glm::mat4 scale(1.0f);     scale = glm::scale(scale, m_scale);     glm::mat4 rot = glm::toMat4(m_rot);     glm::mat4 trans = glm::translate(glm::mat4(1.0f), m_trans);     Matrix::Multiply(scale, rot, mat);     Matrix::Multiply(mat, trans, mat);}void Matrix::Multiply( const glm::mat4& mat1, const glm::mat4& mat2, glm::mat4& output ){     output = mat2 * mat1;} Get the bone join coordinate by I am just doing (0.0, 0.0, 0.0, 1.0) * localMat * ParentMat1 * ..... ParentMatN   Can you guys give me some lead about how could I fix this issue?  
  3. Like
    asahi got a reaction from Ddyrinsyk in Need help on bone twisted issue.   
    Hi, 
        Recently I have tried to integrate Spriter to my game by rendering it by myself. Before doing anything further I tried to render all the bone correctly.   Here is the Grey Guy's bone looks like in Spriter: But what I got in my game is something like:   There is a serious twist in the result I got, and I am not sure what goes wrong, seem it is related to non-uniform scale we have in greyguy skeleton.     What I have done basically can be break done into following step: Get the Matrix of each bone by reading scml data. following code is related to bone matrix calculation. void Transform::ToMatrix( glm::mat4& mat ) const{     glm::mat4 scale(1.0f);     scale = glm::scale(scale, m_scale);     glm::mat4 rot = glm::toMat4(m_rot);     glm::mat4 trans = glm::translate(glm::mat4(1.0f), m_trans);     Matrix::Multiply(scale, rot, mat);     Matrix::Multiply(mat, trans, mat);}void Matrix::Multiply( const glm::mat4& mat1, const glm::mat4& mat2, glm::mat4& output ){     output = mat2 * mat1;} Get the bone join coordinate by I am just doing (0.0, 0.0, 0.0, 1.0) * localMat * ParentMat1 * ..... ParentMatN   Can you guys give me some lead about how could I fix this issue?  
  4. Like
    asahi got a reaction from Dryynrins in Need help on bone twisted issue.   
    Hi, 
        Recently I have tried to integrate Spriter to my game by rendering it by myself. Before doing anything further I tried to render all the bone correctly.   Here is the Grey Guy's bone looks like in Spriter: But what I got in my game is something like:   There is a serious twist in the result I got, and I am not sure what goes wrong, seem it is related to non-uniform scale we have in greyguy skeleton.     What I have done basically can be break done into following step: Get the Matrix of each bone by reading scml data. following code is related to bone matrix calculation. void Transform::ToMatrix( glm::mat4& mat ) const{     glm::mat4 scale(1.0f);     scale = glm::scale(scale, m_scale);     glm::mat4 rot = glm::toMat4(m_rot);     glm::mat4 trans = glm::translate(glm::mat4(1.0f), m_trans);     Matrix::Multiply(scale, rot, mat);     Matrix::Multiply(mat, trans, mat);}void Matrix::Multiply( const glm::mat4& mat1, const glm::mat4& mat2, glm::mat4& output ){     output = mat2 * mat1;} Get the bone join coordinate by I am just doing (0.0, 0.0, 0.0, 1.0) * localMat * ParentMat1 * ..... ParentMatN   Can you guys give me some lead about how could I fix this issue?  
  5. Like
    asahi got a reaction from WalterMi in Need help on bone twisted issue.   
    Hi, 
        Recently I have tried to integrate Spriter to my game by rendering it by myself. Before doing anything further I tried to render all the bone correctly.   Here is the Grey Guy's bone looks like in Spriter: But what I got in my game is something like:   There is a serious twist in the result I got, and I am not sure what goes wrong, seem it is related to non-uniform scale we have in greyguy skeleton.     What I have done basically can be break done into following step: Get the Matrix of each bone by reading scml data. following code is related to bone matrix calculation. void Transform::ToMatrix( glm::mat4& mat ) const{     glm::mat4 scale(1.0f);     scale = glm::scale(scale, m_scale);     glm::mat4 rot = glm::toMat4(m_rot);     glm::mat4 trans = glm::translate(glm::mat4(1.0f), m_trans);     Matrix::Multiply(scale, rot, mat);     Matrix::Multiply(mat, trans, mat);}void Matrix::Multiply( const glm::mat4& mat1, const glm::mat4& mat2, glm::mat4& output ){     output = mat2 * mat1;} Get the bone join coordinate by I am just doing (0.0, 0.0, 0.0, 1.0) * localMat * ParentMat1 * ..... ParentMatN   Can you guys give me some lead about how could I fix this issue?  
  6. Like
    asahi got a reaction from Stephensax in Need help on bone twisted issue.   
    Hi, 
        Recently I have tried to integrate Spriter to my game by rendering it by myself. Before doing anything further I tried to render all the bone correctly.   Here is the Grey Guy's bone looks like in Spriter: But what I got in my game is something like:   There is a serious twist in the result I got, and I am not sure what goes wrong, seem it is related to non-uniform scale we have in greyguy skeleton.     What I have done basically can be break done into following step: Get the Matrix of each bone by reading scml data. following code is related to bone matrix calculation. void Transform::ToMatrix( glm::mat4& mat ) const{     glm::mat4 scale(1.0f);     scale = glm::scale(scale, m_scale);     glm::mat4 rot = glm::toMat4(m_rot);     glm::mat4 trans = glm::translate(glm::mat4(1.0f), m_trans);     Matrix::Multiply(scale, rot, mat);     Matrix::Multiply(mat, trans, mat);}void Matrix::Multiply( const glm::mat4& mat1, const glm::mat4& mat2, glm::mat4& output ){     output = mat2 * mat1;} Get the bone join coordinate by I am just doing (0.0, 0.0, 0.0, 1.0) * localMat * ParentMat1 * ..... ParentMatN   Can you guys give me some lead about how could I fix this issue?  
  7. Like
    asahi got a reaction from Arrgincey in Need help on bone twisted issue.   
    Hi, 
        Recently I have tried to integrate Spriter to my game by rendering it by myself. Before doing anything further I tried to render all the bone correctly.   Here is the Grey Guy's bone looks like in Spriter: But what I got in my game is something like:   There is a serious twist in the result I got, and I am not sure what goes wrong, seem it is related to non-uniform scale we have in greyguy skeleton.     What I have done basically can be break done into following step: Get the Matrix of each bone by reading scml data. following code is related to bone matrix calculation. void Transform::ToMatrix( glm::mat4& mat ) const{     glm::mat4 scale(1.0f);     scale = glm::scale(scale, m_scale);     glm::mat4 rot = glm::toMat4(m_rot);     glm::mat4 trans = glm::translate(glm::mat4(1.0f), m_trans);     Matrix::Multiply(scale, rot, mat);     Matrix::Multiply(mat, trans, mat);}void Matrix::Multiply( const glm::mat4& mat1, const glm::mat4& mat2, glm::mat4& output ){     output = mat2 * mat1;} Get the bone join coordinate by I am just doing (0.0, 0.0, 0.0, 1.0) * localMat * ParentMat1 * ..... ParentMatN   Can you guys give me some lead about how could I fix this issue?  
  8. Like
    asahi got a reaction from Asuqytrau in Need help on bone twisted issue.   
    Hi, 
        Recently I have tried to integrate Spriter to my game by rendering it by myself. Before doing anything further I tried to render all the bone correctly.   Here is the Grey Guy's bone looks like in Spriter: But what I got in my game is something like:   There is a serious twist in the result I got, and I am not sure what goes wrong, seem it is related to non-uniform scale we have in greyguy skeleton.     What I have done basically can be break done into following step: Get the Matrix of each bone by reading scml data. following code is related to bone matrix calculation. void Transform::ToMatrix( glm::mat4& mat ) const{     glm::mat4 scale(1.0f);     scale = glm::scale(scale, m_scale);     glm::mat4 rot = glm::toMat4(m_rot);     glm::mat4 trans = glm::translate(glm::mat4(1.0f), m_trans);     Matrix::Multiply(scale, rot, mat);     Matrix::Multiply(mat, trans, mat);}void Matrix::Multiply( const glm::mat4& mat1, const glm::mat4& mat2, glm::mat4& output ){     output = mat2 * mat1;} Get the bone join coordinate by I am just doing (0.0, 0.0, 0.0, 1.0) * localMat * ParentMat1 * ..... ParentMatN   Can you guys give me some lead about how could I fix this issue?  
×
×
  • Create New...