Chris
Member
|
Manual Rigging in Code
Hi,
I'm doing work in custom deformations & rigging; i've got most of the new theory sorted, just need to understand the basics of doing this in esenthel to demonstrate a good result. After importing a mesh with uvw's, I want to:
i. Create a skeleton using a custom interface (already made).
ii. Specify some additional custom constraints on the bones (rotational limit, & some energy functions) - only made in a non-esenthel test.
iii. Reassign all vertex weights using a custom algorithm.
Questions:
1. Is the best way to do this: Create a CSkeleton, add a new Skeleton, add some bones to the Skeleton, Sort the bones?
2. Do I just clamp/dampen the rotations/other constraints in the update loop, or is there a more elegant place to do this? (i'm not talking about secondary deformation constraints on GPU)
3. I'm quite worried about weight assignment, as I searched "weight" and couldn't find anything on how to access it in esenthel. It's really important for my research. How can I change vertex weights, to bones, in code?
Thanks,
Chris
|
|
08-28-2010 11:47 PM |
|
Esenthel
Administrator
|
RE: Manual Rigging in Code
1. create skeleton, setup bones, sort them
create cskeleton from ready skeleton
3. MeshBase::matrix,blend (blend is 0..1 between first and second bone, which is matrix.x, matrix.y)
|
|
08-29-2010 01:28 PM |
|
Chris
Member
|
RE: Manual Rigging in Code
Thank you!! I'm so relieved about 3, although still a little unclear. Just to clarify setup:
body->base(0).vtx[i].matrix->x = (Byte)Bone1upHierarchy
body->base(0).vtx[i].matrix->y = (Byte)Bone2downHierarchy
body->base(0).vtx[i].blend = 0.5f // (Rubber: between both bones).
Is that correct? (Sounds extremely simple compared to other implementations)
Is there anything else I can do (know about) with the matrix data?
PS, this work will be released in a paper and demo program for people to use in aid of 'the rigging problem'. Looking forward to releasing it.
(This post was last modified: 08-29-2010 02:44 PM by Chris.)
|
|
08-29-2010 02:44 PM |
|
Esenthel
Administrator
|
RE: Manual Rigging in Code
just please make sure to set correct matrix index value (please check the comments on vtx.matrix), I guess you need to add +1 for bones (comments will explain)
that's all
but you can also read this http://www.esenthel.com/wiki/index.php?t...n_Relation
for more info
|
|
08-29-2010 03:15 PM |
|
Chris
Member
|
RE: Manual Rigging in Code
Hi, thanks that was really useful. My progress is going well, but i've come across another little thing:
I have a MeshBase (this part must be CPU based) and I need to do something like this:
For each triangle in MeshBase :
Calculate area.
Perform some operations on triangle vertexes and normals.
Here's what confuses me:
Code:
REP(base.tris()) {
Tri tri = Tri(base.vtx.pos[base.tri.ind[i].x],
base.vtx.pos[base.tri.ind[i].y],
base.vtx.pos[base.tri.ind[i].z]);
drawString(S+tri.area());
}
Area always returns 0.000 - in debug the watch shows "8.3262930e-006" for area. I'm so confused.
EDIT: Is there something wrong with tri.area() - or am I just doing something silly? As I just tested drawing the tri, and it draws perfectly yet still tri.area() returns 0 or a funny number in debug. EDIT: Ah, think it was just me printing as a Flt rather than Dbl - areas are very small.
(This post was last modified: 09-01-2010 12:34 AM by Chris.)
|
|
08-31-2010 12:28 PM |
|