🎯 AI → Camera‑Accurate Log Simulator
From AI flat render to camera-accurate log — the node that fakes the camera
- image
- depth_map
- normal_map
- log_image
- metadata
LogReconstructionNode is the one for people who are trying to composite an AI render into real footage - or who want their generated image to arrive in a colorist's session looking like it came off a camera, not out of a diffusion model. The name is doing real work: it doesn't just flatten the image with a LUT. It walks through the actual steps a camera's pipeline performs - linearize, expose, encode - so the output is a genuine log image with the exposure baked the way a real shoot would have it.
That's a different job than the pack's ColorSpaceSim, which is about getting a log look. This one aims at accuracy: pick your source space and your target log curve, and it produces something that slots into a VFX pipeline with a plausible metadata story attached.
How it works
The pipeline is in the source and it's the right order of operations:
- Linearize your input from sRGB, Rec.709, or ACEScg (ACEScg is treated as already-linear) using the transfer functions in
log_transforms.py. - Auto exposure (if
auto_analyzeis on): it measures the mean luminance and applies a gain to push it toward 18% gray - the classic middle-gray target. - EI scaling: multiplies by
exposure_index / 800, so setting the EI to 1600 behaves like overexposing a stop. - Local gain from optional
depth_mapandnormal_map- nearer/darker areas get a boost scaled bylocal_gain_strength. This is the "AI" flourish in the name; it's a way to fake localized light response you'd never get from a single flat LUT. - Inverse tone map: a fake shoulder expansion (
pow(x, 2.0) * 1.2) that pushes the mids back up, the opposite of a display transform. - Log encode via one of four curves: Alexa LogC3, Canon Log2, Sony S-Log3, ProRes Log. These are the vendor curves approximated numerically - LogC3 with the real a/b/c/d/e/f constants, S-Log3 with its Cineon-style formula. Not OCIO-grade, but the right shape.
The output is clamped to 0–1 and returned as log_image, plus a metadata output (a METADATA dict) carrying the analysis - mean, std, auto gain, and which transform/EI you used.
The inputs that matter
log_transform- the target curve. LogC3 and S-Log3 are the ones people actually composite against.auto_analyze(on by default) andexposure_index(100–6400, default 800) control how the exposure lands - if you're matching a real shot, set the EI to whatever the footage was recorded at and turn auto_analyze off so it doesn't fight your reference.use_inverse_tonemap(on by default) - keep it on for a fuller curve; turn it off for a flatter, safer output.- The optional
depth_map/normal_mapare genuinely worth wiring up if you have them - they're what make the result look less like a flat grade and more like a captured scene.local_gain_strengthdefaults to 0.1, which is subtle; don't crank it.
The outputs and the export trap
log_image is an IMAGE you can preview, save, or feed into a grade. metadata is informational - it's a dict, and standard ComfyUI nodes don't really consume it, so treat it as "read it in the console."
There are also save_exr and save_dpx toggles with filename fields. This is the trap: EXR export requires the OpenEXR and Imath Python packages, and they are not in the pack's requirements.txt. The code quietly skips the export if they're missing - no error, just no file. DPX goes through imageio (which is a listed dependency) as 16-bit output. If you want the EXR path, pip install OpenEXR Imath yourself.
Install
Same as the rest of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/rndnanthu/ComfyUI-RndNanthu
pip install -r requirements.txt
Restart ComfyUI. Manager: search "ComfyUI-RndNanthu". Dependencies are torch, numpy, opencv-python, Pillow, matplotlib, imageio. License is CC BY-NC 4.0 - non-commercial only, which matters a lot if you were hoping to use this in paid VFX work.
Where people get burned
- Silent EXR failure. Save toggled on, no file, no error. Install OpenEXR manually or use the DPX path.
- Auto-analyze shifts things unexpectedly. The 18% auto-gain is aggressive on dark or bright images - it will normalize your generated image's average brightness toward mid-gray even when you didn't want that. Turn it off when matching a specific reference.
- Only the first frame of a batch is processed.
image[0]again - single frames only, or split your batch.
This is the most ambitious node in the pack, and the most specialized. If you're generating plates for compositing into log footage, it's worth the install on its own. Just don't expect a color-managed pipeline - it's a well-sequenced approximation, and the README's "camera-accurate" is a sales pitch, not a guarantee.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| input_space | COMBO | Rec709 | 3 options: sRGB, Rec709, ACEScg |
| log_transform | COMBO | Alexa_LogC3 | 4 options: Alexa_LogC3, Canon_Log2, Sony_SLog3, ProRes_Log |
| use_inverse_tonemap | BOOLEAN | true | — |
| exposure_index | FLOAT | 800.00100–6400 | — |
| auto_analyze | BOOLEAN | true | — |
| local_gain_strength | FLOAT | 0.100–1 | — |
| depth_mapopt | IMAGE | — | |
| normal_mapopt | IMAGE | — | |
| save_exropt | BOOLEAN | false | — |
| exr_filenameopt | STRING | output.exr | — |
| save_dpxopt | BOOLEAN | false | — |
| dpx_filenameopt | STRING | output.dpx | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| log_image | IMAGE | — |
| metadata | METADATA | — |