Jump to content
  • Advertisement
Sign in to follow this  

Manual parse animated x

This topic is 2918 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

Hi everyone,

I wrote an text-format x file parser. It works with static meshes, but i need animated meshes too.
- I read the skin weights (to std::vector<Skin>, where skin is a custom struct, which contains the name, vertex index vector and vertex weight vector)
- i read the hiearchy (to std::vector<Bone>, where Bone is a custom struct, which contains the name, the bindpose matrix and the parent's id)
- i haven't read the animations yet, because i have a problem

I have an VertexPositionNormalTextureBinormalBone structure (nice name :]), but in the x file the positions, normals, etc. are separated, so i "collect" these datas to a VPNTBB vector

After that
for each skin (std::vector<Skin>)
- i get the bone index (name)
- for each current skin vertices
-- set the current vertex's bone index and weight (Vector4)

I save it to a binary, and in game, i read it. That works, but i have a big problem:
i use vertex skinning with hlsl

float4x4 bones[59];
skinTransform += bones[0] * BoneWeights.y;
skinTransform += bones[1] * BoneWeights.y;
skinTransform += bones[2] * BoneWeights.z;
skinTransform += bones[3] * BoneWeights.w;

This works (all bone are identity matrix), but if i write the bones[0] to bones[BoneIndices.x], my computer restarts!!

I checked that all vertex's bone index is <= 4 (i have a "null parent", so the first bone's index is the 1)

Here is a code, but i think it is maybe complicated, but i hope anyone can help me.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!