Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

yanuart

Milkshape & X. files

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

Has anybody uses milkshape to make an animation based on skinnedmesh and export it to an x files ?? If u do, can u tell me about the hierarchy of the animations template (in x files) that it creates. I''m having trouble understanding and load the animation from it.. And most of all how to use it !!!! DirectX sample doesn''t seem to have good documentation on this subject (how animations works)

Share this post


Link to post
Share on other sites
Advertisement
I don''t know anything about the milkshape you''re talking about. But I know how skinnedmesh works. Actually, the sample that comes with D3D has no documentation at all. I can''t explain everything here but I''ll give you a quick hint. Skinned meshes are based on vertex blending. You can refer to DX documentation for the details of vertex blending. With vertex blending, each vertex is influenced by 4 bones (frames) as maximum. The mesh is loaded with the D3DXLoadSkinMeshFromXof. The skin mesh consists of bone combinations, each bone combination has 4 references to bones (frames) that affect that bone combination. The bone combination also has a reference to the material. So, what you need to do is to load the frames hierarchy, load the mesh and then link each bone combination of that mesh to the specified frame in the hierarchy according to the names (string) supplied with those frames. After you load the mesh, you generate a blended mesh from it using the ConvertToBlendedMesh member function of ID3DXSkinMesh. When you render, you loop over the bone combination and with each combination, you set the transformation matrices using the D3DTS_WORLDMATRIX(n) macro, set the material and then render. Animation is done by changing the transformation matrix of each bone. Each bone has a set of animation keys that specifies how the transformation is changed over time. The animation is not complex at all but you need first to understand the structure of skinned meshes. I prefer that you go and take a look at the SkinnedMesh sample that comes with D3D. I''ve already read that sample so if you have any question about it, just ask.

Share this post


Link to post
Share on other sites
DO you know how the x files of the skinnedmeshes sample was build ? (I mean what kind of animation tools and exporter it used to create it ??)

Share this post


Link to post
Share on other sites
As far as i know, there isn''t an animation program for xfiles. Maybe there is but with skinned mesh you do all of the animation yourself. If you want to move the head up, i don''t think there''s a program that will program that in. You will probobly have to move the bone

Share this post


Link to post
Share on other sites
Of course there is a program. How about using 3D Max? You can find a plugin that exports 3D Max meshes to x files. This plugin comes with the DX8 SDK. You can also download it from www.microsoft.com. I have tried this plugin with 3D Max and Character Studio and it worked.

Share this post


Link to post
Share on other sites
Great !!!
I''ve been using the same programs also (MAX n the exporter from SDK), but can somebody tell me how to understand the animation data from the x file that it made ??
I''m having trouble understand about how the animation key templates works and the data that it brings (time n bones)
thx

ps : FantasyGuy, you''ve been a great help !!! thanks a lot

Share this post


Link to post
Share on other sites
Sorry to bother u again FantasyGuy, I hope u have enough patience to answer my stoopid questions
Well, I want to know what kind of informations needed to construct a skinned mesh. I look the code from the SDK but I can''t understand it completely, so may be u can fill in the blanks..
So here they are
// Skin info
D3DXATTRIBUTERANGE *m_pAttrTable;
D3DXMATRIX** m_pBoneMatrix;
LPD3DXBUFFER m_pBoneNamesBuf;
LPD3DXBUFFER m_pBoneOffsetBuf;
D3DXMATRIX* m_pBoneOffsetMat;
DWORD* m_rgiAdjacency;
DWORD m_numBoneComb;
DWORD m_maxFaceInfl;
LPD3DXBUFFER m_pBoneCombinationBuf;
METHOD m_Method;
DWORD m_paletteSize;
BOOL m_bUseSW;
these struct is taken form the code btw..
so any explanations will be great as I myself still trying to figure it out ...

Share this post


Link to post
Share on other sites
As you know, skinned meshes consists of bones (or frames). Each frame has a transformation matrix as you know. The animation keys deal with the transformation matrix of these frames. Because the skinned mesh is connected to the frames, as soon as you change the transformation matrix of the frame, the skinned mesh will animate accordingly.
Animation keys deals with frames, hence, it''s not limited to skinned meshes. Even if the x file contains normal meshes instead of skinned meshes, the animation keys will work on these meshes. Each Animation template contains one reference to a frame which is the frame to be animated. From this reference you can get the frame data and then extract the frame name from this data. After getting the name, you should search your loaded frame hierarchy for a frame with the same name. After you get a pointer to the specified frame, you can store it to be used later by this animation key. The Animation template contains also one or more AnimationKey templates. Each animation key contains values for the transformation along with the relative time. The way these values are stored are specified in the documentation of DX in the section ''X File Templates''. For example, if we have a matrix animation key with 5 matrices at times, say, 100, 200, 300, 400, and 500. Then, at time 100, we should set the first matrix as the transformation matrix of the frame, at time 200 we set the second and so on.

Share this post


Link to post
Share on other sites
I''ll give you a quick explanation of the variables you mentioned.

m_pAttrTable: The attribute table, it''s actually neglected. I don''t know why did they put it. I removed it and the program continued to work fine.

m_pBoneMatrix: An array of pointers to the frames'' transformation matrices used by this skinned mesh.

m_pBoneNamesBuf: This is where the bone names are stored. This is used at initialization to construct m_pBoneMatrix.

m_pBoneOffsetBuf: This buffer contains the offset matrix. The offset matrix transforms the coordinates into the bone''s local coordinates. It should be multiplied by the bone matrix before being set as the world transformation matrix.

m_pBoneOffsetMat: This is the offset matrices extracted from m_pBoneOffsetBuf.

m_rgiAdjacency: Buffer containing the index of the adjacent polygons of each polygon. It''s needed by the GenerateSkinnedMesh function, which is in turn needed to generate a mesh from which the count of attributes used by this mesh is obtained. This is used only in software vertex blending in which the program generate a blended mesh at each frame.

m_numBoneComb: Number of bone combinations. Bone combinations table specifies which part of the mesh is to be drawn with which materials and to be transformed by which matrices. The render code loops on this table to draw the whole mesh.

m_maxFaceInfl: Specifies the maximum number of bones that influnces part of the mesh. This is used to check whether the hardware can support the number of influnces of this mesh. In case the hardware cannot support the whole mesh, the program splits the mesh into a hardware part and a software part.

m_pBoneCombinationBuf: The buffer that contains the bone combinations. Actually, this is the core of the skinned mesh functionality. The render function loops on every element in this mesh and set the world matrices (bone matrices) and the material and then call the DrawSubset function.

m_Method: The method of vertex blending. The sample enables the user to choose the method of vertex blending from the menu. It''s simply reflected here.

m_paletteSize & m_bUseSW: I don''t know. I Haven''t seen them before.

Share this post


Link to post
Share on other sites
BTW. I know there are 2 different exporters for Milkshape that generate X files. I wrote one, and John Thompson wrote the other. You can find Milkshape at:

http://www.swissquake.ch/chumbalum-soft/

Thanks
Generic Bum

Share this post


Link to post
Share on other sites

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