X2HDR LogC3 Decode
Turn log-encoded model output into real scene-linear HDR
- image
- hdr_image
- metrics_json
Not every HDR training setup encodes in PU21. If your model or LoRA was trained with ARRI LogC3 targets - a popular choice, because LogC is a battle-tested camera transfer function with tons of reference material - then the image coming out of VAE Decode is LogC3-encoded, and you need the inverse to reach scene-linear HDR. That inverse is X2HDR LogC3 Decode.
How it works
It applies the ARRI LogC3 EI 800 transfer-function inverse per channel. The curve is piecewise - a linear toe below the cut, a log section above - and the constants in the source are the standard ARRI ones. At encoded value 1.0 the decode reaches roughly 55.1, about five-and-a-half stops above 1.0.
Two things it deliberately does not do. No peak scaling or percentile normalization - the PU21 node does that; LogC is self-scaling. And no AWG3 gamut matrix - you get the source RGB primaries back unchanged, so plan a separate color-space conversion downstream if you need one.
Inputs
- image (
IMAGE) - usually straight fromVAE Decode. - input_range -
0_1(default) orminus1_1. Pickminus1_1only if the upstream tensor is centered on [-1, 1]. - clamp_logc - default true; clamps encoded LogC values to [0, 1] before decoding, per the tooltip. Leave it on unless your upstream pipeline already guarantees the range.
Outputs
- hdr_image (
IMAGE, float32) - linear HDR, values above 1.0 expected. Wire it intoX2HDR Save EXR,X2HDR Color Grade,X2HDR Tone Map Preview, orX2HDR Dynamic Range QA. - metrics_json (
STRING) - decode statistics for a quick sanity check.
Installing it
Part of the facok/comfyui-x2hdr pack (an independent implementation - the official X2HDR repo lives at X2HDR/X2HDR). ComfyUI Manager → search comfyui-x2hdr → install, restart, nodes under image/HDR/X2HDR. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/facok/comfyui-x2hdr
then restart. The only extra dependency is PyAV (av), imported at load time; if the pack errors, pip install av in ComfyUI's Python environment.
Where people get burned
- The mismatch trap. A LogC3-decoded image from a LogC4-trained model looks fine as a preview but carries wrong scene-linear values - "plausible previews while returning incorrect scene-linear values," as the README puts it. Pick the exact curve the training targets used. When in doubt,
X2HDR Dynamic Range QAplus its exposure strip will show you whether the range is really there. - Negative values are legit. LogC decodes code values below reference black to negative linear values. That's correct behavior, and
X2HDR Save EXRcan clamp them withclamp_negative(on by default). - Don't use this on PU21 output. You'll get double-decoded nonsense. PU21 output goes to
X2HDR PU21 Decode, LogC output goes here.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| input_range | COMBO | 0_1 | 2 options: 0_1, minus1_1 |
| clamp_logc | BOOLEAN | true | Clamp encoded LogC values to [0, 1] before decoding. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| hdr_image | IMAGE | — |
| metrics_json | STRING | — |