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)