UltraTex:3D 模型贴图
用一张参考图为未贴图的模型生成 PBR 贴图。UltraTex 先把网格渲染成六张世界法线视图,再用两个 UltraTex LoRA 在 FLUX.2 Klein 9B 上分别生成反照率与金属度/粗糙度,最后烘焙到网格 UV 上,导出带 PNG 贴图的 PBR GLB。
简介
Texture an untextured mesh from a single reference image. UltraTex renders the mesh into six world-normal views, paints albedo and metallic/roughness with two UltraTex LoRA passes on FLUX.2 Klein 9B, then bakes the result onto the mesh UVs and exports a PBR GLB with its PNG maps.
Graph: ApplyTextureToMesh, BakeTextureFromViews, BlockSparseAttention, ConditioningLoader, CreateCameraOrbit, EmptyFlux2LatentImage, Get3DComponents, KSampler, Load3DAdvanced, LoadBackgroundRemovalModel, LoadImage, LoraLoaderModelOnly, MarkdownNote, MaskPreview, PreviewImage, RemoveBackground, RenderMesh, ResizeAndPadImage, SaveGLB, SaveImageAdvanced, SplitImageChannels, UNETLoader, UltraTexConditioning, VAEDecode, VAELoader, b6610733-f2f0-4f83-9281-42e1aa892a5a. Output: 3d (ultratex_texture_3d_model.glb).
你需要提供
- 正在读取工作流
在 ComfyUI 中运行。 此工作流无法在本页面运行。请下载后在 ComfyUI 中打开。
下载工作流此工作流暂无示例输出。
查看工作流内部
节点图的只读预览。在 Comfy Cloud 中打开或下载后即可编辑节点。
Loading the graph
Open full-size workflow preview此工作流中的文件
- 输出
- 3D
- 作者
- 作者信息暂不可用
需要自定义节点
- 正在读取工作流
通过代码使用此工作流
尽可能根据工作流图和输入自动生成代码,否则显示已保存的示例。运行代码可能产生费用,请先核对凭据和端点。
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({
"1": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "flux-2-klein-base-9b_int8_convrot.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"3": {
"class_type": "BlockSparseAttention",
"inputs": {
"dense_blocks": "",
"end_percent": 1,
"extra_tokens": 256,
"min_tokens": 12288,
"model": [
"1",
0
],
"selection": "sla",
"selection.keep_percent": 20,
"sink_conditioning": "exact_kv_and_rows",
"start_percent": 0,
"verbose": False
},
"_meta": {
"title": "Model Sparse Attention"
}
},
"4": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "ultratex_flux2_klein_9b_albedo_lora_bf16.safetensors",
"model": [
"105",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"5": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "ultratex_flux2_klein_9b_metallic_roughness_lora_bf16.safetensors",
"model": [
"3",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"7": {
"class_type": "ConditioningLoader",
"inputs": {
"conditioning_name": "flux-2-klein-9b_empty_prompt.safetensors"
},
"_meta": {
"title": "Load Conditioning"
}
},
"8": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "ultratex_flux2_vae_fp32.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"11": {
"class_type": "Get3DComponents",
"inputs": {
"model_3d": [
"234",
0
]
},
"_meta": {
"title": "Get 3D Components"
}
},
"13": {
"class_type": "RenderMesh",
"inputs": {
"background": "#ffffff",
"camera_info": [
"18",
0
],
"height": [
"233:90",
0
],
"mesh": [
"11",
0
],
"mode": "world normal",
"width": [
"233:90",
0
]
},
"_meta": {
"title": "Render Mesh"
}
},
"14": {
"class_type": "LoadImage",
"inputs": {
"image": "sir_frog.png"
},
"_meta": {
"title": "Load Image"
}
},
"16": {
"class_type": "UltraTexConditioning",
"inputs": {
"conditioning": [
"7",
0
],
"extra_views": "off",
"masks": [
"210",
0
],
"normals": [
"209",
0
],
"reference": [
"242",
0
],
"reference_mask": [
"202",
0
],
"vae": [
"8",
0
]
},
"_meta": {
"title": "UltraTex Conditioning"
}
},
"17": {
"class_type": "EmptyFlux2LatentImage",
"inputs": {
"batch_size": 6,
"height": [
"233:90",
0
],
"width": [
"233:90",
0
]
},
"_meta": {
"title": "Empty Flux 2 Latent"
}
},
"18": {
"class_type": "CreateCameraOrbit",
"inputs": {
"camera_info": [
"234",
2
],
"count": 4,
"pitch": 0,
"poles": "top and bottom",
"yaw": 360
},
"_meta": {
"title": "Create Camera Orbit"
}
},
"20": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"17",
0
],
"model": [
"4",
0
],
"negative": [
"16",
0
],
"positive": [
"16",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 1,
"steps": 4
},
"_meta": {
"title": "KSampler"
}
},
"21": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"20",
0
],
"vae": [
"8",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"22": {
"class_type": "BakeTextureFromViews",
"inputs": {
"blend_exponent": 4,
"camera_info": [
"18",
0
],
"fill_unseen": True,
"images": [
"21",
0
],
"mesh": [
"11",
0
],
"resolution": [
"233:93",
0
]
},
"_meta": {
"title": "Bake Texture From Views"
}
},
"60": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"17",
0
],
"model": [
"5",
0
],
"negative": [
"16",
0
],
"positive": [
"16",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 4,
"steps": 8
},
"_meta": {
"title": "KSampler"
}
},
"61": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"60",
0
],
"vae": [
"8",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"62": {
"class_type": "BakeTextureFromViews",
"inputs": {
"blend_exponent": 4,
"camera_info": [
"18",
0
],
"fill_unseen": True,
"images": [
"61",
0
],
"mesh": [
"11",
0
],
"resolution": [
"233:93",
0
]
},
"_meta": {
"title": "Bake Texture From Views"
}
},
"80": {
"class_type": "ApplyTextureToMesh",
"inputs": {
"base_color": [
"228",
0
],
"mesh": [
"11",
0
],
"metallic": [
"231",
0
],
"roughness": [
"230",
0
]
},
"_meta": {
"title": "Apply Texture to Mesh"
}
},
"81": {
"class_type": "SaveGLB",
"inputs": {
"filename_prefix": "3d/ultratex_texture_3d_model",
"mesh": [
"80",
0
]
},
"_meta": {
"title": "Save 3D Model"
}
},
"105": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "flux-2-klein-9b_distill_lora_avg_rank_345_bf16.safetensors",
"model": [
"3",
0
],
"strength_model": 0.5
},
"_meta": {
"title": "Load LoRA"
}
},
"200": {
"class_type": "RemoveBackground",
"inputs": {
"bg_removal_model": [
"201",
0
],
"image": [
"242",
0
]
},
"_meta": {
"title": "Remove Background"
}
},
"201": {
"class_type": "LoadBackgroundRemovalModel",
"inputs": {
"bg_removal_name": "birefnet.safetensors"
},
"_meta": {
"title": "Load Background Removal Model"
}
},
"202": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"200",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"209": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"13",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"210": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"13",
1
]
},
"_meta": {
"title": "Preview Mask"
}
},
"223": {
"class_type": "SplitImageChannels",
"inputs": {
"image": [
"62",
0
]
},
"_meta": {
"title": "Split Image Channels"
}
},
"228": {
"class_type": "SaveImageAdvanced",
"inputs": {
"filename_prefix": "3d/ultratex_texture_3d_model_albedo",
"format": "png",
"format.bit_depth": "8-bit",
"format.channels": "auto",
"format.input_color_space": "sRGB",
"images": [
"22",
0
]
},
"_meta": {
"title": "Save Albedo"
}
},
"230": {
"class_type": "SaveImageAdvanced",
"inputs": {
"filename_prefix": "3d/ultratex_texture_3d_model_roughness",
"format": "png",
"format.bit_depth": "8-bit",
"format.channels": "grayscale (1 channel)",
"format.input_color_space": "sRGB",
"images": [
"223",
1
]
},
"_meta": {
"title": "Save Roughness"
}
},
"231": {
"class_type": "SaveImageAdvanced",
"inputs": {
"filename_prefix": "3d/ultratex_texture_3d_model_metallic",
"format": "png",
"format.bit_depth": "8-bit",
"format.channels": "grayscale (1 channel)",
"format.input_color_space": "sRGB",
"images": [
"223",
2
]
},
"_meta": {
"title": "Save Metallic"
}
},
"234": {
"class_type": "Load3DAdvanced",
"inputs": {
"height": [
"233:90",
0
],
"model_file": "sir_frog.obj",
"viewport_state": "",
"width": [
"233:90",
0
]
},
"_meta": {
"title": "Load 3D (Advanced)"
}
},
"242": {
"class_type": "ResizeAndPadImage",
"inputs": {
"image": [
"14",
0
],
"interpolation": "area",
"padding_color": "white",
"target_height": [
"233:90",
0
],
"target_width": [
"233:90",
0
]
},
"_meta": {
"title": "Resize And Pad Image"
}
},
"233:90": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 1024
},
"_meta": {
"title": "Rendered Mesh Resolution"
}
},
"233:93": {
"class_type": "PrimitiveInt",
"inputs": {
"value": 4096
},
"_meta": {
"title": "Texture Resolution"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)