Sign in to follow this  
Solid_Spy

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

Recommended Posts

Solid_Spy    708

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this