Jump to content

  • Log In with Google      Sign In   
  • Create Account

Skeletal Mesh has a Strange Error. Can Anyone Help Me Out?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Solid_Spy   Members   -  Reputation: 452

Like
0Likes
Like

Posted 16 December 2013 - 05:52 AM

Hello, I have been trying to get a Skeletal Mesh to stay in the Bind Pose. I'm trying to calculate the correct Final Matrices to send to the Vertex Shader. I'm not too worried about the Vertex Shader right now. I just want to get the right Final Matrices. I should be getting Identity Matrices, since I don't want the Model to move at all, but I always get different Matrices.

 

I am loading my data from Assimp, and have looked all over the internet on how to use Skeletal Animation with it, and I've come back empty handed. I know i'm getting the data loaded correctly. I Transposed the Matrices, since that was the only thing to get it to come close, and I made sure the bones were loaded in Hierarchial order. Here is my code:

void Skeleton::readNodeHierarchy(int bone, int Parent)
{
	glm::mat4 identity(1.0f, 0.0f, 0.0f, 0.0f,
	0.0f, 1.0f, 0.0f, 0.0f,
	0.0f, 0.0f, 1.0f, 0.0f,
	0.0f, 0.0f, 0.0f, 1.0f);
	if(Parent == -1)
	{
		globalTransforms[bone] = joints[bone].relativePose;
	}
	else
	{
		//globalTransforms[i] = identity;
		globalTransforms[bone] = joints[bone].relativePose *globalTransforms[Parent];
	}
	finalMatrices[bone] =globalTransforms[bone] *joints[bone].bindPose;
	if(bone >= numBones - 1)
	{
	}
	else
	{
		readNodeHierarchy(bone + 1, joints[bone + 1].parentIndex);
	}
}

This somewhat works, but I get a really distorted mesh, still small enought to fit on the screen (looks creepy), and I don't get Identity Matrices by Default. Can Someone Please Help Me out Here? I want to know How to generate Identity Matrices correctly.


Edited by Solid_Spy, 16 December 2013 - 05:52 AM.


Sponsor:

#2 Solid_Spy   Members   -  Reputation: 452

Like
0Likes
Like

Posted 16 December 2013 - 06:11 AM

Never mind, apparently I had the inverseBindPose and RelativePose Switched.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS