From 342e12d6d92198bba8355562600a2f97bb45fed5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 14 Jan 2021 16:33:52 +0100 Subject: Subdiv: support interpolating orco coordinates in subdivision surfaces This makes changes to the opensubdiv module to support additional vertex data besides the vertex position, that is smootly interpolated the same way. This is different than varying data which is interpolated linearly. Fixes T96596: wrong generated texture coordinates with GPU subdivision. In that bug lazy subdivision would not interpolate orcos. Later on, this implementation can also be used to remove the modifier stack mechanism where modifiers are evaluated a second time for orcos, which is messy and inefficient. But that's a more risky change, this is just the part to fix the bug in 3.2. Differential Revision: https://developer.blender.org/D14973 --- source/blender/blenkernel/intern/DerivedMesh.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/blenkernel/intern/DerivedMesh.cc') diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index 7ca76e72839..6b43fe57e93 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -1180,6 +1180,10 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, BKE_id_free(nullptr, mesh_orco_cloth); } + /* Remove temporary data layer only needed for modifier evaluation. + * Save some memory, and ensure GPU subdivision does not need to deal with this. */ + CustomData_free_layers(&mesh_final->vdata, CD_CLOTH_ORCO, mesh_final->totvert); + /* Compute normals. */ if (is_own_mesh) { mesh_calc_modifier_final_normals(mesh_input, &final_datamask, sculpt_dyntopo, mesh_final); -- cgit v1.2.3