diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-11-06 21:04:53 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-11-06 21:20:17 +0300 |
commit | f600b4bc67667b867899cac3725ac7ed44bfbfe3 (patch) | |
tree | 145927ae29bd2e5fe2b09228176a9644f143db6f /source/blender/depsgraph | |
parent | 0709fac41ef0a20955069fcd6609577189e96d5c (diff) |
Shrinkwrap: new mode that projects along the target normal.
The Nearest Surface Point shrink method, while fast, is neither
smooth nor continuous: as the source point moves, the projected
point can both stop and jump. This causes distortions in the
deformation of the shrinkwrap modifier, and the motion of an
animated object with a shrinkwrap constraint.
This patch implements a new mode, which, instead of using the simple
nearest point search, iteratively solves an equation for each triangle
to find a point which has its interpolated normal point to or from the
original vertex. Non-manifold boundary edges are treated as infinitely
thin cylinders that cast normals in all perpendicular directions.
Since this is useful for the constraint, and having multiple
objects with constraints targeting the same guide mesh is a quite
reasonable use case, rather than calculating the mesh boundary edge
data over and over again, it is precomputed and cached in the mesh.
Reviewers: mont29
Differential Revision: https://developer.blender.org/D3836
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r-- | source/blender/depsgraph/DEG_depsgraph.h | 6 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h index d3900bc6350..75572a91440 100644 --- a/source/blender/depsgraph/DEG_depsgraph.h +++ b/source/blender/depsgraph/DEG_depsgraph.h @@ -80,7 +80,11 @@ enum { * to meet dependencies with such a things as curve modifier and other guys * who're using curve deform, where_on_path and so. */ - DAG_EVAL_NEED_CURVE_PATH = 1, + DAG_EVAL_NEED_CURVE_PATH = (1 << 0), + /* A shrinkwrap modifier or constraint targeting this mesh needs information + * about non-manifold boundary edges for the Target Normal Project mode. + */ + DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY = (1 << 1), }; #ifdef __cplusplus diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 122f4f7d317..31c16f013f9 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1019,6 +1019,9 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, if (track || BKE_shrinkwrap_needs_normals(scon->shrinkType, scon->shrinkMode)) { add_customdata_mask(target_key, CD_MASK_NORMAL | CD_MASK_CUSTOMLOOPNORMAL); } + if (scon->shrinkType == MOD_SHRINKWRAP_TARGET_PROJECT) { + add_special_eval_flag(&ct->tar->id, DAG_EVAL_NEED_SHRINKWRAP_BOUNDARY); + } } /* NOTE: obdata eval now doesn't necessarily depend on the |