diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-07-28 18:04:02 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2007-07-28 18:04:02 +0400 |
commit | 373f91c8b169a4f937ba0a2e53c3646e75461ca6 (patch) | |
tree | 603964a24372aa35315e951e8a3c13ba48dd7706 /source/blender/blenkernel | |
parent | e765fbf1265b35d4091ddbc9560913dc001c5704 (diff) |
Bone Heat Weighting
===================
This is a new automatic vertex weighting method, next to the existing
envelope based method. The details are here:
http://www.blender.org/development/current-projects/changes-since-244/skinning/
This is based on section 4 of the paper:
"Automatic Rigging and Animation of 3D Characters"
Ilya Baran and Jovan Popovic, SIGGRAPH 2007
Implementation Notes:
- Generic code for making mesh laplacian matrices has been added, which
is only used by bone heat weighting at the moment.
- Bone to vertex visibility checking is done with the raytracing code.
- Fixed an issue in the subsurf limit calculation function, where the
position of vertices on boundary edges was wrong. It is still not the
correct position, but at least it's in the neighbourhood now.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 7f3c5ddf8a7..8fc92829258 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -2441,11 +2441,11 @@ struct DerivedMesh *subsurf_make_derived_from_derived( void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3]) { - /* Finds the subsurf limit positions for the verts in a mesh - * and puts them in an array of floats. Please note that the - * calculated vert positions is incorrect for the verts - * on the boundary of the mesh. - */ + /* Finds the subsurf limit positions for the verts in a mesh + * and puts them in an array of floats. Please note that the + * calculated vert positions is incorrect for the verts + * on the boundary of the mesh. + */ CCGSubSurf *ss = _getSubSurf(NULL, 1, 0, 1, 0); float edge_sum[3], face_sum[3]; CCGVertIterator *vi; @@ -2474,6 +2474,11 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3]) VecAddf(face_sum, face_sum, ccgSubSurf_getFaceCenterData(ss, f)); } + /* ad-hoc correction for boundary vertices, to at least avoid them + moving completely out of place (brecht) */ + if(numFaces && numFaces != N) + VecMulf(face_sum, (float)N/(float)numFaces); + co = ccgSubSurf_getVertData(ss, v); positions_r[idx][0] = (co[0]*N*N + edge_sum[0]*4 + face_sum[0])/(N*(N+5)); positions_r[idx][1] = (co[1]*N*N + edge_sum[1]*4 + face_sum[1])/(N*(N+5)); |