Nodes/ComfyUI-TextureAlchemy/Composite Mask Adjuster
ComfyUI Node

Composite Mask Adjuster

Relight a region, not the whole material

By amtarr·Created 9 months ago·Updated 4 months ago· 58
Composite Mask Adjuster
  • mask
  • albedo
  • shading
  • residual
  • albedo
  • shading
  • residual
brightness1.00
contrast1.00
gamma1.00
saturation1.00

When you split a photo into albedo, shading, and residual - the way this pack's Lighting Extractor does - you get three layers that recombine into the original image. The power of that split is that you can edit one layer without wrecking the others. Composite Mask Adjuster takes that further: it edits all three layers at once, but only inside a masked region, so a targeted change stays targeted.

Think of it as a localized grading pass. You've got a piece of a texture that's too dark, or a shading region that needs contrast, or an area where the albedo is too saturated - you paint a mask over just that area, dial in brightness/contrast/gamma/saturation, and the node applies them to whichever of the three passes you connect. Outside the mask, nothing changes.

How it works

Each connected input pass gets the full treatment inside the mask: brightness (multiply), contrast (around midpoint), gamma (power), and saturation (luminance blend). The mask is used as a blend factor between the adjusted and original values, so edges feather smoothly instead of hard-cutting. The saturation control is explicitly albedo-only - its tooltip says so, and it makes sense, because shading and residual are effectively grayscale-ish passes where saturation would do nothing useful anyway.

The inputs

  • mask - required. An IMAGE (white = adjusted, black = untouched).
  • albedo, shading, residual - all optional. Connect only the passes you want adjusted; unconnected outputs come back as None and are skipped. This makes the node flexible: you can run it on a full three-pass stack, or just on a single albedo.

The four adjustment floats - brightness, contrast, gamma, saturation - all default to 1.0 (no change), and range 0–3 (brightness/contrast/saturation) or 0.1–3 (gamma).

Outputs: albedo, shading, residual, matching whatever you connected.

Where it fits

The intended flow is: Lighting Extractor → Composite Mask Adjuster → Basic Lighting Builder. Extract the three passes, paint a mask over the part of the material you want to fix, adjust, then rebuild the composite with albedo * shading + residual. It's also handy as a standalone mask-based brightness/contrast tool if you only wire in one image - nothing forces you to use all three slots.

One note: the mask is an IMAGE here, not a MASK tensor, so if you're coming from a mask-editing node that emits MASK, convert it first or the socket won't connect.

Installation

Ships in amtarr/ComfyUI-TextureAlchemy under Add Node → Texture Alchemist → Materials. Install via ComfyUI Manager (search "TextureAlchemy") or:

cd ComfyUI/custom_nodes
git clone https://github.com/amtarr/ComfyUI-TextureAlchemy

Restart ComfyUI. No extra dependencies - pure torch, no models to fetch.

CategoryTexture Alchemist/Materials

Inputs (8)

NameTypeDefaultDescription
maskIMAGE
brightnessFLOAT1.000–3Brightness multiplier in masked areas
contrastFLOAT1.000–3Contrast adjustment in masked areas
gammaFLOAT1.000.1–3Gamma correction in masked areas
saturationFLOAT1.000–3Saturation adjustment in masked areas (affects albedo only)
albedooptIMAGE
shadingoptIMAGE
residualoptIMAGE

Outputs (3)

NameTypeDescription
albedoIMAGE
shadingIMAGE
residualIMAGE