# Skeleton and its Mesh

This topic is 5044 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Ok, Im not quite up with all my math, but im working with a modified hl2 smd exporter to export from 3dsmax. I export and render skeleton fine, I also can export the faces/verts fine. The only problem is they are in there won Object Space which means while i know which parent they are related to for bones. I need to convert it from the meshes object space to the specific bones space don't I? How else would I be able to use the rotatiosn and transformation of the skeleton to move the verticies? Thanks for all your input this is my final hurdle I hope -Maz

##### Share on other sites
I have to test this, but i had an idea.
Since all my faces/verts are in world space, but all my bones are in local space. I need to find the world space of my bones. For each bone I would start at the origin as the vertex. Then multiply that vertex throughout the bone structure until I reached the bone I wanted. The resulting vertex would be the world space correct? Then I would just do that for 2 keyframes, Subtract the difference in where the vertices were and then add that to each mesh vertex that had the bone as its parent?

OR

In the 3dsmax exporter to get the bones into there own local space i have
Matrix3 mat3NodeTM = pnode->GetNodeTM(m_tvToDump);
Matrix3 mat3NodeLocalTM = mat3NodeTM * Inverse(mat3ParentTM);

I assume the first line get the bones world space?
Then to get the local you just mult the world space by the inverse of the parent??

Will either of these work?

-Maz

##### Share on other sites
to translate world coordinates into bone coordinates, you have to do:
Local Coord Point = InvMatBone * World Coord Point;
InvMatBone is the inverse of the bone matrix.

in your case, get the Matrix of your bone in object space, inverse it, and multiply it by the world coordinates.

##### Share on other sites
how did you get a hold of the smd format specs? (id like them :-D) thanks
-Dan

##### Share on other sites
Ok, im not able to export the matrix based off the origin, not the parent, but now my problem is more Converting the vertex from world space to the bones specific local space, so would i multiply the inverse of the bones matrix by the vertex? Ill try it and hopefully it will work??

Also for Dan

Its in the SDK, which well as long as you have purchased HL2 you get access to them, they are also im pretty sure the same as HL1 except you can use multiple bones per vertex. The SDK has the source to the .smd exporter. Its very simple, the one part that is complicated is the studiomdl, which is what converts the raw .smd data into the .mdl data for HL. Im trying to use the smd exporter to then pretty much create my own format but simpler. Im mainly using it as refernce becuase its hard to find info on the max sdk. If you need any help with it i shoudl be able to try to lend you a hand

-Maz

##### Share on other sites
ah, thanks, yeah i had done a bit of rooting around in the sdk, but apparently i didnt look hard enough :-/ ill take another look though, thanks
-Dan

##### Share on other sites
If you created a mod, or told it to create a mod and everything, i created mine with testmod name
C:\TestMod\src\utils\smdlexp
that is where the exporter source is. so its in your mod directory/src/utils/smdlexp

just incase you can't find it

1. 1
Rutin
45
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632999
• Total Posts
3009814
• ### Who's Online (See full list)

There are no registered users currently online

×