Hy3D Set Mesh PBR Textures
Swap in your own PBR maps — base color, metallic/roughness, normal, the lot
- trimesh
- image
- trimesh
Hy3DSetMeshPBRTextures lets you write your own texture channels onto a Hunyuan3D mesh. Give it a TRIMESH and an IMAGE, pick which PBR slot you're filling - base color, emissive, metallic/roughness, normal, or occlusion - and it stamps that image into the mesh's material. The result stays a TRIMESH, ready to keep flowing through the graph or out to export.
This is the node that makes the wrapper's PBR story actually editable. The whole selling point of Hunyuan3D 2.1's texturing is that it doesn't hand you one baked diffuse map - it hands you physical material channels a game engine can relight. But the baked result is rarely perfect. This node is how you fix it: replace the base color with your own paint, drop in a hand-tuned normal map, or swap the roughness channel so that metal reads as metal.
How it works
One small but nice detail: if the mesh's material is a plain SimpleMaterial, the node auto-converts it to a PBR material first, so you never hit a "can't set that on this material" wall. Then it takes your IMAGE, converts it to a PIL image (RGBA if it has an alpha channel, RGB otherwise), and assigns it to the chosen slot on a copy of the mesh.
The texture dropdown is the whole interface:
base_color- the albedo/diffuse mapmetallic_roughness- the combined metal/roughness mapnormal- tangent-space normal mapemissive- the glow mapocclusion- ambient occlusion
Pair it with Hy3DSetMeshPBRAttributes for the scalar factors (metallic factor, roughness factor, etc.) that scale these maps - same material, different knob. And Hy3DGetMeshPBRTextures is the read-side sibling if you want to pull a channel back out as an image to edit.
Where it sits
After the bake/apply stages and before export, in the polish pass:
Hy3DApplyTexture → Hy3DSetMeshPBRTextures (base_color) → Hy3DExportMesh
It's pure material surgery - no model load, no VRAM, instant. Run it as many times as you like, on as many channels as you like, and each call layers another edit onto the mesh.
Install
Pack-level: Manager search "Hunyuan3DWrapper", or git clone https://github.com/kijai/ComfyUI-Hunyuan3DWrapper, then pip install -r requirements.txt. This node itself needs nothing beyond trimesh; the render/bake stages upstream are the ones with the compiled custom_rasterizer wheel requirement on Windows.
Common issues
- The image doesn't stick - the
IMAGEyou fed is the wrong shape or channel count for the slot (e.g. feeding an RGB image where the material expects RGBA). Most maps are fine as RGB; if something looks off after export, check the channel count. - Mesh still renders gray - you set a texture but the material's scalar factors (via
Hy3DSetMeshPBRAttributes) are telling the renderer to ignore it, e.g. metallicFactor 0 + no baseColor in the shader. Set the attributes to match. - "SimpleMaterial" confusion - if you see the auto-conversion log line, that's normal and expected; it's working, not erroring.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| trimesh | TRIMESH | — | |
| image | IMAGE | — | |
| texture | COMBO | 5 options: base_color, emissive, metallic_roughness, normal, occlusion |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| trimesh | TRIMESH | — |