Advertisement Jump to content
Sign in to follow this  
Solid_Spy

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

This topic is 1857 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!