3D大模型
基本介绍
3D 大模型用来将输入的图片转成 3D 模型,具备高保真度、细节丰富和高效生成的特点,可快速将图像转换为逼真的 3D 物体,广泛应用于游戏开发、影视制作、虚拟现实等领域。
实际的 3D 效果如下图所示:


模型列表
目前模型广场已上线的 3D 大模型包括:
| 模型名称 | 描述 |
|---|---|
| Hunyuan3D-2 单色 | Hunyuan3D-2 是腾讯混元团队推出的高质量 3D 生成模型,具备高保真度、细节丰富和高效生成的特点,可快速将文本或图像转换为逼真的 3D 物体。 |
| Hunyuan3D-2 彩色 | Hunyuan3D-2 是腾讯混元团队推出的高质量 3D 生成模型,具备高保真度、细节丰富和高效生成的特点,可快速将文本或图像转换为逼真的 3D 物体。 |
| Hi3DGen | Hi3DGen 是一个 AI 工具,它可以把您上传的普通图片,智能转换成有“立体感”的图片(法线图),常用于制作 3D 效果,比如游戏建模、虚拟现实、动画制作等。 |
| Step1X-3D | Step1X-3D 是一款由阶跃星辰(StepFun)与光影焕像(LightIllusions)联合研发并开源的高保真 3D 生成模型,专为高质量、可控的 3D 内容创作而设计。 |
在线体验
以 Hunyuan3D-2 模型为例,模型的输入是图片,输出是对应的 3D 模型。用户可以通过上传图片来使用该模型。
如下图所示:

异步调用示例代码
由于模型生成时间可能较长,因此接口采用异步调用的方式,关于模力方舟的异步任务 API 请参考 这里。
以下是使用 Python 调用 3D 生成模型的示例代码:
python
import requests
from requests_toolbelt import MultipartEncoder
import os
import time
import json
import webbrowser
import contextlib
import mimetypes
API_URL = "https://ai.gitee.com/v1/async/image-to-3d"
API_TOKEN = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
headers = {
"Authorization": f"Bearer {API_TOKEN}"
}
def query(payload):
fields = [
("type", payload["type"]),
("model", payload["model"]),
("texture", str(payload["texture"]).lower()),
("seed", str(payload["seed"])),
("num_inference_steps", str(payload["num_inference_steps"])),
("octree_resolution", str(payload["octree_resolution"])),
("guidance_scale", str(payload["guidance_scale"])),
]
with contextlib.ExitStack() as stack:
filepath = payload["image"]
name = os.path.basename(filepath)
if filepath.startswith(("http://", "https://")):
response = requests.get(filepath, timeout=10)
response.raise_for_status()
fields.append(("image", (name, response.content, response.headers.get("Content-Type", "application/octet-stream"))))
else:
mime_type, _ = mimetypes.guess_type(filepath)
fields.append(("image", (name, stack.enter_context(open(filepath, "rb")), mime_type or "application/octet-stream")))
encoder = MultipartEncoder(fields)
headers["Content-Type"] = encoder.content_type
response = requests.post(API_URL, headers=headers, data=encoder)
return response.json()
def poll_task(task_id):
status_url = f"https://ai.gitee.com/v1/task/{task_id}"
timeout = 30 * 60
retry_interval = 10
attempts = 0
max_attempts = int(timeout / retry_interval)
while attempts < max_attempts:
attempts += 1
print(f"Checking task status [{attempts}]...", end="")
response = requests.get(status_url, headers=headers, timeout=10)
result = response.json()
if result.get("error"):
print('error')
raise ValueError(f"{result['error']}: {result.get('message', 'Unknown error')}")
status = result.get("status", "unknown")
print(status)
if status == "success":
if "output" in result and "file_url" in result["output"]:
file_url = result["output"]["file_url"]
duration = (result.get('completed_at', 0) - result.get('started_at', 0)) / 1000
print(f"🔗 Donwload link: {file_url}")
print(f"⏱️ Task duration: {duration:.2f} seconds")
# Open the result URL in the browser
webbrowser.open(file_url)
else:
print("⚠️ No output URL found")
elif status in ["failed", "cancelled"]:
print(f"❌ Task {status}")
else:
time.sleep(retry_interval)
continue
task_file = f"task_{task_id}.json"
with open(task_file, "w") as f:
json.dump(result, f, indent=4)
print(f"Task was saved to file {task_file}")
return result
print(f"⏰ Maximum attempts reached ({max_attempts})")
return {"status": "timeout", "message": "maximum wait time exceeded"}
if __name__ == "__main__":
print("Creating task...")
result = query({
"image": "path/to/image.jpg",
"type": "glb",
"model": "Hunyuan3D-2",
"texture": True,
"seed": 1234,
"num_inference_steps": 5,
"octree_resolution": 128,
"guidance_scale": 5
})
task_id = result.get("task_id")
if not task_id:
raise ValueError("Task ID not found in the response")
print(f"Task ID: {task_id}")
task = poll_task(task_id)
if task.get("status") == "success":
# Do something with the task result here
print("Task completed successfully!")
模型生成的 3D 文件是 .glb 格式的,您可以使用 3D 查看工具(如 glTF Viewer)来查看生成的 3D 模型。
更多示例代码您可参考 模力方舟示例代码仓库 。
使用场景
🎮 游戏开发
- 角色建模:快速将概念图转换为游戏角色的 3D 模型
- 道具制作:为游戏创建各种武器、装备和环境道具
- 场景资产:生成建筑物、植被、装饰品等场景元素
- 原型设计:在游戏开发早期快速制作模型原型