Currently we have options to transfer the paint mask, face sets, and color attributes to the new mesh created by voxel remesh. This doesn't make use of the generic attribute design, where it would be clearer to transfer all attributes with the same methods. That's reflected in the code as well-- we do duplicate work for the mask and vertex colors, for example. This commit replaces the transfer options with a single checkbox for all attributes. All attribute types on all domains are transferred with basically the same method as the "Sample Nearest" node from geometry nodes-- they take the value from the nearest source element of the same domain. Face corners are handled differently than before. Instead of retrieving the mixed value of all the corners from the nearest source vertex, the value from the nearest corner of the nearest face. --- Some timing information, showing that when interpolating the same data, the attribute propagation is significantly faster than before. Edge and corner attributes would add some cost (edges more than corners), but might not always be present. Before ``` voxel_remesh_exec: 3834.63 ms BKE_shrinkwrap_remesh_target_project: 1141.17 ms BKE_mesh_remesh_reproject_paint_mask: 689.35 ms BKE_remesh_reproject_sculpt_face_sets: 257.14 ms BKE_remesh_reproject_vertex_paint: 54.64 ms BKE_mesh_smooth_flag_set: 0.15 ms ``` After ``` voxel_remesh_exec: 3339.32 ms BKE_shrinkwrap_remesh_target_project: 1158.76 ms mesh_remesh_reproject_attributes: 517.52 ms ``` Pull Request: https://projects.blender.org/blender/blender/pulls/115116
33 lines
734 B
C
33 lines
734 B
C
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/** \file
|
|
* \ingroup DNA
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
/* Struct members on own line. */
|
|
/* clang-format off */
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
/** \name Mesh Struct
|
|
* \{ */
|
|
|
|
#define _DNA_DEFAULT_Mesh \
|
|
{ \
|
|
.texspace_size = {1.0f, 1.0f, 1.0f}, \
|
|
.texspace_flag = ME_TEXSPACE_FLAG_AUTO, \
|
|
.remesh_voxel_size = 0.1f, \
|
|
.remesh_voxel_adaptivity = 0.0f, \
|
|
.face_sets_color_seed = 0, \
|
|
.face_sets_color_default = 1, \
|
|
.flag = ME_REMESH_REPROJECT_VOLUME | ME_REMESH_REPROJECT_ATTRIBUTES, \
|
|
.editflag = ME_EDIT_MIRROR_VERTEX_GROUPS \
|
|
}
|
|
|
|
/** \} */
|
|
|
|
/* clang-format on */
|