◎ Radiance VAE Decode
VAE decode that won't OOM at 4K and won't clamp your HDR highlights
- samples
- vae
- alpha
- image
- metadata
- latent_format
Every ComfyUI pipeline ends the same way: latent in, VAE decode, image out. The stock node does it at any size the VRAM allows and clamps the result to a 0–1 SDR range - which is exactly why HDR and 4K workflows replace it. ◎ Radiance VAE Decode is the production decode: it tiles so 4K+ latents decode without OOM, and it can output true float HDR instead of a clamped, banded mess.
The KB's VAE essay frames the baseline - the VAE turns the latent back into pixels, and the wrong VAE or wrong channel count produces garbage rather than a subtly wrong image. This node adds the two things the stock decode silently refuses to do: decode at sizes beyond your VRAM, and not clamp. That second one is the whole HDR story.
How it works
Like its encode sibling, it tiles the latent (tile_size from Auto to 1536, overlap 32–256) with cosine blending so seams stay invisible - that's the "decode a 4K latent on an 8GB card" trick. It auto-detects the VAE factor and channel count (it'll tell you the latent format, e.g. flux_16ch). Then it gives you control over what the output means:
target_space- what color space to hand you: Linear, ACEScg, sRGB, or a log curve (LogC3/LogC4, S-Log3, V-Log, RED Log3G10, etc.).hdr_mode- must match your encode setting.Compress (Log)(v2.3) is the true-HDR path: soft-shouldered, highlight-denoised, no hard clamp, so the full log-curve dynamic range comes out clean.Soft Clipinverts a tanh rolloff;Passthroughgives extended sRGB range.hdr_output- the honest switch: when on, it skips the final [0,1] clamp, so the output tensor carries real scene-linear values above 1.0 and below 0. This is what you want for EXR/HDR delivery, and what you must turn off when feeding SDR nodes (previews, PNG export) or you'll confuse everything downstream.inverse_tonemap+target_stops- expand an SDR latent up to a chosen dynamic range (8–16 stops) to recover highlight shape.crop_padding- paste the encode'smetadatahere to auto-crop the padding the tiled encode added, for a clean round-trip.
Outputs: image, metadata (JSON), and latent_format (for validating downstream).
The inputs that matter
samplesandvae- required.target_space- set to match where the image is going.hdr_output- the big one: on for HDR pipelines, off for SDR.force_hdr_decode- the sharp edge: it forces the HDR path even when noradiance_metais in the latent. The tooltip is blunt - keep it False when decoding after a sampler (the sampler produces sRGB-encoded latents, and forcing log/softclip inversion there gives wrong color); it's for direct encode→decode pipelines.
How to install it
In the radiance pack. ComfyUI Manager → "Radiance", or:
cd ComfyUI/custom_nodes
git clone https://github.com/fxtdstudios/radiance.git
cd radiance
pip install -r requirements_windows.txt
Restart, and it's under FXTD Studios/Radiance/Generate.
Common issues
The failure modes are almost all "mode agreement." Decode's hdr_mode/source_space must mirror what the encode used, and force_hdr_decode will produce wrong color if you flip it on after a sampler - the tooltip is there because people did exactly that. And hdr_output left on while feeding an SDR preview is the classic "my image is all wrong in the viewer but fine on export" moment; the pack's own docs remind you to disable it for SDR nodes. If output looks noisy in brights under Compress (Log), that's the decode-side denoise doing its thing - dial expectations on log-range material. Everything else about "decode at scale, keep the floats" just works, which is the point.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| samples | LATENT | — | |
| vae | VAE | — | |
| target_space | COMBO | Linear | Output color space. |
| tile_sizeopt | COMBO | Auto | Tile size for decode. Auto queries VRAM. |
| overlapopt | INT | 12832–256 | Overlap between tiles. 128px optimal for cosine blending. |
| exposure_adjustopt | FLOAT | 0.0-10–10 | Post-decode exposure in stops. |
| alphaopt | IMAGE | Alpha channel from Radiance VAE 4K Encode. | |
| hdr_modeopt | COMBO | Clip (SDR) | Must match encode setting. 'Compress (Log)' (v2.3): true HDR — soft-shouldered, highlight-denoised, no hard clamp. Produces clean HDR output across the full log-curve dynamic range. 'Soft Clip': inverts tanh rolloff to recover highlights. 'Passthrough': extended sRGB range. |
| inverse_tonemapopt | BOOLEAN | false | Expand SDR to HDR (recover highlights). |
| target_stopsopt | FLOAT | 12.08–16 | Target dynamic range for inverse tonemap. |
| crop_paddingopt | STRING | JSON metadata from encode (auto-crops padding). Leave empty to skip. | |
| export_rhdropt | BOOLEAN | false | Export .rhdr sidecar for Radiance Viewer. |
| rhdr_precisionopt | COMBO | f16 | RHDR export precision. 'f16' (fp16, default): smaller files, values capped at 65504 — adequate for most VFX material. 'f32' (fp32): full 32-bit range, ~2× file size — use for shots with extreme linear values (direct sun, fire VDBs). |
| source_spaceopt | COMBO | Linear | Source space used during encode. Required when hdr_mode is 'Compress (Log)' to invert the exact same log curve. |
| processing_modeopt | COMBO | sequential | 'sequential' processes one tile at a time with minimal VRAM usage. |
| force_hdr_decodeopt | BOOLEAN | false | HDR DIRECT PATH — enables 32-bit HDR output for direct encode→decode pipelines (no sampler between nodes). When True: hdr_mode is always respected, even if radiance_meta is absent from the latent. Keep False when decoding after diffusion sampling — the sampler produces sRGB-encoded latents and Log/SoftClip inversion would produce incorrect color output. |
| hdr_outputopt | BOOLEAN | false | 32-BIT HDR OUTPUT — when True, skips the final [0,1] clamp so the output IMAGE tensor carries full 32-bit scene-linear values (>1.0 for bright highlights, <0.0 for below-black). Required for Linear/ACEScg/Log target spaces in HDR VFX pipelines. Disable when feeding SDR nodes (preview, PNG export, etc.). |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | Decoded image tensor. |
| metadata | STRING | Decode metadata JSON. |
| latent_format | STRING | Latent format detected from VAE (e.g. 'flux_16ch'). |