Fix T82074: Volume to Mesh normals are inverted

OpenVDB seems to have a different winding order convention.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D9434
This commit is contained in:
Jacques Lucke 2020-11-03 13:59:33 +01:00
parent df2a0cd6f4
commit 3c953a1b09
Notes: blender-bot 2023-02-14 06:47:29 +01:00
Referenced by issue #82074, Mesh to Volume flip normals for mesh when exported and wrong dislpace modifier texture coordinates
1 changed files with 4 additions and 2 deletions

View File

@ -237,7 +237,8 @@ static Mesh *new_mesh_from_openvdb_data(Span<openvdb::Vec3s> verts,
mesh->mpoly[i].loopstart = 3 * i;
mesh->mpoly[i].totloop = 3;
for (int j = 0; j < 3; j++) {
mesh->mloop[3 * i + j].v = tris[i][j];
/* Reverse vertex order to get correct normals. */
mesh->mloop[3 * i + j].v = tris[i][2 - j];
}
}
@ -248,7 +249,8 @@ static Mesh *new_mesh_from_openvdb_data(Span<openvdb::Vec3s> verts,
mesh->mpoly[poly_offset + i].loopstart = loop_offset + 4 * i;
mesh->mpoly[poly_offset + i].totloop = 4;
for (int j = 0; j < 4; j++) {
mesh->mloop[loop_offset + 4 * i + j].v = quads[i][j];
/* Reverse vertex order to get correct normals. */
mesh->mloop[loop_offset + 4 * i + j].v = quads[i][3 - j];
}
}