Pixal3D & TRELLIS.2: Image to Model
Upload a single image. Generate a high-fidelity 3D model with PBR textures using either Pixal3D or TRELLIS.2, toggled by a single switch. Both pipelines share the same DINOv3 encoder and shape/texture VAEs; Pixal3D adds MoGe camera estimation for pixel-aligned geometry. Includes background removal and a complete mesh post-processing pipeline: remesh, decimate, UV unwrap, and texture baking.
简介
Upload a single image. Generate a high-fidelity 3D model with PBR textures using either Pixal3D or TRELLIS.2, toggled by a single switch. Both pipelines share the same DINOv3 encoder and shape/texture VAEs; Pixal3D adds MoGe camera estimation for pixel-aligned geometry. Includes background removal and a complete mesh post-processing pipeline: remesh, decimate, UV unwrap, and texture baking.
你需要提供
- 正在读取工作流
在 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": 7.5,
"denoise": 1,
"latent_image": [
"87",
0
],
"model": [
"108",
0
],
"negative": [
"315",
0
],
"positive": [
"314",
0
],
"sampler_name": "euler",
"scheduler": "normal",
"seed": 56,
"steps": 12
},
"_meta": {
"title": "KSampler"
}
},
"4": {
"class_type": "VoxelToMesh",
"inputs": {
"algorithm": "basic",
"threshold": 0.6,
"voxel": [
"119",
0
]
},
"_meta": {
"title": "Voxel to Mesh"
}
},
"12": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"98",
2
],
"model": [
"318",
0
],
"negative": [
"98",
1
],
"positive": [
"98",
0
],
"sampler_name": "euler",
"scheduler": "normal",
"seed": 43,
"steps": 12
},
"_meta": {
"title": "KSampler"
}
},
"15": {
"class_type": "CLIPVisionLoader",
"inputs": {
"clip_name": "dino_v3_L_naf_fp32.safetensors"
},
"_meta": {
"title": "Load CLIP Vision"
}
},
"18": {
"class_type": "KSampler",
"inputs": {
"cfg": 7.5,
"denoise": 1,
"latent_image": [
"91",
2
],
"model": [
"126",
0
],
"negative": [
"91",
1
],
"positive": [
"91",
0
],
"sampler_name": "euler",
"scheduler": "normal",
"seed": 42,
"steps": 20
},
"_meta": {
"title": "KSampler"
}
},
"23": {
"class_type": "KSampler",
"inputs": {
"cfg": 7.5,
"denoise": 1,
"latent_image": [
"94",
2
],
"model": [
"126",
0
],
"negative": [
"94",
1
],
"positive": [
"94",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 42,
"steps": 12
},
"_meta": {
"title": "KSampler"
}
},
"40": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "trellis_2_int8_convrot.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"55": {
"class_type": "LoadMoGeModel",
"inputs": {
"model_name": "moge_2_vitl_normal_fp16.safetensors"
},
"_meta": {
"title": "Load MoGe Model"
}
},
"56": {
"class_type": "MoGeInference",
"inputs": {
"apply_mask": True,
"batch_size": 4,
"force_projection": True,
"fov_x_degrees": 0,
"image": [
"302",
0
],
"moge_model": [
"55",
0
],
"refine_steps": 3,
"resolution_level": 9
},
"_meta": {
"title": "Run MoGe Inference"
}
},
"87": {
"class_type": "EmptyTrellis2LatentStructure",
"inputs": {
"batch_size": 1
},
"_meta": {
"title": "Empty Trellis2 Latent Structure"
}
},
"91": {
"class_type": "Trellis2ShapeStage",
"inputs": {
"negative": [
"315",
0
],
"positive": [
"314",
0
],
"voxel": [
"119",
0
]
},
"_meta": {
"title": "Trellis2 Shape Stage"
}
},
"92": {
"class_type": "VaeDecodeShapeTrellis",
"inputs": {
"samples": [
"23",
0
],
"vae": [
"117",
0
]
},
"_meta": {
"title": "Trellis2 VAE Decode Shape"
}
},
"93": {
"class_type": "VaeDecodeTextureTrellis",
"inputs": {
"samples": [
"12",
0
],
"shape_subdivides": [
"92",
1
],
"vae": [
"118",
0
]
},
"_meta": {
"title": "Trellis2 VAE Decode Texture"
}
},
"94": {
"class_type": "Trellis2UpsampleStage",
"inputs": {
"negative": [
"91",
1
],
"positive": [
"91",
0
],
"shape_latent": [
"18",
0
],
"target_resolution": 1536,
"vae": [
"117",
0
]
},
"_meta": {
"title": "Trellis2 Upsample Stage"
}
},
"98": {
"class_type": "Trellis2TextureStage",
"inputs": {
"negative": [
"94",
1
],
"positive": [
"94",
0
],
"shape_latent": [
"23",
0
]
},
"_meta": {
"title": "Trellis2 Texture Stage"
}
},
"108": {
"class_type": "ModelSamplingSD3",
"inputs": {
"model": [
"125",
0
],
"shift": 5
},
"_meta": {
"title": "ModelSamplingSD3"
}
},
"117": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "trellis_2_shape_vae_bf16.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"118": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "trellis_2_texture_vae_bf16.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"119": {
"class_type": "VaeDecodeStructureTrellis2",
"inputs": {
"resolution": "32",
"samples": [
"3",
0
],
"vae": [
"117",
0
]
},
"_meta": {
"title": "Trellis2 VAE Decode Structure"
}
},
"122": {
"class_type": "LoadImage",
"inputs": {
"image": "viking_wolf_rune_axe.png"
},
"_meta": {
"title": "Load Image"
}
},
"125": {
"class_type": "RescaleCFG",
"inputs": {
"model": [
"199",
0
],
"multiplier": 0.7
},
"_meta": {
"title": "RescaleCFG"
}
},
"126": {
"class_type": "RescaleCFG",
"inputs": {
"model": [
"279",
0
],
"multiplier": 0.5
},
"_meta": {
"title": "RescaleCFG"
}
},
"147": {
"class_type": "BakeTextureFromVoxel",
"inputs": {
"mesh": [
"196",
0
],
"reference_mesh": [
"92",
0
],
"texture_size": [
"288",
0
],
"voxel_colors": [
"93",
0
]
},
"_meta": {
"title": "Bake Texture From Voxel"
}
},
"164": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"147",
0
]
},
"_meta": {
"title": "Base Color"
}
},
"186": {
"class_type": "DecimateMesh",
"inputs": {
"mesh": [
"241",
0
],
"placement_mode": "midpoint",
"target_face_count": 700000
},
"_meta": {
"title": "Decimate Mesh"
}
},
"192": {
"class_type": "RemoveBackground",
"inputs": {
"bg_removal_model": [
"193",
0
],
"image": [
"122",
0
]
},
"_meta": {
"title": "Remove Background"
}
},
"193": {
"class_type": "LoadBackgroundRemovalModel",
"inputs": {
"bg_removal_name": "birefnet.safetensors"
},
"_meta": {
"title": "Load Background Removal Model"
}
},
"196": {
"class_type": "UnwrapMesh",
"inputs": {
"mesh": [
"238",
0
],
"padding": 1,
"resolution": [
"288",
0
],
"segmenter": "pec",
"weld_distance": 0.0002
},
"_meta": {
"title": "Unwrap Mesh UVs"
}
},
"199": {
"class_type": "CFGOverride",
"inputs": {
"cfg": 1,
"end_percent": 1,
"model": [
"318",
0
],
"start_percent": 0.667
},
"_meta": {
"title": "CFG Override"
}
},
"202": {
"class_type": "GetMeshInfo",
"inputs": {
"mesh": [
"92",
0
]
},
"_meta": {
"title": "Get Mesh Info"
}
},
"207": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"147",
1
]
},
"_meta": {
"title": "Metallic"
}
},
"208": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"147",
2
]
},
"_meta": {
"title": "Roughness"
}
},
"210": {
"class_type": "ApplyTextureToMesh",
"inputs": {
"base_color": [
"164",
0
],
"mesh": [
"196",
0
],
"metallic": [
"207",
0
],
"normal_map": [
"226",
0
],
"occlusion": [
"235",
0
],
"roughness": [
"208",
0
]
},
"_meta": {
"title": "Apply Texture to Mesh"
}
},
"224": {
"class_type": "BakeNormalMapFromMesh",
"inputs": {
"cage_distance": 0.05,
"high_poly": [
"241",
0
],
"ignore_backfaces": True,
"low_poly": [
"196",
0
],
"resolution": 2048
},
"_meta": {
"title": "Bake Normal Map from Mesh"
}
},
"226": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"224",
0
]
},
"_meta": {
"title": "Normal"
}
},
"233": {
"class_type": "BakeAmbientOcclusion",
"inputs": {
"bias": 0.01,
"high_poly": [
"241",
0
],
"low_poly": [
"196",
0
],
"max_distance": 0.71,
"resolution": 1024,
"samples": 64,
"strength": 1
},
"_meta": {
"title": "Bake Ambient Occlusion"
}
},
"235": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"233",
0
]
},
"_meta": {
"title": "Ambiant Occlusion"
}
},
"238": {
"class_type": "MeshSmoothNormals",
"inputs": {
"crease_angle": 180,
"mesh": [
"186",
0
]
},
"_meta": {
"title": "Smooth Mesh Normals"
}
},
"241": {
"class_type": "RemeshMesh",
"inputs": {
"band": 1,
"drop_small_components": 0.01,
"fix_poles": False,
"mesh": [
"202",
0
],
"precluster_max_verts": 20000000,
"project_back": 0,
"resolution": 768,
"sign_mode": "udf",
"sign_mode.drop_enclosed_components": False,
"sign_mode.drop_inverted_components": False,
"sign_mode.qef": False,
"smooth_iters": 20
},
"_meta": {
"title": "Remesh Mesh (Narrow-Band DC)"
}
},
"242": {
"class_type": "MoGeGeometryToFOV",
"inputs": {
"axis": "horizontal",
"moge_geometry": [
"56",
0
],
"unit": "degrees"
},
"_meta": {
"title": "Get FoV from MoGe Geometry"
}
},
"246": {
"class_type": "Preview3DAdvanced",
"inputs": {
"height": 1024,
"model_3d": [
"247",
0
],
"viewport_state": "",
"width": 1024
},
"_meta": {
"title": "Preview 3D (Advanced)"
}
},
"247": {
"class_type": "MeshToFile3D",
"inputs": {
"mesh": [
"4",
0
]
},
"_meta": {
"title": "Create 3D File (from Mesh)"
}
},
"248": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"122",
1
],
"on_true": [
"192",
0
],
"switch": True
},
"_meta": {
"title": "Switch: Remove background"
}
},
"252": {
"class_type": "PaintMesh",
"inputs": {
"mesh": [
"238",
0
],
"voxel_colors": [
"93",
0
]
},
"_meta": {
"title": "Paint Mesh"
}
},
"260": {
"class_type": "MeshSmoothNormals",
"inputs": {
"crease_angle": 180,
"mesh": [
"210",
0
]
},
"_meta": {
"title": "Smooth Mesh Normals"
}
},
"261": {
"class_type": "RenderUVAtlas",
"inputs": {
"mesh": [
"196",
0
],
"resolution": 1024
},
"_meta": {
"title": "Render UV Atlas"
}
},
"262": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"261",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"279": {
"class_type": "CFGOverride",
"inputs": {
"cfg": 1,
"end_percent": 1,
"model": [
"318",
0
],
"start_percent": 0.769
},
"_meta": {
"title": "CFG Override"
}
},
"282": {
"class_type": "MeshToFile3D",
"inputs": {
"mesh": [
"252",
0
]
},
"_meta": {
"title": "Create 3D File (from Mesh)"
}
},
"285": {
"class_type": "MeshToFile3D",
"inputs": {
"mesh": [
"260",
0
]
},
"_meta": {
"title": "Create 3D File (from Mesh)"
}
},
"288": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 4096
},
"_meta": {
"title": "Texture Resolution"
}
},
"298": {
"class_type": "Pixal3DConditioning",
"inputs": {
"camera_angle_x": [
"242",
0
],
"clip_vision_model": [
"15",
0
],
"image": [
"302",
0
]
},
"_meta": {
"title": "Pixal3D Conditioning"
}
},
"299": {
"class_type": "Trellis2Conditioning",
"inputs": {
"clip_vision_model": [
"15",
0
],
"image": [
"302",
0
]
},
"_meta": {
"title": "Trellis2 Conditioning"
}
},
"302": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"312",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"303": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"248",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"312": {
"class_type": "ImageCropToMask",
"inputs": {
"background": "#000000",
"grow_mask": 0,
"height": 1024,
"images": [
"122",
0
],
"masks": [
"303",
0
],
"pad_factor": 1.1,
"width": 1024
},
"_meta": {
"title": "Crop Image to Mask"
}
},
"314": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"298",
0
],
"on_true": [
"299",
0
],
"switch": [
"316",
0
]
},
"_meta": {
"title": "If/Else Switch"
}
},
"315": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"298",
1
],
"on_true": [
"299",
1
],
"switch": [
"316",
0
]
},
"_meta": {
"title": "If/Else Switch"
}
},
"316": {
"class_type": "PrimitiveBoolean",
"inputs": {
"value": False
},
"_meta": {
"title": "Boolean (Switch to Trellis2)"
}
},
"318": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"319",
0
],
"on_true": [
"40",
0
],
"switch": [
"316",
0
]
},
"_meta": {
"title": "If/Else Switch"
}
},
"319": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "pixal3d_int8_convrot.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"322": {
"class_type": "Save3DAdvanced",
"inputs": {
"filename_prefix": "3d/ComfyUI",
"height": 1024,
"model_3d": [
"285",
0
],
"viewport_state": "",
"width": 1024
},
"_meta": {
"title": "Save 3D (Advanced)"
}
},
"323": {
"class_type": "Preview3DAdvanced",
"inputs": {
"height": 1024,
"model_3d": [
"282",
0
],
"viewport_state": "",
"width": 1024
},
"_meta": {
"title": "Preview 3D (Advanced)"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)