diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-10-04 17:56:42 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-10-07 13:43:57 +0300 |
commit | cc1614123e325235c2ad6d2348ead6c0d4d00c92 (patch) | |
tree | 513a328f18be9e322ccbf50d6ae21cc4ab31cdd0 /source/blender/blenkernel/intern/crazyspace.c | |
parent | d4c452ff3918be8204b7b6bb32fae2cfdc375939 (diff) |
Fix T70476: Sculpting with Subsurf on top produces artifacts
The issue was caused by crazy space distortion orientation happening
for subsurf modifier.
Solved by making it so subsurf only deforms the surface but keeps
matrices as-is. This is not fully mathematically correct, but is better
that the fall-back solution which was doing wrong matrices anyway.
Also, this is closer to have subsurf was handled prior to the
related changes.
Reviewed By: brecht, pablodp606
Differential Revision: https://developer.blender.org/D5991
Diffstat (limited to 'source/blender/blenkernel/intern/crazyspace.c')
-rw-r--r-- | source/blender/blenkernel/intern/crazyspace.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/crazyspace.c b/source/blender/blenkernel/intern/crazyspace.c index 6740fc985e9..fe834658689 100644 --- a/source/blender/blenkernel/intern/crazyspace.c +++ b/source/blender/blenkernel/intern/crazyspace.c @@ -355,7 +355,7 @@ static void crazyspace_init_verts_and_matrices(const Mesh *mesh, BLI_assert(num_verts == mesh->totvert); } -static bool crazyspace_modifier_supports_deform(ModifierData *md) +static bool crazyspace_modifier_supports_deform_matrices(ModifierData *md) { if (ELEM(md->type, eModifierType_Subsurf, eModifierType_Multires)) { return true; @@ -364,6 +364,12 @@ static bool crazyspace_modifier_supports_deform(ModifierData *md) return (mti->type == eModifierTypeType_OnlyDeform); } +static bool crazyspace_modifier_supports_deform(ModifierData *md) +{ + const ModifierTypeInfo *mti = modifierType_getInfo(md->type); + return (mti->type == eModifierTypeType_OnlyDeform); +} + int BKE_sculpt_get_first_deform_matrices(struct Depsgraph *depsgraph, Scene *scene, Object *object, @@ -391,13 +397,12 @@ int BKE_sculpt_get_first_deform_matrices(struct Depsgraph *depsgraph, md = modifiers_getVirtualModifierList(&object_eval, &virtualModifierData); for (; md; md = md->next) { - const ModifierTypeInfo *mti = modifierType_getInfo(md->type); - if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) { continue; } - if (mti->type == eModifierTypeType_OnlyDeform) { + if (crazyspace_modifier_supports_deform_matrices(md)) { + const ModifierTypeInfo *mti = modifierType_getInfo(md->type); if (defmats == NULL) { /* NOTE: Evaluated object si re-set to its original undeformed * state. */ |