Sign in to follow this  
ocaml

skin mesh

Recommended Posts

Looking at the DirectX SDK tutorial 9, especially the Tiny.x file, the entire mesh data is listed after

Frame body {
FrameTransformMatrix {
1.278853,0.000000,-0.000000,0.000000,0.000000,0.000000,1.123165,0.000000,0.000000,-1.470235,0.000000,0.000000,0.135977,2.027985,133.967667,1.000000;;
}
Frame {
FrameTransformMatrix {
1.000000,-0.000000,-0.000000,0.000000,-0.000000,1.000000,0.000000,0.000000,-0.000000,0.000000,1.000000,0.000000,-0.142114,0.000023,-49.556850,1.000000;;
}
Mesh {
the entire mesh data is listed here <-----

It looks to me that the Tiny has only one mesh and the frame Frame should be the one that its pMeshConatiner points at the mesh data.
The rest of the frames would have their pMeshConatiner set to NULL after [font="TimesNewRomanPSMT"]D3DXLoadMeshHierarchyFromX is executed.
SetupBoneMatrixPointers is where I am stumbled upon.

[font="CourierNewPSMT"][size="2"][font="CourierNewPSMT"][size="2"]SetupBoneMatrixPointers(DerivedFrame bone)
{
if (bone->pMeshContainer != NULL)
//create an array of pointers[font="Monospace821BT-Roman"][size="1"][font="Monospace821BT-Roman"][size="1"]

[/size][/font][/size][/font][left] if (bone->pFrameSibling != NULL) SetupBoneMatrixPointers( bone->pFrameSibling) ;[/left]
[left] if (bone->pFrameChild != NULL) SetupBoneMatrixPointers( bone->pFrameChild);[/left]
[left]}[/left]
[left]Don't understand why SetupBoneMatrixPointers is set up as a recursive function. As mentioned above, the bone sibling and child should have no mesh data to point to, based on how the mesh data was set up in the Tiny.x file.[/left]
[left] [/size][/font][/size][/font][/font][/left]

Share this post


Link to post
Share on other sites
[quote name='Buckeye' timestamp='1305666454' post='4812096']
Not all x-files are setup as tiny is. The recursive function you reference was written for the generic x-file format in which it's valid to have a mesh associated with any frame.


[/quote]

Buckeye, thank you for your help, appreciate that.
i would have thought that the mesh data would be declared separately in the .x files. The mesh for the head would be declared in the frame head, the mesh for the leg would be declared in the frame leg, and so on...
Anyway, if a .x file has only a single mesh and its single mesh is declared in let say, the frame Bip01_R_Thigh frame, the only frame that has access to the mesh data would be the frame Bip01_R_Thigh. is that right?
If it is right, this single mesh would only be influenced by the frame Bip01_R_Thigh as it is the only frame matrix that can be set up in the SetupBoneMatrixPointers because of the guard (if (pFrame->pMeshContainer != NULL). Is my thinking right, again?
If it is right, the mesh for the Bip01_R_UpperArm would not move despite the frame Bip01_R_UpperArm is moving.
Or somehow there is a function ( I possibly miss it ) that spilt up a single mesh and allocated the splitted meshes into the corresponding frames.
Thank you for any input.

Share this post


Link to post
Share on other sites
For a statically displayed mesh (no bone animation), the parent structure of the frame to which the mesh belongs is the only relevant data. The transform of the frame it belongs to, combined with the transforms of that frame's parent(s) determine where and with what orientation to display the (static) mesh, usually the bind pose.

For an [i]animated[/i] mesh, however, any number of bones can influence it, usually limited by the capability of the graphics card used to display the animation. In the mesh data (in addition to the vertices, normals, tex coords, etc.) are blocks of data called XSkinMeshHeader and SkinWeights. Those blocks of data determine the maximum number of bones and which bones influence that particular mesh, no matter what frame the mesh belongs to or where in the hierarchy the bone resides. In particular, the SkinWeights data determines how much influence (weighting factor) each bone has on which vertices of that mesh. The AnimationSet data, which appears elsewhere in the file, determines how each bone is animated over time, independent of the mesh or meshes the bones influence. As the bone orientations change over time, they "drag" the mesh vertices with them, according to the skinweights. You can look up more info on those blocks.

EDIT: There is nothing that prevents several meshes from being declared in an x-file, each associated with a different frame. However, just as a general observation, most animation x-files have a single mesh, sometimes belonging to a bone frame, sometimes not. Edited by Buckeye

Share this post


Link to post
Share on other sites
For an [i]animated[/i] mesh, however, any number of bones can influence it, usually limited by the capability of the graphics card used to display the animation. In the mesh data (in addition to the vertices, normals, tex coords, etc.) are blocks of data called XSkinMeshHeader and SkinWeights. Those blocks of data determine the maximum number of bones and which bones influence that particular mesh, no matter what frame the mesh belongs to or where in the hierarchy the bone resides.

Haa... the XSkinMEshHeader.
Once again, Buckeye, thank you for your time and help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this