Nodes/radiance/◎ Radiance VAE Encode
ComfyUI Node

◎ Radiance VAE Encode

VAE encode that survives 4K, float images, and a round-trip

By fxtdstudios·Created 7 months ago·Updated 9 days ago· 242
◎ Radiance VAE Encode
  • pixels
  • vae
  • samples
  • alpha
  • metadata
  • latent_format
  • quality_report
source_spaceLinear
tile_sizeAuto
overlap128
exposure0.0
alpha_handlingPreserve
hdr_modeSoft Clip
latent_samplingsample
processing_modesequential

ComfyUI's plain VAE Encode does one job and does it fine: image in, latent out. The moment your image is big, float, or needs to survive a round-trip, it starts to hurt. ◎ Radiance VAE Encode is the pack's production version: it tiles big images so 4K+ encodes don't OOM, understands 11 color spaces, can preserve alpha, and tracks what it did so the decode side can undo it cleanly.

The KB's VAE essay is the right context here: the VAE is the compressor between pixel space and latent space, and newer models carry more channels per latent (Flux/SD3 = 16, SDXL = 4). This node's job is to make that conversion precise and repeatable at sizes where the stock node falls over - plus it gives you control over how the latent is sampled, which matters for img2img.

How it works

The core is production tiling: the image is split into tiles (with overlap for cosine blending so seams are invisible), each tile is padded to a VAE-friendly size and encoded, and the latents are stitched back. tile_size defaults to Auto, which queries your VRAM and picks a safe size - that's the anti-OOM magic. overlap (default 128) is the blend width between tiles.

Three things make it different from the stock node. First, color-space awareness: source_space (Linear, ACEScg, sRGB, ARRI LogC3/LogC4, S-Log3, V-Log, etc.) linearizes input correctly before encoding, so float/HDR sources don't get mangled. Second, latent_sampling: sample (default, the standard stochastic draw), mean (deterministic, lowest-noise - the doc's recommendation for img2img), or mode. Third, alpha: alpha_handling can preserve the alpha channel through encode and hand it back out for a round-trip.

There's also the hdr_mode menu (Clip (SDR) / Soft Clip / Compress (Log) / Passthrough) that decides how out-of-range values are handled before encode - the v2.3 Compress (Log) path pushes scene-linear range through a log curve with no post-encode clamp, and the decode side is built to invert it.

The inputs that matter

  • pixels and vae - required, the obvious pair.
  • source_space - set it to what your pixels actually are. Default Linear; choose sRGB for normal images, a log curve for footage.
  • tile_size - Auto unless you're hunting VRAM edges.
  • latent_sampling - mean for deterministic img2img, sample for generation.

Outputs: samples (the latent → Sampler Pro), alpha (alpha tensor → decode), metadata (JSON → decode's crop_padding for auto-crop), latent_format (string like flux_16ch → Sampler Pro's latent_format), and quality_report (clipping %, NaN count, latent range - the honest "did anything break" tell).

How to install it

It's 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 big one is matching encode and decode modes: hdr_mode and source_space must agree on both sides of the chain, or your round-trip comes back wrong-colored. The pack's own tooltip warns the Compress (Log) path specifically needs the matching decode settings. Second: mean sampling gives cleaner, more deterministic encodes but less variety - don't blame the node if mean outputs feel flatter; that's the tradeoff it's named for. And as with everything in this pack, garbage in, garbage out: encoding an 8-bit PNG with Compress (Log) won't conjure HDR highlight detail that isn't there. If you're feeding it HDR, feed it HDR.

For anyone doing img2img, inpainting, or HDR round-trips at scale, the tiling alone is worth the install - the stock node's OOM on 4K is the kind of error that ends a session.

CategoryFXTD Studios/Radiance/Generate

Inputs (10)

NameTypeDefaultDescription
pixelsIMAGE
vaeVAE
source_spaceCOMBOLinearInput color space. Auto-linearized before VAE encode.
tile_sizeoptCOMBOAutoTile size in pixels. Auto queries VRAM.
overlapoptINT12832–256Overlap between tiles in pixels. 128px optimal for cosine blending.
exposureoptFLOAT0.0-10–10Exposure adjustment in stops (linear space).
alpha_handlingoptCOMBOPreservePreserve alpha channel for roundtrip.
hdr_modeoptCOMBOSoft ClipHDR handling before VAE encode.
latent_samplingoptCOMBOsampleHow to sample from the VAE posterior distribution. 'mean' gives deterministic, lowest-noise results for img2img. 'sample' gives diverse outputs (default ComfyUI behaviour).
processing_modeoptCOMBOsequential'sequential' uses minimal VRAM (one tile at a time). 'batched' groups tiles for 2-4x faster encode on high-VRAM GPUs.

Outputs (5)

NameTypeDescription
samplesLATENTEncoded latent — wire to Sampler Pro or save node.
alphaIMAGEAlpha channel tensor — wire to Radiance VAE 4K Decode alpha input.
metadataSTRINGEncode metadata JSON — wire to Decode crop_padding for auto-crop.
latent_formatSTRINGLatent format string (e.g. 'flux_16ch') — wire to Sampler Pro latent_format input.
quality_reportSTRINGQuality metrics JSON: clipping %, NaN count, latent range, tile info.