Joint-relative vertex positions
-
On 25/10/2016 at 06:49, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R16
Platform: Mac OSX ;
Language(s) : C++ ;---------
Hello,I'm coding an exporter plug-in which exports a rigged model, and while exporting the skeleton works quite well, actually, I'm having trouble coding the "binding" of the mesh to the skeleton, aka the "skinning".
I get the gist of it; multiply the vertices in world-space by the respective joint's inverse global matrix, which works with vertices affected by a single joint, but the more joints affect the vertex, the more it gets distorted (factoring in their weights).
Of course, the process of skinning is well-documented, but it seems like I don't understand what input data is necessary and/or how to extract these from Cinema.
Now, I know this has nothing to do with the SDK itself, so my question is rather whether it's possible to extract the bound vertex coordinates Cinema uses itself.
Again, I hope this isn't too unrelated to the SDK.
Thanks in advance,
Mark -
On 27/10/2016 at 08:15, xxxxxxxx wrote:
Hello,
honestly, I'm no expert on this topic so right now I don't know more about this than you do. Can you explain a little bit more what exactly you are doing and what you need? Maybe can you show some code that illustrates the issue?
best wishes,
Sebastian -
On 27/10/2016 at 10:21, xxxxxxxx wrote:
Thanks for your reply,
there isn't much code I can show since the SDK-related process works without problems.
Basically, what I do is take a rigged PolygonObject, export its points, polygons, the weight map and the joints into an extern program, where I try to display the rigged model. Now, it would be necessary to re-rig the model in the extern program using "vertex skinning", as described here. This is where I have trouble doing this myself.
To put it in few words: translate each point by the inverse global matrix multiplied by the weight value of each affecting joint, when animating/rendering translate the translated point by each joint's global matrix multiplied by the weight value.
With just one joint, this works flawlessly, but I can't get it to work with multiple joints.
Since I have so much trouble doing this myself, I thought that maybe it's possible to use data Cinema itself, instead calculating it myself.
What I need is the data Cinema uses to modify the rigged model from this (in rest state) :
to this:
I hope this makes my question clearer.
-
On 23/03/2017 at 09:29, xxxxxxxx wrote:
Hello
Sorry for the late reply. Have you had a breakthrough with your problem ?
When you say
"when animating/rendering translate the translated point by each joint's global matrix multiplied by the weight value. "
are you doing this for each joint then adding the results ? Cause I think this would definitely not produce good results. Instead you would have to multiply the weight value by a joint's displacement relative to it's original position. You will apply a certain ratio (the weight value) to the displacement. The "ratioed" displacement can be added to the original position of the point.It's a bit hard to decode what we assume you are doing in your own software with data extracted with the sdk. A suggestion would be to try to reproduce the problem with sdk code so you could send us a code snippet. I.e. reproduce a sample of what your external program is doing using the sdk code, just try to take a sample point and apply the weight values from all joints on it, see if the final result is good.
Phil