Rigging API
Rigging API 讓您能以程式化方式為 3D 人形模型加上骨骼(armature),並將 mesh 綁定到骨架上,使其準備好進行動畫製作。有關如何將動畫套用到已完成 rigging 的角色,請參閱 Animation API。
請注意,目前程式化 rigging 僅能較好地支援具有清晰可辨肢體與身體結構的標準人形(雙足)asset。
創建一個 Rigging 任務
此 endpoint 允許您為給定的 3D 模型創建一個新的 rigging 任務。成功完成後,它會提供一個標準格式的 rigged 角色,並可選擇性地提供基礎的行走/奔跑動畫。
該任務在後台執行。有關通常所需時間,請參閱處理時間。
目前,自動 rigging 不適用於以下模型:
- 未貼圖的 mesh
- 非人形 asset
- 四肢和身體結構不清晰的人形 asset
使用 input_task_id 時,超過 300,000 個面 的模型不支援 rigging。請使用 Remesh API 在 rigging 之前減少面數。
使用 model_url 時,角色的臉部必須朝向 +Z 軸(標準的 glTF 正方向)。朝向其他軸的模型將導致姿態估計失敗。
參數
input_task_id 或 model_url 中只需提供一個即為必要。如果兩者都提供,則 input_task_id 具有較高優先順序。
- Name
- input_task_id
- Type
- string
- 必選
- Description
需要進行 rigging 的輸入任務。我們目前支援帶貼圖的人形模型。
- Name
- model_url
- Type
- string
- 必選
- Description
請透過可公開存取的 URL 或 Data URI 提供一個 3D 模型,供 Meshy 進行 rigging。我們目前支援帶貼圖的人形 GLB 檔案(
.glb格式)。最大檔案大小:對於
http或httpsURL 為 400 MB,對於data:URI 為 100 MB。超過 100 MB 且面數超過 10,000,000 的檔案將回傳
400。面數按三角形計算,被多次繪製的 mesh 每個副本都計算一次。超過 100 MB 的 GLB 不得使用 Draco 壓縮。
- Name
- height_meters
- Type
- number
- 預設值 1.7
- Description
角色模型的大致高度(以公尺為單位)。這有助於提高縮放和 rigging 的準確性。該值必須為正數。
- Name
- texture_image_url
- Type
- string
- Description
模型的 UV 展開基礎顏色 texture 圖像。可公開存取的 URL 或 Data URI。我們目前支援
.png格式。最大檔案大小:20 MB。
回傳值
回應的 result 屬性包含新創建的 rigging 任務的任務 id。
失敗模式
- Name
400 - Bad Request- Description
請求不可接受。常見原因:
- 缺少參數:必須提供
model_url或input_task_id之一。 - 模型格式無效:
model_url指向的檔案副檔名不受支援(僅支援 .glb)。 - URL 無法存取:無法下載
model_url指向的檔案。 - 模型檔案過大:
model_url檔案超過 400 MB(http或httpsURL)或 100 MB(data:URI)。 - 面數過多:
model_url檔案超過 100 MB 且面數超過 10,000,000。請減少面數後重新傳送檔案。 - 模型檔案無法讀取:
model_url檔案超過 100 MB,且其檔頭無法讀取,例如經過 Draco 壓縮的 GLB。 - 模型檔頭過於複雜:
model_url檔案超過 100 MB,其檔頭中需要檢查的 mesh、節點或記錄過多。請減少檔案中的物件數量後重新傳送。 - 圖像過大:
texture_image_url圖像超過 20 MB。 - 輸入任務無效:
input_task_id未指向一個有效的 API 任務。 - 面數超限:輸入模型的面數超過 300,000。請使用 Remesh API 在 rigging 之前減少面數。
- 缺少參數:必須提供
- Name
401 - Unauthorized- Description
身分驗證失敗。請檢查您的 API key。
- Name
402 - Payment Required- Description
credits 不足,無法執行此任務。
- Name
422 - Unprocessable Entity- Description
姿態估計失敗。提供的模型可能不是有效的人形角色。
- Name
429 - Too Many Requests- Description
您已超出速率限制。
Request
# Rig a model from a URL
curl https://api.meshy.ai/openapi/v1/rigging \
-X POST \
-H "Authorization: Bearer ${YOUR_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"model_url": "YOUR_MODEL_URL_OR_DATA_URI",
"height_meters": 1.8
}'
Response
{
"result": "018b314a-a1b5-716d-c222-2f1776f7f579"
}
取得綁骨任務
此端點允許您透過有效的任務 id 取得綁骨任務。請參閱綁骨任務物件以查看包含哪些屬性。
參數
- Name
- id
- Type
- path
- Description
要取得的綁骨任務的唯一識別碼。
回傳
回應內容包含綁骨任務物件。詳情請查看綁骨任務物件部分。
Request
curl https://api.meshy.ai/openapi/v1/rigging/018b314a-a1b5-716d-c222-2f1776f7f579 \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
{
"id": "018b314a-a1b5-716d-c222-2f1776f7f579",
"type": "rig",
"status": "SUCCEEDED",
"created_at": 1747032400453,
"progress": 100,
"started_at": 1747032401314,
"finished_at": 1747032418417,
"expires_at": 1747291618417,
"task_error": {
"message": ""
},
"consumed_credits": 5,
"result": {
"rigged_character_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Character_output.fbx?Expires=...",
"rigged_character_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Character_output.glb?Expires=...",
"basic_animations": {
"walking_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Walking_withSkin.glb?Expires=...",
"walking_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Walking_withSkin.fbx?Expires=...",
"walking_armature_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Walking_withSkin_armature.glb?Expires=...",
"running_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Running_withSkin.glb?Expires=...",
"running_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Running_withSkin.fbx?Expires=...",
"running_armature_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Running_withSkin_armature.glb?Expires=..."
}
},
"preceding_tasks": 0
}
刪除一個綁骨任務
此 endpoint 將永久刪除一個綁骨任務,包括所有相關的模型和資料。此操作不可逆。
路徑參數
- Name
- id
- Type
- path
- Description
要刪除的綁骨任務的 ID。
任務狀態
仍處於 PENDING 狀態的任務會被刪除,並且建立時消耗的 credits 會被退還。
已處於 IN_PROGRESS 狀態的任務無法被刪除:該請求會被拒絕並回傳 409 Conflict,任務會繼續執行。對於 worker 已經開始處理的任務,其所消耗的 credits 是不可退還的,因此在執行過程中刪除它會使你同時失去 credits 和結果。請等待它達到 SUCCEEDED、FAILED 或 CANCELED 狀態後再刪除。
處於終態(SUCCEEDED、FAILED 或 CANCELED)的任務會被刪除,且不予退還 credits。
回傳值
成功時回傳 200 OK,當任務處於 IN_PROGRESS 狀態時回傳 409 Conflict。
Request
curl --request DELETE \
--url https://api.meshy.ai/openapi/v1/rigging/018b314a-a1b5-716d-c222-2f1776f7f579 \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response
// 200 OK on success, with an empty body.
//
// 409 Conflict when the task is IN_PROGRESS — the task is left running:
{
"message": "Task is IN_PROGRESS and cannot be deleted. Credits for a task the worker has already started are not refundable; wait for it to reach SUCCEEDED, FAILED or CANCELED, then delete it."
}
List Rigging Tasks
返回呼叫者的綁定任務的分頁清單,按最新排序。透過 page_num 和 page_size 進行標準分頁。
請注意,透過 API 建立的任務由 API 管理——它們不會出現在網頁應用程式的「我的資產」中。當你遺失了某個任務的 ID 時,可以使用此 endpoint 來查找該任務。
Request
curl "https://api.meshy.ai/openapi/v1/rigging?page_num=1&page_size=20" \
-H "Authorization: Bearer ${YOUR_API_KEY}"
流式取得 Rigging 任務
此端點使用 Server-Sent Events(SSE)為 Rigging 任務流式傳輸即時更新。
參數
- Name
- id
- Type
- path
- Description
要進行流式傳輸的 Rigging 任務的唯一識別碼。
回傳值
以 Server-Sent Events 的形式回傳由 Rigging 任務物件 組成的流。
對於 PENDING 或 IN_PROGRESS 狀態的任務,回應流中只會包含必要的 progress 和 status 欄位。
Request
curl -N https://api.meshy.ai/openapi/v1/rigging/018b314a-a1b5-716d-c222-2f1776f7f579/stream \
-H "Authorization: Bearer ${YOUR_API_KEY}"
Response Stream
// Error event example
event: error
data: {
"status_code": 404,
"message": "Task not found"
}
// Message event examples illustrate task progress.
// For PENDING or IN_PROGRESS tasks, the response stream will not include all fields.
event: message
data: {
"id": "018b314a-a1b5-716d-c222-2f1776f7f579",
"progress": 0,
"status": "PENDING"
}
event: message
data: {
"id": "018b314a-a1b5-716d-c222-2f1776f7f579",
"progress": 50,
"status": "IN_PROGRESS"
}
event: message
data: { // Example of a SUCCEEDED task stream item, mirroring The Rigging Task Object structure
"id": "018b314a-a1b5-716d-c222-2f1776f7f579",
"type": "rig",
"status": "SUCCEEDED",
"created_at": 1747032400453,
"progress": 100,
"started_at": 1747032401314,
"finished_at": 1747032418417,
"expires_at": 1747291618417,
"task_error": {
"message": ""
},
"consumed_credits": 5,
"result": {
"rigged_character_fbx_url": "https://assets.meshy.ai/.../Character_output.fbx?...",
"rigged_character_glb_url": "https://assets.meshy.ai/.../Character_output.glb?...",
"basic_animations": {
"walking_glb_url": "https://assets.meshy.ai/.../Animation_Walking_withSkin.glb?...",
"walking_fbx_url": "https://assets.meshy.ai/.../Animation_Walking_withSkin.fbx?...",
"walking_armature_glb_url": "https://assets.meshy.ai/.../Animation_Walking_withSkin_armature.glb?...",
"running_glb_url": "https://assets.meshy.ai/.../Animation_Running_withSkin.glb?...",
"running_fbx_url": "https://assets.meshy.ai/.../Animation_Running_withSkin.fbx?...",
"running_armature_glb_url": "https://assets.meshy.ai/.../Animation_Running_withSkin_armature.glb?..."
}
},
"preceding_tasks": 0
}
Rigging 任務物件
Rigging 任務物件表示為角色新增 rigging 的工作單元。
屬性
- Name
- id
- Type
- string
- Description
任務的唯一識別碼。
- Name
- type
- Type
- string
- Description
Rigging 任務的類型。該值為
rig。
- Name
- status
- Type
- string
- Description
任務的狀態。可能的值:
PENDING、IN_PROGRESS、SUCCEEDED、FAILED、CANCELED。
- Name
- progress
- Type
- integer
- Description
任務的 progress(0-100)。未開始時為
0,成功時為100。
- Name
- created_at
- Type
- timestamp
- Description
任務建立時的時間戳(自紀元以來的毫秒數)。
時間戳表示自 1970 年 1 月 1 日 UTC 起經過的毫秒數,遵循 RFC 3339
標準。 例如,2023 年 9 月 1 日星期五 12:00:00 PM GMT 表示為1693569600000。這適用於 Meshy API 中的所有時間戳。
- Name
- started_at
- Type
- timestamp
- Description
任務開始處理時的時間戳(自紀元以來的毫秒數)。未開始時為
0。
- Name
- finished_at
- Type
- timestamp
- Description
任務完成時的時間戳(自紀元以來的毫秒數)。未完成時為
0。
- Name
- expires_at
- Type
- timestamp
- Description
任務結果資產過期並可能被刪除時的時間戳(自紀元以來的毫秒數)。
- Name
- task_error
- Type
- object
- Description
失敗任務的錯誤詳情。完整的
task_error物件參考請參見 錯誤。
- Name
- consumed_credits
- Type
- integer
- Description
此任務消耗的積分數量。當任務狀態為
PENDING、IN_PROGRESS或SUCCEEDED時存在。對於FAILED的任務返回0(失敗時會退還積分)。
- Name
- result
- Type
- object
- Description
如果任務為
SUCCEEDED,則包含輸出資產的 URL,否則為null。- Name
rigged_character_fbx_url- Type
- string
- Description
FBX 格式的 rigged 角色的可下載 URL。
- Name
rigged_character_glb_url- Type
- string
- Description
GLB 格式的 rigged 角色的可下載 URL。
- Name
basic_animations- Type
- object (optional)
- Description
包含預設動畫的 URL。(例如,如果
generate_basic_animations隱式為 true 或預設啟用)。- Name
walking_glb_url- Type
- string
- Description
- GLB 格式(帶蒙皮)的行走動畫的可下載 URL。
- Name
walking_fbx_url- Type
- string
- Description
- FBX 格式(帶蒙皮)的行走動畫的可下載 URL。
- Name
walking_armature_glb_url- Type
- string
- Description
- GLB 格式的行走動畫骨架的可下載 URL。
- Name
running_glb_url- Type
- string
- Description
- GLB 格式(帶蒙皮)的跑步動畫的可下載 URL。
- Name
running_fbx_url- Type
- string
- Description
- FBX 格式(帶蒙皮)的跑步動畫的可下載 URL。
- Name
running_armature_glb_url- Type
- string
- Description
- GLB 格式的跑步動畫骨架的可下載 URL。
- Name
- preceding_tasks
- Type
- integer
- Description
佇列中前序任務的數量。僅當狀態為
PENDING時有意義。
Example Rigging Task Object
{
"id": "018b314a-a1b5-716d-c222-2f1776f7f579",
"type": "rig",
"status": "SUCCEEDED",
"created_at": 1747032400453,
"progress": 100,
"started_at": 1747032401314,
"finished_at": 1747032418417,
"expires_at": 1747291618417,
"task_error": {
"message": ""
},
"consumed_credits": 5,
"result": {
"rigged_character_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Character_output.fbx?Expires=...",
"rigged_character_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Character_output.glb?Expires=...",
"basic_animations": {
"walking_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Walking_withSkin.glb?Expires=...",
"walking_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Walking_withSkin.fbx?Expires=...",
"walking_armature_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Walking_withSkin_armature.glb?Expires=...",
"running_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Running_withSkin.glb?Expires=...",
"running_fbx_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Running_withSkin.fbx?Expires=...",
"running_armature_glb_url": "https://assets.meshy.ai/0630d47c-84b8-4d37-bc02-69e45d9272c1/tasks/018b314a-a1b5-716d-c222-2f1776f7f579/output/Animation_Running_withSkin_armature.glb?Expires=..."
}
},
"preceding_tasks": 0
}