T75631: New multires shrinkage problem
The old Subdivide button was behaving as if subdivision modifier was applied on top of the multires. This was the source of shrinkage since the behavior of the limit surface: limit surface of a sparse point from another limit surface makes final result appear smaller. The new behavior is based on propagating delta against base mesh's limit surface to the top level. Effectively, this is as if we've sculpted on old top level and then propagated to the new top level. Differential Revision: https://developer.blender.org/D7505
This commit is contained in:
parent
1625b7c37c
commit
4542b50afc
Notes:
blender-bot
2023-02-14 07:30:31 +01:00
Referenced by issue #77261, Multiresolution modifier creates spikes when subdividing ngon meshes. Referenced by issue #77261, Multiresolution modifier creates spikes when subdividing ngon meshes. Referenced by issue #77261, Multiresolution modifier creates spikes when subdividing ngon meshes.
|
@ -202,7 +202,13 @@ void multiresModifier_subdivide_to_level(struct Object *object,
|
|||
multires_reshape_store_original_grids(&reshape_context);
|
||||
multires_reshape_ensure_grids(coarse_mesh, reshape_context.top.level);
|
||||
multires_reshape_assign_final_coords_from_orig_mdisps(&reshape_context);
|
||||
multires_reshape_smooth_object_grids(&reshape_context);
|
||||
|
||||
/* Free original grids which makes it so smoothing with details thinks all the details were
|
||||
* added against base mesh's limit surface. This is similar behavior to as if we've done all
|
||||
* displacement in sculpt mode at the old top level and then propagated to the new top level. */
|
||||
multires_reshape_free_original_grids(&reshape_context);
|
||||
|
||||
multires_reshape_smooth_object_grids_with_details(&reshape_context);
|
||||
multires_reshape_object_grids_to_tangent_displacement(&reshape_context);
|
||||
multires_reshape_context_free(&reshape_context);
|
||||
|
||||
|
|
|
@ -166,6 +166,7 @@ bool multires_reshape_context_create_from_subdivide(MultiresReshapeContext *resh
|
|||
struct MultiresModifierData *mmd,
|
||||
int top_level);
|
||||
|
||||
void multires_reshape_free_original_grids(MultiresReshapeContext *reshape_context);
|
||||
void multires_reshape_context_free(MultiresReshapeContext *reshape_context);
|
||||
|
||||
/* ================================================================================================
|
||||
|
|
|
@ -236,7 +236,7 @@ bool multires_reshape_context_create_from_subdivide(MultiresReshapeContext *resh
|
|||
return context_verify_or_free(reshape_context);
|
||||
}
|
||||
|
||||
static void free_original_grids(MultiresReshapeContext *reshape_context)
|
||||
void multires_reshape_free_original_grids(MultiresReshapeContext *reshape_context)
|
||||
{
|
||||
MDisps *orig_mdisps = reshape_context->orig.mdisps;
|
||||
GridPaintMask *orig_grid_paint_masks = reshape_context->orig.grid_paint_masks;
|
||||
|
@ -259,6 +259,9 @@ static void free_original_grids(MultiresReshapeContext *reshape_context)
|
|||
|
||||
MEM_SAFE_FREE(orig_mdisps);
|
||||
MEM_SAFE_FREE(orig_grid_paint_masks);
|
||||
|
||||
reshape_context->orig.mdisps = NULL;
|
||||
reshape_context->orig.grid_paint_masks = NULL;
|
||||
}
|
||||
|
||||
void multires_reshape_context_free(MultiresReshapeContext *reshape_context)
|
||||
|
@ -267,7 +270,7 @@ void multires_reshape_context_free(MultiresReshapeContext *reshape_context)
|
|||
BKE_subdiv_free(reshape_context->subdiv);
|
||||
}
|
||||
|
||||
free_original_grids(reshape_context);
|
||||
multires_reshape_free_original_grids(reshape_context);
|
||||
|
||||
MEM_freeN(reshape_context->face_start_grid_index);
|
||||
MEM_freeN(reshape_context->ptex_start_grid_index);
|
||||
|
|
Loading…
Reference in New Issue