CoCo Load EXR Layer by Name
Nuke's Shuffle node, for ComfyUI
- layers
- image
- mask
If you've ever used Nuke, you know the Shuffle node: you point it at a multilayer file, type the pass you want, and out comes that one layer ready to composite. CoCo Load EXR Layer by Name is that node for ComfyUI - the thing that takes the giant LAYERS dictionary from a CoCo EXR loader and pulls out just the pass you're after. It's the node that turns one multilayer EXR into a pile of separate, usable branches.
How it works
Feed it the layers output from CoCo Load EXR or CoCo Load EXR Sequence, give it a layer_name, and it extracts that layer from the dict and decides how to present it based on the conversion setting (Auto, To RGB, or To Mask). The Auto logic is where the intelligence is:
- Layers with "alpha" in the name become a mask.
- Depth and Z layers are single-channel but returned as RGB (replicated across channels), because that's what IMAGE tensors and most previews expect.
- Other single-channel layers default to RGB in Auto mode too - switch to
To Maskto get the raw single channel instead.
So a typical pipeline reads: Load EXR → two or three Load EXR Layer by Name nodes, one for diffuse, one for normals, one for Z - each feeding its own colorspace conversion and preview. The pack's example workflow is exactly that, and it's the cleanest demonstration of the whole pack in one screen.
The inputs and outputs
layers(LAYERS) - the dict from a loader. No layers connected? You get empty placeholder tensors (1×1), not an error.layer_name- a string, manually typed, default "none". This is the fiddly bit, and the pack knows it: the loader'slayer namesSTRING output is your cheat sheet. Wire that into a text viewer or just read the note in the example workflow - "the layer names are what you should use."conversion- optional, defaults to Auto.- Outputs:
image(IMAGE) andmask(MASK). One of them will be a placeholder depending on the conversion; the other carries your data.
The name matching is forgiving in a way that's both convenient and a trap. It tries exact, then case-insensitive, then partial, then hierarchical (CITY SCENE.AO when you type AO), then subimage names - and if nothing matches, it falls back to the first available layer without complaining. That last one will silently hand you the wrong pass, so glance at the output once before you trust it in a long chain.
Installing it
Part of the CoCoTools pack - Manager ("CoCoTools") or:
cd ComfyUI/custom_nodes
git clone https://github.com/Conor-Collins/ComfyUI-CoCoTools_IO
pip install -r ComfyUI-CoCoTools_IO/requirements.txt
Needs the pack's OpenImageIO dependency (portable installs: python_embeded\python.exe -m pip install ...), and it only does anything when fed by the pack's own loaders - the LAYERS type is custom to CoCoTools, not a core type.
Common issues
- Typed a name that doesn't exist → either a fuzzy match grabs a similar layer or, worst case, the first layer in the dict. Double-check against the loader's
layer namesoutput. - Left it at "none" → empty placeholder output, which looks broken but is the documented behavior.
- Depth looking wrong → remember depth/Z default to RGB in Auto mode. If you want the raw depth channel for a normalizer, set
conversiontoTo Mask(or just run the RGB version into CoCo Z Normalize, which handles it).
For the 3D-render-to-ComfyUI crowd this is arguably the pack's most useful node - the whole point of the CoCoTools EXR loaders is to hand you each pass separately, and this is the hand. It's a quiet, under-discovered node (single-digit impressions), but it's the Shuffle you've been missing.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| layers | LAYERS | — | |
| layer_name | STRING | none | — |
| conversionopt | COMBO | Auto | 3 options: Auto, To RGB, To Mask |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |