Quick Primer on Image-to-3D
Image-to-3D has a few modes
- Sculpt - best geometry, fastest model, most consistent
preview_mesh: "fast_sculpt"
- Sculpt with Textures - fastest model with textures, slightly less consistent geometry
preview_mesh: "fast_sculpt", generate_texture: true
- Refine with Textures - slow refine - better textures, takes longer
preview_mesh: "turbo", refine_speed: "slow"
- [Deprecated] Fast refine - faster generation, but lower quality
preview_mesh: "turbo", refine_speed: "fast"
The Scupt model is the fastest, here is a quick script to have it setup
import requests
import json
url = "https://api.csm.ai/image-to-3d-sessions"
payload = json.dumps({
"image_url": "<IMAGE-URL>",
"preview_mesh": "fast_sculpt",
})
headers = {
'x-api-key': '<X-API_KEY>',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
You can get the API key from https://3d.csm.ai/my-profile (opens in a new tab)
The other two modes, are set using the refine_speed
key in the create session API.
Mesh generation involves four main stages: Create, Spin Generation, Preview, and Refine.
Create
To start a session, upload the image_url
along with the appropriate settings as described in the Create Session (opens in a new tab) documentation.
Spin Generation
Once the image is uploaded, a 3D spin video is generated.
- Duration: This step typically takes about a minute.
- Status during processing:
spin_generate_processing
. - Status upon completion:
spin_generate_done
. - Status upon failure:
spin_generate_failed
.
Preview Generation
After the spin video is created, it is used to generate a preview mesh.
- Duration: Approximately one minute.
- Status during processing:
training_preview
. - Status upon completion:
preview_done
. - Status upon failure:
preview_failed
.
Refine Generation
With the preview mesh available, you can choose to refine it further to create a highly detailed mesh.
- Duration: Up to 10 minutes for Fast Refine and up to 90 minutes for Slow Refine.
- Status during processing:
training_refine
. - Status upon completion:
refine_done
. - Status upon failure:
refine_failed
.