INNER CODE UNIT · Python
post_process_mesh
OpenMeshLab/MeshXL · sample_t2m.py:12
def post_process_mesh(mesh_coords: Tensor, filename: str):
mesh_coords = mesh_coords[~torch.isnan(mesh_coords[:, 0, 0])] # nvalid_face x 3 x 3
vertices = mesh_coords.reshape(-1, 3)
vertices_index = np.arange(len(vertices)) # 0, 1, ..., 3 x face
triangles = vertices_index.reshape(-1, 3)
write_ply(
np.asarray(vertices.cpu()),
None,
np.asarray(triangles),
filename
)
return vertices
def make_args_parser():
parser = argparse.ArgumentParser(
"MeshXL: Neural Coordinate Field for Generative 3D Foundation Models",
add_help=False