Lighting Pass Mask Applicator
Carve your lighting passes down to just the part you want
- mask
- albedo
- shading
- residual
- albedo
- shading
- residual
Once you start decomposing images into lighting passes - albedo, shading, residual - the next problem is that you rarely want all of a pass. Maybe the albedo is right except for a region that a reflection stained, or the shading is perfect except for one blown highlight. Lighting Pass Mask Applicator is the surgical tool for that: you give it a mask and it applies that mask to whichever of the three standard passes you feed it, zeroing everything you didn't select. The mask defines what you keep; everything else goes black.
It's a niche-but-necessary node, sitting in TextureAlchemy's Texture Alchemist/Materials category next to the Marigold-based extraction tools that produce exactly these passes. If you're doing relighting or material compositing - the "albedo is what the surface is, shading is how light hits it" decomposition that IC-Light-style workflows popularized - you'll bump into the need to mask a pass sooner than you think.
How it works
The mechanism is deliberately simple: each provided pass is multiplied by the mask. What's less obvious is how much housekeeping happens first. The mask gets converted to grayscale if it's RGB, expanded to match the target's channel count (so a single-channel mask works on an RGBA pass), and clamped to 0–1. Each input is optional - albedo, shading, and residual - so you can mask one pass or all three, and unmasked inputs pass through untouched. The node prints a console report of each input's range before and after, which is genuinely useful for spotting when a mask is inverted or collapsed.
The three outputs mirror the inputs: albedo, shading, and residual, each masked where provided. Wire the ones you care about onward; ignore the rest.
Where it fits
Two patterns worth knowing. First, selective fixes: decompose a Marigold lighting output, mask out a bad region in the shading, recompose - you fix the lighting problem without touching the albedo's pixels at all. Second, compositing: mask the residual (specular/reflection) pass to only the glossy regions you want, or mask the albedo to only the surface you're retexturing. It pairs naturally with the pack's Marigold AOV Extractor, whose diffuse_albedo, lighting_direct/indirect, and reflection_specular outputs land directly in these inputs.
Installing it
Ships with ComfyUI-TextureAlchemy. ComfyUI Manager → search "TextureAlchemy" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/amtarr/ComfyUI-TextureAlchemy
Restart, look under Texture Alchemist → Materials. No extra dependencies, no model downloads.
Common issues
- "My whole pass vanished." Your mask is likely inverted - check the console's before/after ranges. A mask of all zeros kills everything, by design.
- "The mask edges are harsh." This node does no feathering; it's a hard multiply. If you want soft transitions, blur the mask before feeding it in (any blur node will do).
- "I only plugged in one pass and got three outputs." That's expected - each output is masked only if its input was provided, so unused ones come back as their input or stay empty depending on what you wired. Keep the wires you need.
It's a small node that does one thing correctly, and when you're elbow-deep in decomposed lighting passes, "one thing, done right" is worth more than a kitchen-sink composite node.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | IMAGE | — | |
| albedoopt | IMAGE | — | |
| shadingopt | IMAGE | — | |
| residualopt | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| albedo | IMAGE | — |
| shading | IMAGE | — |
| residual | IMAGE | — |