Nodes/MKRShift_Nodes/Opacity Map
ComfyUI Node

Opacity Map

Cutouts, decals, and soft transparency from your alpha

By criskb·Created 7 months ago·Updated 5 months ago· 0
Opacity Map
  • image
  • source_mask
  • mask
  • image
  • mask
  • opacity_info
source_mode
normalize_mode
value_min0.000
value_max1.000
percentile_low2.0
percentile_high98.0
detail_radius1.5
detail_strength0.00
gamma1.00
contrast1.00
blur_radius0.0
invert_valuesfalse
mask_feather8.0
invert_maskfalse

Every material pipeline eventually needs a map that says "what's solid and what's see-through," and that's exactly what x1OpacityMap produces. Feed it an image with an alpha channel (or a mask) and it emits a clean grayscale opacity map - white is opaque, black is transparent - ready for a decal, a card, a cutout, or a soft-transparency material.

It's part of MKRShift Nodes' Surface/Maps family, and the author's docs point at the natural use case: it's a direct companion for the opacity slot on the pack's x1PreviewMaterial shader ball. Derive the map here, preview it there, then pack it into an ORMA texture with x1PBRPack.

The "combined_opacity" behavior (read this)

The default source_mode is combined_opacity, and the author made a deliberate, honest choice here: it prefers the input's alpha channel, falls back to a supplied source_mask, and if there's neither, it treats the surface as fully opaque. It will not guess transparency from color alone.

That last part is the design decision worth respecting. A node that auto-transparentizes anything dark is a trap - you'd get holes in every shadow. combined_opacity stays conservative because opacity maps should be driven by real alpha data, not inference. If you want transparency from brightness, set source_mode to luma or a channel and you're in charge of what reads as transparent.

The other inputs

Beyond source_mode, the family-standard controls apply:

  • normalize_mode - auto_percentile, manual_range, or auto_range
  • value_min / value_max, percentile_low / percentile_high - the normalization window
  • gamma, contrast, blur_radius - shape the result. Blur is the one to reach for on soft edges
  • invert_values - flip opaque ↔ transparent
  • detail_radius / detail_strength - only relevant when source_mode is detail

Optional inputs are source_mask and mask: the former is the opacity source in mask mode (or the fallback for combined_opacity), the latter limits where the opacity map is emitted.

Outputs: image (the grayscale map), mask (the scalar as a MASK), and opacity_info (a string reporting the resolved source and normalization range - handy when combined_opacity quietly resolved to "opaque" because your image had no alpha).

Where this slots in

The cleanest workflow is: render a sprite or decal with alpha → x1OpacityMapx1PreviewMaterial's opacity slot → check the cutout on the shader ball. If you're packing for an engine, x1OpacityMap output feeds the alpha slot of x1PBRPack's ORMA layout. The whole Surface/Maps family shares one normalization vocabulary, so the map you get here behaves like the ones from x1RoughnessMap and x1MetalnessMap.

Installing it

ComfyUI Manager, search "MKRShift Nodes", or:

cd ComfyUI/custom_nodes
git clone https://github.com/criskb/MKRShift_Nodes

Restart and it's there. No requirements, no model files, no ffmpeg - pure numpy math. The usual caveat stands: the pack is a huge grab-bag, so you're installing a lot to reach one small family. If opacity/cutout work is a recurring need, the Surface branch plus x1PreviewMaterial is a genuinely useful combo that justifies it.

Where people trip

The most common "why is nothing transparent" moment is exactly the conservative fallback: your source has no alpha and no mask, so combined_opacity outputs solid white. Check opacity_info - if it says combined_opacity(opaque), that's the behavior doing its job, and you need to either supply a mask or switch source_mode to a channel you actually want to key on.

CategoryMKRShift Nodes/Surface/Maps

Inputs (17)

NameTypeDefaultDescription
imageIMAGE
source_modeCOMBO10 options: combined_opacity, alpha, red, green, blue, luma, +4
normalize_modeCOMBO3 options: auto_percentile, manual_range, auto_range
value_minFLOAT0.0000–1
value_maxFLOAT1.0000–1
percentile_lowFLOAT2.00–100
percentile_highFLOAT98.00–100
detail_radiusFLOAT1.50.1–64
detail_strengthFLOAT0.000–2
gammaFLOAT1.000.1–4
contrastFLOAT1.000.1–4
blur_radiusFLOAT0.00–128
invert_valuesBOOLEANfalse
mask_featherFLOAT8.00–256
invert_maskBOOLEANfalse
source_maskoptMASK
maskoptMASK

Outputs (3)

NameTypeDescription
imageIMAGE
maskMASK
opacity_infoSTRING