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/modifiers/intern/MOD_multires.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'source/blender/modifiers/intern/MOD_multires.c') diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 53bb579128a..883c17aa1e1 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -228,16 +228,22 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes return result; } -static void deformVerts(ModifierData *md, - const ModifierEvalContext *UNUSED(ctx), - Mesh *mesh, - float (*vertex_cos)[3], - int num_verts) +static void deformMatrices(ModifierData *md, + const ModifierEvalContext *UNUSED(ctx), + Mesh *mesh, + float (*vertex_cos)[3], + float (*deform_matrices)[3][3], + int num_verts) + { #if !defined(WITH_OPENSUBDIV) modifier_setError(md, "Disabled, built without OpenSubdiv"); return; #endif + + /* Subsurf does not require extra space mapping, keep matrices as is. */ + (void)deform_matrices; + MultiresModifierData *mmd = (MultiresModifierData *)md; SubdivSettings subdiv_settings; BKE_multires_subdiv_settings_init(&subdiv_settings, mmd); @@ -268,8 +274,8 @@ ModifierTypeInfo modifierType_Multires = { /* copyData */ copyData, - /* deformVerts */ deformVerts, - /* deformMatrices */ NULL, + /* deformVerts */ NULL, + /* deformMatrices */ deformMatrices, /* deformVertsEM */ NULL, /* deformMatricesEM */ NULL, /* applyModifier */ applyModifier, -- cgit v1.2.3