Energy Mask
Local CFG, without stacking three samplers to fake it
- conditioning
- mask
- conditioning
- mask
CFG is a global dial, and that's the whole problem with it. Turn it up to make the eyes crisp and you also get over-saturated background foliage and the classic all-over "fried" look. Energy Mask is Radiance's answer: attach a mask to your conditioning and let the sampler apply a local guidance bonus inside it, leaving the rest of the frame on the sampler's own CFG.
The author calls it Energy-Prioritized Sampling. You'll call it "the thing that sharpened the subject without wrecking the sky".
How it works
It wraps a mask into the conditioning and the sampler multiplies guidance there. The maths, straight from the tooltip:
effective CFG inside the mask =
cfg × (1 + priority)
With the sampler at CFG 4 and priority at 0.5, you get effective guidance of 6 inside the mask and 4 everywhere else. The author's own suggested range for highlight emphasis is 0.25–0.75, and anything above 1.5 gets you the usual local over-guidance artifacts - it's the same fried look, just confined to one region.
Negative priorities work and are the interesting half: a negative priority suppresses guidance inside the mask, which is the cheapest way to keep a background soft while a subject sharpens up. And chaining stacks - two of these in series add where the masks overlap, so a broad +0.2 over a whole subject with a tight +0.6 on the practical lights does exactly what it sounds like. The combined modifier is floored at 0, so a pile of negative priorities suppresses guidance flat rather than inverting it into something weird.
Inputs and outputs
conditioning is the positive you're attaching to, and mask is the high-energy region - white is boosted, black is untouched. The mask gets resized to the latent grid at sampling time, so any resolution works. That's a small quality-of-life thing that saves an entire resize node.
priority (0.5) is the strength, as above. invert swaps masked and unmasked. normalize rescales the mask so its darkest pixel is 0 and brightest is 1 - turn it on for luminance or depth passes that aren't already in [0,1], which is most of them. gain (0–4) multiplies the mask before clamping, i.e. it hardens a soft mask.
Outputs are conditioning (wire this into the sampler's positive) and mask if you need to see or reuse what you applied. There's no preview, so if you want to check the mask, plug a preview node into that second output.
The catch
This is a Radiance sampler feature, not a generic conditioning trick. The tooltip says to connect the output to RadianceSamplerPro's positive, and that's not a suggestion - a normal KSampler will ignore the attached mask and give you an unmodified image. If your "energy mask does nothing", you're probably running it into stock sampling nodes.
And note the semantics: this boosts guidance, not prompt. It doesn't tell the model what to put there. If the region isn't already in your prompt, more guidance makes the existing description more emphatic; it doesn't introduce a new subject. For that you want a regional prompt node.
Install
Ships in Radiance. Manager → Radiance → install, restart, hard-refresh. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/fxtd-studios/radiance.git
cd radiance
python -m pip install -r requirements.txt
Windows portable users: python_embeded\python.exe for the pip step. No model downloads.
Where people get burned
Turning it up until it's localised frying. The failure mode of global CFG, but with an outline. Use the lower end of the range and widen the mask before you raise the priority - a soft gradient mask at +0.3 usually beats a hard-edged mask at +0.8, because a hard boundary shows up as a visible change in texture.
Stacking without doing the arithmetic. Two overlapping masks at +0.6 each is +1.2 effective, and the chained result adds rather than maxes. If you're layering, add up the priorities where the masks cross before you blame the model.
Masks from the wrong space. A depth pass straight out of a depth node is not necessarily 0–1 after inversion, and an unnormalized mask gives you a priority that applies everywhere or nowhere. Hit normalize.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| conditioning | CONDITIONING | Positive conditioning. Connect the output to RadianceSamplerPro's `positive`. | |
| mask | MASK | High-energy region. White = boosted guidance, black = untouched. Resized to the latent grid at sampling time, so any resolution works. | |
| priority | FLOAT | 0.50-1–4 | Local guidance bonus inside the mask. Effective CFG there is cfg × (1 + priority). 0 disables EPS; negative softens the region. Chained Energy Mask nodes stack, so priorities add where masks overlap. |
| invert | BOOLEAN | false | Swap masked and unmasked regions before applying priority. |
| normalize | BOOLEAN | false | Rescale the mask so its darkest pixel is 0 and brightest is 1. Use for luminance or depth passes that are not already in [0,1]. |
| gain | FLOAT | 1.000–4 | Multiplier applied to the mask before clamping to [0,1]. Hardens a soft mask. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| conditioning | CONDITIONING | — |
| mask | MASK | — |