Fix T50718: Regression: Split Normals Render Problem with Cycles

The issue seems to be caused by vertex normal being re-calculated
to something else than loop normal, which also caused wrong loop
normals after re-calculation.

For now issue is solved by preserving CD_NORMAL for loops after
split_faces() is finished, so render engine can access original
proper value.
This commit is contained in:
Sergey Sharybin 2017-02-20 11:56:02 +01:00
parent 75ce4ebc12
commit 696836af1d
2 changed files with 3 additions and 5 deletions

@ -80,7 +80,6 @@ static inline BL::Mesh object_to_mesh(BL::BlendData& data,
} }
else { else {
me.split_faces(); me.split_faces();
me.calc_normals_split();
} }
} }
if(subdivision_type == Mesh::SUBDIVISION_NONE) { if(subdivision_type == Mesh::SUBDIVISION_NONE) {

@ -2334,6 +2334,9 @@ static void split_faces_split_edges(Mesh *mesh,
/* Split faces based on the edge angle. /* Split faces based on the edge angle.
* Matches behavior of face splitting in render engines. * Matches behavior of face splitting in render engines.
*
* NOTE: Will leave CD_NORMAL loop data layer which is
* used by render engines to set shading up.
*/ */
void BKE_mesh_split_faces(Mesh *mesh) void BKE_mesh_split_faces(Mesh *mesh)
{ {
@ -2377,10 +2380,6 @@ void BKE_mesh_split_faces(Mesh *mesh)
/* Perform actual split of vertices and adjacent edges. */ /* Perform actual split of vertices and adjacent edges. */
split_faces_split_verts(mesh, num_new_verts, vert_flags); split_faces_split_verts(mesh, num_new_verts, vert_flags);
split_faces_split_edges(mesh, num_new_edges, edge_flags); split_faces_split_edges(mesh, num_new_edges, edge_flags);
/* CD_NORMAL is expected to be temporary only, and it's invalid at
* this point anyway.
*/
CustomData_free_layers(&mesh->ldata, CD_NORMAL, mesh->totloop);
MEM_freeN(vert_flags); MEM_freeN(vert_flags);
MEM_freeN(edge_flags); MEM_freeN(edge_flags);
#ifdef VALIDATE_MESH #ifdef VALIDATE_MESH