BD UV Confidence Blend
Stitch multiple face-texture bakes into one clean UV texture
- uv_textures
- confidences
- target_mask
- uv_texture
- confidence
- filled_mask
- inpaint_mask
- status
Texturing a 3D face by baking from photos hits a wall fast: no single camera view covers the whole head, so you bake the face from five angles, get five partial textures, and now have to stitch them into one UV map without seams, ghosting, or ugly overlap where two views disagree. This node is that stitcher. BD UV Confidence Blend takes the outputs of multiple BD Face Texture Bake runs and composites them into a single UV texture, weighted per-pixel by how confident each view was.
The confidence masks are the clever bit. Each bake from BD FaceTextureBake emits a per-pixel confidence (essentially the view-cosine mask - how directly that camera was looking at that part of the face). The blend raises those confidences to a power before mixing, so instead of averaging five slightly-misaligned views into a blur, the view that actually saw a texel clearly dominates it. That's the whole difference between "mushy average" and "sharp composite."
The inputs that matter
uv_textures- a stacked batch of theuv_textureoutputs from your Face Texture Bakes (N,H,W,3).confidences- the matching stacked confidence masks (N,H,W).seam_dilate(default 4) - grows the filled region by that many pixels using a non-blurring edge extend: each new pixel copies a filled neighbor rather than averaging. This stops black-bleed at UV island edges when a renderer samples with bilinear filtering. 0 disables it; leave it on unless you're chasing a specific artifact.confidence_gamma(default 3) - the power you raise confidences to before blending. Higher = closer to winner-take-all, less ghosting but harder transitions. 1 is a flat linear blend (blurrier). If you're seeing overlap smears, nudge this up.fill_threshold(default 0.05) - summed confidence below this counts as a gap infilled_mask.target_mask- wire in the UV layout silhouette fromBD FaceTextureBake'suv_layout_mask. This is what makes the output useful:inpaint_maskbecomestarget & ~filled, i.e. exactly the gaps inside the face's UV layout that no view covered. Without it, the inpaint mask is just "everything unfilled" including background.
Outputs: uv_texture (the composite), confidence (max confidence across views), filled_mask (binary - where there's data), inpaint_mask (binary - where a paint model SHOULD fill), and status.
Why the inpaint_mask matters
This is the part that makes the whole FaceWrap pipeline work. The composite always has holes - spots no camera saw, parts of the head the bakes missed. You don't want to just leave them black; you want a model to paint them in. The inpaint_mask output is explicitly designed as the paint region for a Qwen Image Edit finalize step: feed the composite plus that mask to Qwen, and it redraws exactly the missing sections instead of leaving seams or guessing on already-fine areas. Blend → transfer to your target rig's UV (BD UV Transfer) → Qwen finalize is the intended chain.
Installation
Standard BrainDead install - ComfyUI Manager (search "BrainDead") or:
cd ComfyUI/custom_nodes
git clone https://github.com/BizaNator/ComfyUI-BrainDead
cd ComfyUI-BrainDead
pip install -r requirements.txt
Pure torch math, no models, no extra dependencies. If your BD FaceTextureBake nodes run, this one will too.
Common issues
- Blurry composite - your views are misaligned and you're linear-blending them. Raise
confidence_gammatoward 4-5 so the best view wins each texel, and re-check your bake alignment upstream. - Black fringes at UV island edges -
seam_dilateis too low (or off). Bump it; that's literally what it's for. - The inpaint mask includes the background - you didn't wire
target_mask. Without the UV layout silhouette, "unfilled" is the whole canvas. Wire the layout mask to keep the paint region inside the face.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| uv_textures | IMAGE | Stack of BD_FaceTextureBake uv_texture outputs (N,H,W,3). | |
| confidences | MASK | Stack of BD_FaceTextureBake confidence outputs (N,H,W). | |
| seam_dilate | INT | 40–32 | Grow the filled region by this many pixels via non-blurring edge extend (each new pixel copies a filled neighbour, no averaging) to prevent black-bleed at UV seams under bilinear sampling. 0 disables. |
| fill_thresholdopt | FLOAT | 0.050–1 | Pixels with summed confidence below this are treated as gaps in filled_mask. |
| target_maskopt | MASK | Full UV-layout silhouette — where the final texture SHOULD have data (typically BD_FaceTextureBake's uv_layout_mask). Used to compute inpaint_mask = target & ~filled, so Qwen explicitly paints gaps no view covered. If omitted, inpaint_mask is just ~filled (background included). | |
| confidence_gammaopt | FLOAT | 3.00.1–8 | Raise confidences to this power before blending. >1 makes the highest-confidence view dominate each texel more sharply, which cuts ghosting/blur from averaging slightly-misaligned views. 1 = flat linear blend (more prone to blur); 3 = default; higher = closer to hard winner-take-all. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| uv_texture | IMAGE | — |
| confidence | MASK | — |
| filled_mask | MASK | — |
| inpaint_mask | MASK | — |
| status | STRING | — |