Jump to content
  • Advertisement
Sign in to follow this  

SkinnedMesh directx 9..0

This topic is 3858 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 all. I am using the SkinnedMesh tutorial as a reference for my project. I have managed to open *.x (created using poser) and play the animation sets. The thing is, how can i load multible and different models, do i have to create a new class loading new instanses? C++ is really not my best language.... I have try to read the multianimation project but with no luck :-( Thanks for ur time.

Share this post

Link to post
Share on other sites
One good skinned mesh class should serve you, apoelalex, for most skinned mesh directx x-files.

To load another model, just instantiate another instance of the class, as in:

skinnedMesh1 = new SkinnedMesh(somefile);
skinnedMesh2 = new SkinnedMesh(someotherfile);

or however you have it coded.

EDIT: "instantiate an instance?" -- talk about the Department of Redundancy Department.

Share this post

Link to post
Share on other sites
Thanks for your quick response.

Could you give me some pointers in order to start creating the class.

To understand a bit better, we load models through D3DXLoadMeshHierarchyFromX right?

Share this post

Link to post
Share on other sites
Ok, this what i did so far.

I have created a library named: SkinnedModel.h

#include <d3d9.h>
#include <d3dx9.h>

class CAllocateHierarchy : public ID3DXAllocateHierarchy
// Create Frame
// Create Mesh Container
DWORD NumMaterials,
CONST DWORD *pAdjacency,
// Destroy Frame
STDMETHOD(DestroyFrame)(THIS_ LPD3DXFRAME pFrameToFree);
// Destroy Mesh Container
STDMETHOD(DestroyMeshContainer)(THIS_ LPD3DXMESHCONTAINER pMeshContainerBase);

Share this post

Link to post
Share on other sites
Creating a skinned mesh class from scratch is quite a complicated business. I would recommend playing with the code from the SDK and other sources. Get a good understanding of what the process of loading a skinned mesh requires before starting your own class from scratch.

To create the skinned mesh class I use, I started by examining the skinned mesh example and the multi-animation example in the SDK.

I also used a lot of the routines described in:


to get a good understanding of the features and limitations in creating a skinned mesh. Included in moon-labs information is a good start at a vertex skinning shader. Animation can be done using the fixed function pipeline but a shader is quite a bit faster.

moon-labs may be a good place for you to start. Copy or download the info from there (mlSkinnedmesh) and get it to work.

The mlSkinnedmesh implementation has some limitations (limited number of bone influences, single texture, single animation, etc.) which you may later want to expand on.

For my own class, I ended up with four pretty common classes for skinned meshes:

class AnimationFrame : public D3DXFRAME (contains a combined transform)
class AnimationMeshContainer : public D3DXMESHCONTAINER
class AllocHierarchy : public ID3DXAllocateHierarchy
class VSMesh (my own implementation)

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.

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!