Shap-E: add support for mesh output by yiyixuxu · Pull Request #4062 · huggingface/diffusers (original) (raw)

FYI, as a minor point, the output mesh of the Shap-E model is from the bottom viewpoint, so it might be useful if export_to_ply and export_to_obj had an option to rotate the model.

The default viewpoint is like this:

and I rotate this mesh like this:

import trimesh

mesh = trimesh.load('3d_shark.obj') rot = trimesh.transformations.rotation_matrix(-np.pi / 2, [1, 0, 0]) mesh = mesh.apply_transform(rot) mesh.export('3d_shark2.obj', file_type='obj')

Also, it might be useful if .glb was supported because only .glb seems to be supported by the mesh visualization in the Hub.

But users can do these with a few lines of code, so maybe it doesn't have to be supported by the diffusers util function.