进阶 docs.leonardo.ai 2026-11-22 15:11:20 · 0 阅读

第58章 Leonardo.AI 使用 Meshy 7 模型生成 3D 资产指南

Meshy 7

本指南介绍如何通过 Leonardo.AI REST API 使用 Meshy 7 模型生成 3D 资产。

请求示例

curl --request POST \
     --url https://cloud.leonardo.ai/api/rest/v2/generations \
     --header 'accept: application/json' \
     --header 'authorization: Bearer ' \
     --header 'content-type: application/json' \
     --data '
{
  "model": "meshy/meshy-7",
  "public": false,
  "parameters": {
    "prompt": "A stylized fantasy knight in silver armor with a blue cape",
    "quantity": 1,
    "output_format": "glb",
    "topology": "quad",
    "target_polycount": 30000,
    "geometry_resolution": "standard",
    "symmetry_mode": "auto",
    "pose_mode": "a-pose",
    "should_texture": true,
    "enable_pbr": true,
    "enable_rigging": true,
    "rigging_height_meters": 1.8,
    "enable_animation": true,
    "animation_action_id": 0
  }
}
'

用法说明

API 请求端点、请求头与参数

端点

https://cloud.leonardo.ai/api/rest/v2/generations

请求头

--header "accept: application/json" \
--header "authorization: Bearer " \
--header "content-type: application/json"

请求体参数

参数类型说明
animation_action_idinteger要应用的 Meshy 动画库动画 ID。0 为待机动作,取值范围 0–696,默认 92。仅在 enable_animation 为 true 时生效。
enable_animationboolean为已绑定的角色应用 Meshy 动画库中的动画。需要 enable_rigging 为 true。默认 false。
enable_pbrboolean添加金属度、粗糙度和法线贴图以支持基于物理的渲染(PBR)。仅在 should_texture 为 true 时生效。默认 false。
enable_riggingboolean为网格添加人形骨骼,使其可被动画驱动。四肢分明的人形角色效果最佳。默认 false。
geometry_resolutionstring几何细节级别。可选 standard 或 2k(可捕捉更精细的表面细节)。默认 standard。
guidances.image_referencearray待生成物体的参考图,最多 4 个。每项包含一个 image 对象和可选的 order(integer,最小 0)。image.type 支持 UPLOADED、GENERATED、VARIATION、URL 或 BASE64:前三种用 image.id,URL 用 image.url,BASE64 用 image.data(base64 编码的图片字节)。
modelstring生成所用的模型。设为 meshy/meshy-7。
output_formatstring生成的 3D 资产的网格文件格式。设为 glb。
pose_modestring角色网格的姿势约束。可选 none、a-pose 和 t-pose。A-pose 和 T-pose 更便于后续绑定和动画。默认 none。
promptstring描述要生成的物体。未提供参考图时必填;提供参考图时,prompt 用于引导贴图。最多 600 字符。
publicboolean控制生成的资产是公开(true)还是私有(false)。
quantityinteger每次请求生成的资产数量。设为 1。
rigging_height_metersnumber角色的近似高度(米),用于缩放绑定添加的骨骼。最小 0.1,默认 1.7。仅在 enable_rigging 为 true 时生效。
should_textureboolean为生成的网格添加基础颜色贴图。设为 false 时仅输出无贴图的几何体。默认 true。
symmetry_modestring生成网格的对称性。可选 auto(根据输入自动判断)、on(强制对称)和 off(禁用对称)。默认 auto。
target_polycountinteger生成网格的目标多边形数量。范围 1000–300000,须为 1000 的倍数。默认 30000。
topologystring生成网格的面类型。可选 quad(四边形面,表面更平滑)和 triangle(三角形面,几何细节更丰富)。默认 triangle。

约束

  • 未提供 guidances.image_reference 时 prompt 必填,最多 600 字符。
  • guidances.image_reference 每次请求最多接受 4 张参考图。
  • quantity 固定为 1,每次请求只生成一个资产。
  • output_format 固定为 glb。
  • target_polycount 取值范围 1000 到 300000,须为 1000 的倍数。
  • enable_pbr 仅在 should_texture 为 true 时生效。
  • enable_animation 要求 enable_rigging 为 true;animation_action_id 仅在 enable_animation 为 true 时生效。
  • rigging_height_meters 仅在 enable_rigging 为 true 时生效。

更新于约 1 个月前

这个页面对你有帮助吗?

评论 (0)