PDA

View Full Version : Calculating Bone strength on a mesh point



bamboy
04-20-2008, 03:28 PM
I wrote a x-file exporter plug-in for myself, largely so I could have a Mac Universal Binary way of exporting from LW to .x. Writing your own plug-in sure is nice because you can throw all kinds of custom processing in there!

Anyway, in .x, each bone has a SkinWeights block which holds the strength of a bones effect on each mesh point as a value between 0 and 1.0. This works fine with "Use Weight Map Only" and a weight map that has the bone strength set manually. Now I'm trying to see if there is a way of calculating the bones effect on each mesh point without using a predefined weight map. I am assuming that LW internally is calculating the distance between each mesh point and either the center of the bone or the nearest point on the bone and then using the falloff to calculate the strength of the bones effect on the mesh point.

So far I've managed to figure out the distance between each mesh point and the bones origin but my head is starting to hurt. Does LW use the bone center or the closest point on the bone to calculate falloff? Has anyone ever done something like this? Is there an easier way?

I'd appreciate any advise. Thanks!
Bamboy

Jarno
04-20-2008, 10:08 PM
It uses closes point on the bone. The bone is considered a line segment.

---JvdL---

bamboy
04-21-2008, 03:38 PM
That makes sense. Thanks!

I have another question, this time about falloff. If you don't manually set the min and max distances for falloff, what does LW use for those values when calculating the bone effect falloff. I need to set default values for the falloff equations I'm using. Anyone?