From cc1614123e325235c2ad6d2348ead6c0d4d00c92 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 4 Oct 2019 16:56:42 +0200 Subject: 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 --- source/blender/blenkernel/intern/crazyspace.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel/intern/crazyspace.c') 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. */ -- cgit v1.2.3