From abd299513ef9e9a548ab7ad0723bf24f1a340d8e Mon Sep 17 00:00:00 2001 From: chubei Date: Mon, 5 Jul 2021 16:30:38 +0800 Subject: [PATCH] Fix face_normals incorrect shape warning --- code/utils/plots.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/utils/plots.py b/code/utils/plots.py index 773eb5d..71d33e9 100644 --- a/code/utils/plots.py +++ b/code/utils/plots.py @@ -138,7 +138,7 @@ def get_surface_trace(path, epoch, sdf, resolution=100, return_mesh=False): i=I, j=J, k=K, name='implicit_surface', opacity=1.0)] - meshexport = trimesh.Trimesh(verts, faces, normals) + meshexport = trimesh.Trimesh(verts, faces, vertex_normals=-normals) meshexport.export('{0}/surface_{1}.ply'.format(path, epoch), 'ply') if return_mesh: @@ -168,7 +168,7 @@ def get_surface_high_res_mesh(sdf, resolution=100): verts = verts + np.array([grid['xyz'][0][0], grid['xyz'][1][0], grid['xyz'][2][0]]) - mesh_low_res = trimesh.Trimesh(verts, faces, normals) + mesh_low_res = trimesh.Trimesh(verts, faces, vertex_normals=-normals) components = mesh_low_res.split(only_watertight=False) areas = np.array([c.area for c in components], dtype=np.float) mesh_low_res = components[areas.argmax()] @@ -221,7 +221,7 @@ def get_surface_high_res_mesh(sdf, resolution=100): verts.unsqueeze(-1)).squeeze() verts = (verts + grid_points[0]).cpu().numpy() - meshexport = trimesh.Trimesh(verts, faces, normals) + meshexport = trimesh.Trimesh(verts, faces, vertex_normals=-normals) return meshexport