Shap-E
Last updated
Last updated
Shap-E is a conditional model for generating 3D assets which could be used for video game development, interior design, and architecture. It is trained on a large dataset of 3D assets, and post-processed to render more views of each object and produce 16K instead of 4K point clouds. The Shap-E model is trained in two steps:
a encoder accepts the point clouds and rendered views of a 3D asset and outputs the parameters of implicit functions that represent the asset
a diffusion model is trained on the latents produced by the encoder to generate either neural radiance fields (NeRFs) or a textured 3D mesh, making it easier to render and use the 3D asset in downstream applications
This guide will show you how to use Shap-E to start generating your own 3D assets!
Before you begin, make sure you have the following libraries installed:
Copied
To generate a gif of a 3D object, pass a text prompt to the . The pipeline generates a list of image frames which are used to create the 3D object.
Copied
Copied
Copied
Copied
Copied
Use the export_to_ply()
function to save the mesh output as a ply
file:
You can optionally save the mesh output as an obj
file with the export_to_obj()
function. The ability to save the mesh output in a variety of formats makes it more flexible for downstream usage!
Copied
Then you can convert the ply
file to a glb
file with the trimesh library:
Copied
By default, the mesh output is focused from the bottom viewpoint but you can change the default viewpoint by applying a rotation transform:
Copied
Upload the mesh file to your dataset repository to visualize it with the Dataset viewer!
Now use the function to turn the list of image frames into a gif of the 3D object.
To generate a 3D object from another image, use the . You can use an existing image or generate an entirely new one. Letβs use the the model to generate a new image.
Pass the cheeseburger to the to generate a 3D representation of it.
Shap-E is a flexible model that can also generate textured mesh outputs to be rendered for downstream applications. In this example, youβll convert the output into a glb
file because the π Datasets library supports mesh visualization of glb
files which can be rendered by the .
You can generate mesh outputs for both the and by specifying the output_type
parameter as "mesh"
: