Nodes/ComfyUI-CustomNodePacks/Merge Render Passes (MEC)
ComfyUI Node

Merge Render Passes (MEC)

Combine beauty with AO, diffuse, specular and emission like a real comp

By Code2Collapse·Created 6 months ago·Updated a day ago· 52
Merge Render Passes (MEC)
  • beauty
  • diffuse
  • specular
  • emission
  • ao
  • image
diffuse_gain0.00
specular_gain0.00
emission_gain1.00
ao_strength1.00

If you're coming from VFX, "render passes" needs no explanation - beauty, diffuse, specular, emission, ambient occlusion - and you've spent years knowing exactly how they should stack. If you're not, this is the node that lets you re-light a rendered image by recombining its parts. Merge Render Passes (MEC) composites a beauty pass with optional auxiliary passes, with per-pass gain controls, and it's the small, pure-tensor corner of the pack aimed squarely at people doing real comp work inside ComfyUI.

The formula, straight from the source:

out = beauty * (ao_strength * AO + (1 - ao_strength)) +
      diffuse_gain * diffuse + specular_gain * specular + emission_gain * emission

How it works

Only beauty is required. Every other pass - diffuse, specular, emission, ao - is optional, and a missing pass simply contributes nothing. Passes are resized to match the beauty pass automatically if the dimensions differ, so mismatched EXR loads don't blow up the node.

The gain knobs:

  • ao_strength (default 1) - AO is multiplicative on beauty. 1.0 applies it fully; 0.5 fades it toward neutral. Since AO darkens crevices, this is your "how moody is this render" control.
  • diffuse_gain / specular_gain (default 0) - additive, and allowed to go negative (down to -2). You can literally subtract specular to knock the shine off a render, which is the kind of control the rest of ComfyUI never gives you.
  • emission_gain (default 1) - additive. Crank it to make emissive elements glow through.

Output: a single image, clamped to [0, 1e6] - note that upper bound: it won't crush values that exceed 1.0, which matters if you're feeding a linear/HDR pipeline. The node doesn't tone-map for you; it assumes you know what space you're in.

Where it fits

Pair it with the pack's EXR load/save and color-space convert nodes for a genuine render-pass comp: load passes → merge → convert to Rec.709 → save. Without an HDR pipeline it's still useful for "I rendered beauty and AO separately, now combine them with control." It's pure tensor math - no dependencies, no VRAM pressure, works on a video batch if you've got per-frame passes.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Code2Collapse/ComfyUI-CustomNodePacks.git

or ComfyUI Manager → search "CustomNodePacks", restart, confirm [MEC] Loaded .... No extra pip packages. If the composite comes back looking washed out, check whether your passes are already premultiplied or straight - the node assumes straight passes added over beauty, and feeding it premultiplied data will double-darken the edges. That's a data-format issue, not a node bug.

CategoryMaskEditControl/Render

Inputs (9)

NameTypeDefaultDescription
beautyIMAGE
diffuseoptIMAGE
specularoptIMAGE
emissionoptIMAGE
aooptIMAGE
diffuse_gainoptFLOAT0.00-2–4
specular_gainoptFLOAT0.00-2–4
emission_gainoptFLOAT1.000–4
ao_strengthoptFLOAT1.000–1

Outputs (1)

NameTypeDescription
imageIMAGE