Nodes/ComfyUI_Antonioilev_Lightpack/πŸ‘οΈπŸ’ΎπŸ“‚ 2D View Save Load
ComfyUI Node

πŸ‘οΈπŸ’ΎπŸ“‚ 2D View Save Load

Cache Them to Disk

By AntonioilevΒ·Created 2 days agoΒ·Updated a day agoΒ· 0
πŸ‘οΈπŸ’ΎπŸ“‚ 2D View Save Load
  • bc
  • nm
  • pos
  • bc_out
  • nm_out
  • pos_out
  • full_batch
  • IMAGE
  • MASK
β—„pathL:/AI_3d/outputβ–Ί
β—„filenameviewβ–Ί
β—„index_list1,2,3,4,5,6β–Ί
β—„modeβ–Ύβ–Ί
β—„save_toggletrueβ–Ί
β—„seed0β–Ί
β—„exr_exposure1.00β–Ί

What it's actually for

Texture-projection and PBR workflows run on view sets: six camera angles, each with base colour, normal, and position passes. Re-generating them every iteration is the single biggest time sink in a 3D texturing graph. This node caches them.

Point it at a folder, feed it bc/nm/pos batches, and it writes numbered PNGs - view_bc_1.png, view_nm_2.png, and so on. On a later run, with nothing connected, it loads them back from disk and hands them downstream. Same node does both jobs, and the mode tells it which one.

How it works

The mode selector is the whole API:

  • Auto (Load if empty) - saves if any of bc/nm/pos is connected, loads if none are. This is the one you leave it on: it means the first run writes the cache and every subsequent run reads it.
  • Save Only - always writes, incrementing through each image in the batch.
  • Load Only - reads {filename}_{bc|nm|pos}_*.png from the folder, filtered by index_list.
  • Preview - renders an atlas image into ComfyUI's temp directory instead of touching your output folder: one row per channel, one column per view.

The atlas generation is worth knowing about because it explains odd-looking previews. It stacks bc, nm and pos as rows, pads each into a uniform grid, and shows you all six views at once. That's the "did my projection land" check without opening twenty files.

There's a real HDR path here too. If filename ends in .exr, the node stops treating your data as 0-1 sRGB: it loads EXR through cv2 (with OPENCV_IO_ENABLE_OPENEXR set before import) or imageio, keeps the float values above 1.0, and writes real float EXR on save. Previewing an HDR image requires tone mapping, so it applies a percentile-based auto exposure (median mapped toward 0.18) times your exr_exposure, a soft Reinhard curve, and a gamma 2.2 pass - then saves a PNG next to nothing in particular, purely for display. Your float data on disk is untouched by that; the exposure multiplier is applied on save only if exr_exposure isn't 1.0.

One caveat about the .png branch: if filename ends in .png, the naming skips the channel suffix and uses the filename as given (with _N appended per batch item). The channel-suffix pattern only applies to the other branches, which is a subtle inconsistency that bites when you mix conventions mid-project.

The inputs that matter

  • path and filename - a raw filesystem folder and a base name. Note the default path, L:/AI_3d/output - that's the author's drive. Change it, or you'll spend ten minutes wondering where your files went.
  • index_list (default 1,2,3,4,5,6) - which view numbers to load back, comma or space separated. This is how you pull a subset of views rather than all of them.
  • mode - see above. Auto (Load if empty) is the right default and the right setting 95% of the time.
  • exr_exposure / seed / save_toggle - exr_exposure scales the HDR values on save and the preview exposure; save_toggle lets Preview also write files; seed exists to force re-execution.

Outputs: bc_out, nm_out, pos_out, full_batch, IMAGE and MASK. The first four are the passthrough channels; the duplicate IMAGE is the first available channel (pos preferred, then nm, then bc), and MASK is generated as all-ones for HDR/shape reasons rather than extracted from alpha. Don't wire MASK expecting a real alpha channel.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Antonioilev/ComfyUI_Antonioilev_Lightpack.git
# restart ComfyUI

Manager search: "Antonioilev Light Pack". No requirements.txt; import failures are caught by __init__.py and reported as a node count. The EXR half needs optional extras, and degrades quietly without them:

pip install opencv-python imageio imageio-ffmpeg

Where people get burned

  • The default path is not ComfyUI's output folder. This node writes wherever you tell it. A relative path lands relative to the ComfyUI working directory, which isn't always what you expect.
  • Ties to index_list mismatching your actual filenames are the top "loads nothing" cause. If you saved with a custom filename, the loader has to see that same base name.
  • Loading gives you 8-bit PNG data unless you're on the EXR path. If you need HDR position or normal passes for a projection, use .exr filenames end-to-end - mixing PNG out and EXR in doesn't work.
  • EXR writing can fail silently if neither cv2 nor imageio can write EXR. It prints [EXR] !!! FAILED to save and deletes the zero-byte file. Watch the console rather than the folder.
CategoryAntonioilev/Viewers

Inputs (10)

NameTypeDefaultDescription
pathSTRINGL:/AI_3d/outputβ€”
filenameSTRINGviewβ€”
index_listSTRING1,2,3,4,5,6β€”
modeCOMBO4 options: Auto (Load if empty), Save Only, Load Only, Preview
bcoptIMAGEβ€”
nmoptIMAGEβ€”
posoptIMAGEβ€”
save_toggleoptBOOLEANtrueβ€”
seedoptINT00–18446744073709550000β€”
exr_exposureoptFLOAT1.000.01–100β€”

Outputs (6)

NameTypeDescription
bc_outIMAGEβ€”
nm_outIMAGEβ€”
pos_outIMAGEβ€”
full_batchIMAGEβ€”
IMAGEIMAGEβ€”
MASKMASKβ€”