Blender Git Loki
Git Commits -> Revision b558cd2
Revision b558cd2 by Kévin Dietrich (subdivision_work) June 8, 2021, 02:38 (GMT) |
Subdivision: add support for vertex creasing This adds vertex creasing support for modeling, rendering, and Alembic IO. This is only implemented for OpenSubDiv. For modeling, vertex creasing follows the edge creasing implementation with an operator accessed through the Vertex menu in Edit Mode, and some parameter in the properties panel. Also added options to the Subsurf and Multires modifiers to disable vertex creasing, the existing option is only affecting edge creasing. Not sure if this is desirable, but I think it makes sense to separate them, as it can help people understand and study the effects of each of them. For Cycles this adds a couple of sockets on the Mesh node to hold data about which vertices are creased (one socket for the indices, one for the weigths). We could have a single socket with a value for every vertex, but this helps reducing memory usage a bit. Crease weights for vertices are then merged with the ones for edge creasing when setting up data for OpenSubDiv. For rendering vertex creasing in the viewport in Edit Mode, I tried to have a similar rendering as for edge creasing, that is with a colored outline, but I could not get it to work properly, so I resorted to mixing the vertex selected color with the edge crease color so the creasing is shown to emanate from the vertices, along the edges. If both vertices of an edge are creased, this would render the edge as creased. This needs improvement. To support rendering vertex and edge creases differently, `EditLoopData` was modified to hold `ushorts` instead of `uchars` in order to store more bit flags as all available bits in `EditLoopData.e_flag` were used. (For those unaware, this structure maps to an `ivec4` in the GLSL shader, so adding another member to hold vertex creasing is not really possible.) For Alembic, vertex creases are read and written in a similar fashion as edge creases (vertex creases are called "corners" in Alembic), so this is only written if a subdivision modifier is present on the Blender Mesh. |
Commit Details:
Full Hash: b558cd26f09caf1ac3ea62a1322963e070476f07
Parent Commit: ef5a362
Lines Changed: +452, -75
33 Modified Paths:
/intern/cycles/blender/blender_mesh.cpp (+8, -0) (Diff)
/intern/cycles/render/mesh.cpp (+14, -0) (Diff)
/intern/cycles/render/mesh.h (+4, -0) (Diff)
/intern/cycles/render/mesh_subdivision.cpp (+33, -3) (Diff)
/release/scripts/startup/bl_ui/space_view3d.py (+4, -0) (Diff)
/source/blender/blenkernel/BKE_subdiv.h (+2, -2) (Diff)
/source/blender/blenkernel/intern/customdata.c (+16, -6) (Diff)
/source/blender/blenkernel/intern/multires_reshape.h (+3, -0) (Diff)
/source/blender/blenkernel/intern/multires_reshape_smooth.c (+65, -16) (Diff)
/source/blender/blenkernel/intern/multires_reshape_util.c (+2, -0) (Diff)
/source/blender/blenkernel/intern/subdiv_converter_mesh.c (+10, -5) (Diff)
/source/blender/blenkernel/intern/subdiv_inline.h (+3, -3) (Diff)
/source/blender/bmesh/intern/bmesh_mesh_convert.c (+14, -0) (Diff)
/source/blender/draw/engines/overlay/overlay_edit_mesh.c (+1, -1) (Diff)
/source/blender/draw/engines/overlay/shaders/edit_mesh_common_lib.glsl (+6, -2) (Diff)
/source/blender/draw/engines/overlay/shaders/edit_mesh_vert.glsl (+4, -4) (Diff)
/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c (+18, -8) (Diff)
/source/blender/draw/intern/draw_cache_extract_mesh_private.h (+1, -0) (Diff)
/source/blender/draw/intern/draw_cache_extract_mesh_render_data.c (+1, -0) (Diff)
/source/blender/draw/intern/draw_cache_impl.h (+3, -1) (Diff)
/source/blender/draw/intern/shaders/common_globals_lib.glsl (+2, -0) (Diff)
/source/blender/editors/include/ED_transform.h (+1, -0) (Diff)
/source/blender/editors/space_view3d/view3d_buttons.c (+44, -4) (Diff)
/source/blender/editors/transform/transform_convert_mesh.c (+8, -1) (Diff)
/source/blender/editors/transform/transform_mode.c (+1, -0) (Diff)
/source/blender/editors/transform/transform_mode.h (+1, -0) (Diff)
/source/blender/editors/transform/transform_mode_edge_crease.c (+12, -2) (Diff)
/source/blender/editors/transform/transform_ops.c (+27, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_mesh.cc (+43, -15) (Diff)
/source/blender/io/alembic/intern/abc_reader_mesh.cc (+23, -0) (Diff)
/source/blender/makesdna/DNA_mesh_types.h (+1, -0) (Diff)
/source/blender/makesrna/intern/rna_mesh.c (+75, -0) (Diff)
/source/blender/makesrna/intern/rna_modifier.c (+2, -2) (Diff)
/intern/cycles/render/mesh.cpp (+14, -0) (Diff)
/intern/cycles/render/mesh.h (+4, -0) (Diff)
/intern/cycles/render/mesh_subdivision.cpp (+33, -3) (Diff)
/release/scripts/startup/bl_ui/space_view3d.py (+4, -0) (Diff)
/source/blender/blenkernel/BKE_subdiv.h (+2, -2) (Diff)
/source/blender/blenkernel/intern/customdata.c (+16, -6) (Diff)
/source/blender/blenkernel/intern/multires_reshape.h (+3, -0) (Diff)
/source/blender/blenkernel/intern/multires_reshape_smooth.c (+65, -16) (Diff)
/source/blender/blenkernel/intern/multires_reshape_util.c (+2, -0) (Diff)
/source/blender/blenkernel/intern/subdiv_converter_mesh.c (+10, -5) (Diff)
/source/blender/blenkernel/intern/subdiv_inline.h (+3, -3) (Diff)
/source/blender/bmesh/intern/bmesh_mesh_convert.c (+14, -0) (Diff)
/source/blender/draw/engines/overlay/overlay_edit_mesh.c (+1, -1) (Diff)
/source/blender/draw/engines/overlay/shaders/edit_mesh_common_lib.glsl (+6, -2) (Diff)
/source/blender/draw/engines/overlay/shaders/edit_mesh_vert.glsl (+4, -4) (Diff)
/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c (+18, -8) (Diff)
/source/blender/draw/intern/draw_cache_extract_mesh_private.h (+1, -0) (Diff)
/source/blender/draw/intern/draw_cache_extract_mesh_render_data.c (+1, -0) (Diff)
/source/blender/draw/intern/draw_cache_impl.h (+3, -1) (Diff)
/source/blender/draw/intern/shaders/common_globals_lib.glsl (+2, -0) (Diff)
/source/blender/editors/include/ED_transform.h (+1, -0) (Diff)
/source/blender/editors/space_view3d/view3d_buttons.c (+44, -4) (Diff)
/source/blender/editors/transform/transform_convert_mesh.c (+8, -1) (Diff)
/source/blender/editors/transform/transform_mode.c (+1, -0) (Diff)
/source/blender/editors/transform/transform_mode.h (+1, -0) (Diff)
/source/blender/editors/transform/transform_mode_edge_crease.c (+12, -2) (Diff)
/source/blender/editors/transform/transform_ops.c (+27, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_mesh.cc (+43, -15) (Diff)
/source/blender/io/alembic/intern/abc_reader_mesh.cc (+23, -0) (Diff)
/source/blender/makesdna/DNA_mesh_types.h (+1, -0) (Diff)
/source/blender/makesrna/intern/rna_mesh.c (+75, -0) (Diff)
/source/blender/makesrna/intern/rna_modifier.c (+2, -2) (Diff)