VS Label Shade + Composite
Making clean label art match the lighting it never had
- base
- label
- mask
- clip_to_mask
- image
- shaded_label
Here's the failure mode this node exists for: you've wrapped a pristine vector label onto your bottle, it's geometrically perfect, and it looks like a decal from a video game. Real labels aren't evenly lit - the cylinder falls off toward both edges, the specular stripe down the front lifts them, and the shadow side is a stop darker. VS Label Shade + Composite measures that lighting off the original photo and paints it onto your clean label, then composites the result back into the base image.
How it works
It fits a per-column linear model, base_luma ≈ gain(x) · label_luma + lift(x), using only the pixels where your mask is above 0.95 - i.e. where the label actually is. Those per-column sums are blurred horizontally by column_smoothing_px before the fit, so a column of flat red doesn't produce a wild gain. regularize exists for the same reason, and the author says so in the tooltip: "Pulls gain toward 1 on columns with little label contrast." Then it applies label · gain + lift to the clean art and blends that toward the original by strength.
One thing to appreciate: this transfers lighting, not pixels. Your label keeps its own type and its own colour. It's the difference between relighting a sign and re-photographing it. It also means the shading follows the base image's vertical specular streaks for free, because gain and lift are solved per column, not per region.
gain is clamped to 0.05–3.0 and lift to −0.5–0.9 in the source, so a badly-matched mask degrades into a weird-but-not-catastrophic result rather than a blown-out mess. Small mercies.
Inputs and outputs
base is the photographic plate, label is the wrapped label from VS Cylinder Label Wrap, mask is the wrap's mask. column_smoothing_px at 6 is a sensible default for a 4K canvas; go higher if the bottle has a noisy backdrop bleeding into the columns, lower if you want the specular stripe sharper.
strength at 1.0 applies the fit fully. Pulling it to 0.7 is a legit move when the base is a bit contrasty and the label starts looking dirty. regularize at 0.02 is fine; raise it if the label has large flat areas and the shading goes blotchy under them.
The optional clip_to_mask is labelled "Bottle mask. Keeps label pixels inside the silhouette." Plug your bottle mask in and the label coverage gets eroded by a pixel against it, so no stray label pixel hangs off the edge of the glass. Do this. It costs one wire and fixes the one edge artifact everyone notices.
Outputs are image (base with the shaded label composited in, ready for the plate pipeline) and shaded_label (just the shaded label, useful for debugging or for compositing elsewhere).
Install
Manager → VS Glass Matte, or:
cd ComfyUI/custom_nodes
git clone https://github.com/andrewclass1/comfyui-vs-glassmatte
# restart ComfyUI
No requirements, no checkpoints, torch and numpy only.
Where people get burned
The regression needs variation in the label and in the base along each column. On a label with a big flat colour band, var collapses and the gain is whatever regularize says it is - the practical symptom is shading that looks smeared or "painted on". Narrowing column_smoothing_px helps; so does keeping regularize above zero.
Second: the mask has to be the same label placement the base image has. If your wrap is calibrated a few percent off, you're regressing base lighting against label pixels that don't correspond to it, and you'll get a shading gradient going the wrong way - brighter on the shadow side. When the shading looks inverted, that's your tell, and the fix is upstream in the wrap calibration, not here.
Third, and this is taste rather than a bug: full strength on a glossy bottle can make the label look slightly metal. On dark glass bottles I usually end up at 0.85–0.95 and leave it there.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| base | IMAGE | — | |
| label | IMAGE | — | |
| mask | MASK | — | |
| column_smoothing_px | FLOAT | 6.00–200 | — |
| strength | FLOAT | 1.000–1 | — |
| regularize | FLOAT | 0.0200–1 | Pulls gain toward 1 on columns with little label contrast. |
| clip_to_maskopt | MASK | Bottle mask. Keeps label pixels inside the silhouette. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| shaded_label | IMAGE | — |