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/modifiers/intern/MOD_multires.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/modifiers/intern/MOD_multires.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_multires.c | 20 |
1 files changed, 13 insertions, 7 deletions
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, |