BD Face Texture Bake
Nvdiffrast UV bake that turns head photos into a face texture
- images
- face_fit
- uv_textures
- confidences
- uv_layout_mask
- status
This is where the FaceWrap pipeline turns from "we have landmarks and a head mesh" into "we have an actual face texture." BD Face Texture Bake rasterizes your source head photos into the canonical UV layout using nvdiffrast - per UV texel it interpolates the mesh's per-view vertex positions into source-image coordinates and bilinearly samples the photo. The output is a batch of per-view baked textures plus per-view confidence masks that feed straight into the blend step.
How it works
For each view, for each output UV texel: rasterize the canonical UV layout → interpolate the 3 corner verts_2d → bilinear-sample the source image at that coordinate. The confidence mask is the front-facingness of the underlying triangle, clamped to [0,1] - so a frontal view gets high confidence across the face, and a view barely touching a texel contributes weakly. That confidence is the currency the downstream BD_UVConfidenceBlend spends when it merges views.
Inputs:
- images - source photo batch, same order/count as the LANDMARKS_BATCH the FACE_FIT was built from.
- face_fit - from BD Face Fit (canonical mesh + per-view 2D vertex positions).
- view_index (-1) - default bakes all detected views. Set ≥ 0 to bake a single view for debugging; output stays a 1-length batch so wiring doesn't change.
- texture_size (2048) - UV texture resolution; 8192 max if you're doing hero-quality.
- min_confidence (0) - texels with face-cosine below this get zeroed in the mask.
Outputs: uv_textures (batch), confidences (mask batch), uv_layout_mask (a view-independent mask marking every texel that maps to a mesh triangle - wire it into BD_UVConfidenceBlend.target_mask so gaps no view filled get inpainted), and status. Undetected views (rear, failed detection) are skipped entirely - no landmarks, nothing to contribute.
Installing
ComfyUI Manager → search "BrainDead" → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/BizaNator/ComfyUI-BrainDead
cd ComfyUI-BrainDead
pip install -r requirements.txt
Restart. Requires nvdiffrast - a CUDA rasterizer. If you see an import error at load, pip install nvdiffrast in your environment (and yes, you need CUDA; the CPU fallback isn't a thing here).
Where people get burned
The pipeline is only as good as its alignment: if the FACE_FIT was built from different photos than the ones you're baking, everything smears - keep the image batch and landmarks in lockstep. Second: don't skip the confidence outputs. The un-blended baked texture from one view will have seams and ghosting; the confidence masks exist to make the blend work, so wire them into UVConfidenceBlend rather than eyeballing a single view. And view_index ≥ 0 is a debugging tool, not a production setting - baking everything is the intended path.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | Source photo batch — same order/count as the LANDMARKS_BATCH the FACE_FIT was built from. | |
| face_fit | BD_FACE_FIT | FACE_FIT from BD_FaceFit. Provides canonical mesh + per-view 2D vertex positions. | |
| view_index | INT | -1-1–63 | -1 = bake ALL detected views (default). >= 0 = bake only that view index. |
| texture_size | INT | 2048256–8192 | Output UV texture resolution. |
| min_confidenceopt | FLOAT | 0.000–1 | Texels with face-cosine below this are zeroed in the mask. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| uv_textures | IMAGE | — |
| confidences | MASK | — |
| uv_layout_mask | MASK | — |
| status | STRING | — |