point-e
point-e copied to clipboard
How to save the point cloud model to .obj file
Any suggestions? Thanks for your time!
hey so you can save it in to a .ply format when you use the pointcloudtomesh example and in blender you can import the .ply model and export it to an obj, fbx, etc
working on google colab but finding the colours been missing
import trimesh
def ply_to_obj(ply_file, obj_file):
mesh = trimesh.load(ply_file)
mesh.export(obj_file)
return obj_file
in_file = '/content/point-e/mesh.ply'
out_file = '/content/point-e/model.obj'
ply_to_obj(in_file,out_file)
!npm install -g obj2gltf
!node /tools/node/bin/obj2gltf -i {out_file} -o {out_file[:-4]}.glb
In Google Colab, I was able to export to obj
and glb
like this
import trimesh
# Write the mesh to a PLY file to import into some other program.
with open('mesh.ply', 'wb') as f:
mesh.write_ply(f)
mesh = trimesh.load('mesh.ply')
mesh.export('mesh.glb')
# mesh.export('mesh.obj')
print('done')