Nodes/ComfyUI_agilly1989_motorway/LatentOperationTonemapReinhard_motorway_edition
ComfyUI Node

LatentOperationTonemapReinhard_motorway_edition

Stop blown-out highlights before they happen — tonemap in latent space

By agilly1989·Created 2 years ago·Updated about a year ago· 7
LatentOperationTonemapReinhard_motorway_edition
  • MOTORWAY 🚌💨
  • MOTORWAY 🚌💨
multiplier1.00
OUTPUT_LATENT_OPERATION_keyLATENT_OPERATION

LatentOperationTonemapReinhard_motorway_edition is the fix for a very specific annoyance: outputs where the bright areas wash out to featureless white. That "the sky exploded into a white blob" failure is the diffusion model saturating in latent space, and you can't fix it by lowering brightness on the pixels afterward - the information is already gone by then.

This node applies Reinhard tonemapping to the latent during sampling. The Reinhard curve is the classic x / (1 + x) - a gentle compression that squeezes bright values down while leaving midtones mostly alone, exactly like the tonemapping in photo editing. The multiplier knob scales how hard it presses on the highlights. Keep it near 1 for subtle protection, raise it when your scene is genuinely high-contrast (bright skies, strong rim light, harsh studio looks) and your model keeps melting the highlights into nothing.

Like LatentOperationSharpen, this node does not emit a tonemapped latent. It outputs a latent operation - a "tonemap me like this" instruction that a sampler with a latent_operation input (core KSamplerAdvanced) consumes during the denoise loop. It's an experimental core feature that's genuinely useful: it's the difference between a workflow that survives a high-contrast prompt and one that quietly loses the top of its histogram.

The wrapper

The core node has only widget parameters, so this wrapper is simpler than most Motorway-ed clones:

  • multiplier (FLOAT, 0–100, default 1) - how hard to compress highlights.
  • OUTPUT_LATENT_OPERATION_key (default LATENT_OPERATION) - where the operation lands in the pipe.
  • MOTORWAY 🚌💨 - marked optional in the schema, but connect it anyway. The wrapper still needs a pipe to store the operation under the output key, and without one you get an unhelpful error.

Your downstream sampler reads the LATENT_OPERATION key back out of the pipe and applies it during sampling. If nothing reads that key, the node silently does nothing.

Installing

Part of the Motorway pack:

cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
# restart ComfyUI

Or ComfyUI Manager → search ComfyUI_agilly1989_motorway → Install. No models, no extra pip dependencies.

Gotchas

  • The operation only does something if a sampler downstream consumes the LATENT_OPERATION key. No reader, no effect.
  • You need a MotorwayStart upstream to have a pipe.
  • Keys are exact strings; a Key: 'LATENT_OPERATION' doesn't exist in motorway error means nothing wrote that key before the sampler read it.
  • This is experimental core wrapped in a beta pack - the author's README is blunt: "IF THINGS BREAK ITS BECAUSE I BROKE IT." Missing from the menu after install is a beta/version thing, not you.

If you've never had an output turn into a white pancake, you may not need this node. The moment you do, it's the right tool - and it's a lot easier than re-engineering your whole prompt stack around avoiding bright scenes.

Categoryagilly1989 Nodes/Motorway-ed/latent/advanced/operations

Inputs (3)

NameTypeDefaultDescription
multiplierFLOAT1.000–100
OUTPUT_LATENT_OPERATION_keySTRINGLATENT_OPERATION
MOTORWAY 🚌💨optMOTORWAY 🚌💨

Outputs (1)

NameTypeDescription
MOTORWAY 🚌💨MOTORWAY 🚌💨