混元3D 2.0
使用Hunyuan3D 2.0從單張圖像產生3D模型。
關於
HY 3D 2.0 工作流程設計用於將單張 2D 圖片轉換為細緻的 3D 模型,採用 Hunyuan3D 2.0 模型。此流程運用先進 AI 技術,從平面圖像解讀並重建深度與形體,對於需快速建立 3D 素材的藝術家、設計師與開發者極具價值。流程核心節點如 CLIPVisionEncode,負責從輸入圖片提取視覺特徵,VAEDecodeHunyuan3D 則將這些特徵解碼為 3D 表現。流程還包含 VoxelToMesh 節點,將體素資料轉換為 3D 應用可用的網格格式。
技術上,流程從 ImageOnlyCheckpointLoader 載入 Hunyuan3D 模型開始。用戶透過 LoadImage 節點上傳圖片,經過一系列條件設定與取樣步驟(如 Hunyuan3Dv2Conditioning 與 ModelSamplingAuraFlow 節點)處理。最終 3D 模型以 GLB 格式透過 SaveGLB 節點儲存,與多數 3D 軟體相容。此流程特別適合將照片或概念美術轉為 3D 模型,實現 2D 創意與 3D 應用的橋樑。
您提供的內容
- 正在讀取工作流程
在 ComfyUI 中執行。 此工作流程無法在此頁面上執行。請在已載入所有內容的 Comfy Cloud 中開啟,或下載到您自己的 ComfyUI。
在 Cloud 中試用工作流程內部
節點圖的唯讀預覽。請在 Comfy Cloud 中開啟,或下載後編輯節點。
Loading the graph
Open full-size workflow preview此工作流程中的檔案
- 作者
- ComfyUI
需要自訂節點
- 正在讀取工作流程
從程式碼使用此工作流程
可行時會根據工作流程圖和輸入內容產生;否則會顯示儲存的範例。執行可能產生費用的程式碼前,請檢查認證資訊和端點。
What you need
- Runs on
- Comfy Cloud
- 金鑰
- COMFY_API_KEY
需要付費 Cloud 方案與點數。
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"3": {
"class_type": "KSampler",
"inputs": {
"cfg": 8,
"denoise": 1,
"latent_image": [
"66",
0
],
"model": [
"70",
0
],
"negative": [
"80",
1
],
"positive": [
"80",
0
],
"sampler_name": "euler",
"scheduler": "normal",
"seed": 242832339647017,
"steps": 20
},
"_meta": {
"title": "KSampler"
}
},
"51": {
"class_type": "CLIPVisionEncode",
"inputs": {
"clip_vision": [
"54",
1
],
"crop": "none",
"image": [
"56",
0
]
},
"_meta": {
"title": "CLIP Vision Encode"
}
},
"54": {
"class_type": "ImageOnlyCheckpointLoader",
"inputs": {
"ckpt_name": "hunyuan3d-dit-v2_fp16.safetensors"
},
"_meta": {
"title": "Load Checkpoint Image Only (img2vid model)"
}
},
"56": {
"class_type": "LoadImage",
"inputs": {
"image": "3d_hunyuan3d_image_to_model_input_image.png"
},
"_meta": {
"title": "Load Image"
}
},
"61": {
"class_type": "VAEDecodeHunyuan3D",
"inputs": {
"num_chunks": 8000,
"octree_resolution": 256,
"samples": [
"3",
0
],
"vae": [
"54",
2
]
},
"_meta": {
"title": "Hunyuan 3D VAE Decode"
}
},
"66": {
"class_type": "EmptyLatentHunyuan3Dv2",
"inputs": {
"batch_size": 1,
"resolution": 3072
},
"_meta": {
"title": "Empty Hunyuan 3D v2 Latent"
}
},
"70": {
"class_type": "ModelSamplingAuraFlow",
"inputs": {
"model": [
"54",
0
],
"sampling": "flow",
"shift": 1.0000000000000002
},
"_meta": {
"title": "ModelSamplingAuraFlow"
}
},
"80": {
"class_type": "Hunyuan3Dv2Conditioning",
"inputs": {
"clip_vision_output": [
"51",
0
]
},
"_meta": {
"title": "Hunyuan3Dv2Conditioning"
}
},
"81": {
"class_type": "VoxelToMesh",
"inputs": {
"algorithm": "surface net",
"threshold": 0.6,
"voxel": [
"61",
0
]
},
"_meta": {
"title": "Voxel to Mesh"
}
},
"82": {
"class_type": "SaveGLB",
"inputs": {
"filename_prefix": "mesh/ComfyUI",
"mesh": [
"81",
0
]
},
"_meta": {
"title": "Save 3D Model"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)問答
高解析度、細節清楚且主體明確的圖片通常能產生最佳 3D 模型。
可以,但請確認 Hunyuan3D 模型的授權條款是否允許商業用途。
3D 模型會以 GLB 格式儲存,與多數 3D 軟體相容。
可將 cfg 值設在 4 到 8 之間,並嘗試不同設定以找到最適合你圖片的參數。