Jump to content
  • Advertisement
Sign in to follow this  
fuchiefck

Problem with meshes in a mesh hierarchy

This topic is 4884 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, I'm a newbie to directx and also a newbie to this forum... I am stuck at something and hope I can find an answer with everyone's help. well, here it is: I am trying to make a "Paper doll system" with meshes (X file). What I mean is I am trying to load a model of a person, and then change its body parts or clothes with another mesh, say.. I want to replace the hair with another hair of some other shape. My mesh is already divided and named into different parts, eg Body, Head, Hair, L_UpperArm, and so forth. Currently I have the ability to catch the program when it is rendering certain parts, eg: if (strcmp(pFrame->Name, "Hair") == 0) { //don't render } This, of course will result in a model of a bald person. The next step is, I want to load another mesh of just the hair, and when the program is rendering the hair, I want to let it render the new hair instead of the old hair. So I tackled this by loading the hair mesh and storing the pMesh pointer somewhere accessible by my main class, and then when its rendering the Hair mesh container, I clone the old mesh with the new mesh: if (strcmp(pFrame->Name, "Hair") == 0) { pNewMesh->CloneMeshFVF(pNewMesh->GetOptions(), pNewMesh->GetFVF(), pd3ddevice, &pMeshContainer->MeshData.pMesh); } //continue with rendering And heres the problem, the new mesh (the new hair) appears, but its position is wrong. To my understanding, the Frame and the meshcontainer data is unchanged, the only thing changed is the pMesh pointer that it uses to render. So I thought the new mesh is still in the original mesh container, but obviously I may be wrong. also, the sometimes animation is also wrong. I tried to tackle this problem by checking if the frame matrices are setup and updated properly, but as I said before, all the frame and mesh container data still remains original, only the pMesh is changed in the Hair's mesh container. So the frame matrices remains the same. Hope someone here can provide some help, or share ur experiences if you've ever tried to do something like this. Thx btw most of my code is copied and modified from the SkinnedMesh sample of the DX9 SDK

Share this post


Link to post
Share on other sites
Advertisement
err... eagerly waiting for someone who can help me out here... please... any help would be greatly appreciated... thank you..

- fuchiefck

Share this post


Link to post
Share on other sites
hm have you set the transform?
if not this is how you do it: take the combined transform of the current frame (bone) and multiply it with your world transform for the object, and then just set this new transform.
dont think you need to copy the mesh like that neither, just render it when the transform is set.

Share this post


Link to post
Share on other sites
Thanks for your reply chot... Yes I have multiplied my matrices, like the way the SkinnedMesh Sample in the SDK does, which is the same as your suggestion. I think why my new mesh, the Hair, is out of place is because it was not placed in the center when the artist drew it, thats why theres an offset when i render it... is my assumption correct..?

thanks

-fuchiefck

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!