Skip to content

gregtee2/ComfyUI_LTXRelight

Repository files navigation

ComfyUI_LTXRelight

ComfyUI custom node for the LTX-Relight LoRA workflow.

Provides an interactive HDRI viewer + conditioning node that builds the 57-frame reference video the LoRA was trained on (frame 0 = rotated, log-encoded HDRI), with live in-graph preview and full white-balance controls.

Pairs with the existing LTXAddVideoICLoRAGuide node from ComfyUI-LTXVideo.


What's in this repo

File Purpose
nodes.py The LTXRelightLoadHDRI ComfyUI node — loads an HDRI, applies rotation / scale / exposure / WB / log-encode, returns the conditioning frame.
ltx_hdri_viewer_endpoints.py HTTP routes: /ltx_relight/preview (live JPEG preview) and /ltx_relight/sample_pixel (eyedropper). Registered against ComfyUI's PromptServer.
web/ltx_hdri_viewer.js Frontend extension: in-graph preview canvas, eyedropper, Reset buttons, drift polling.
__init__.py ComfyUI entry point — exposes NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS, and WEB_DIRECTORY.
requirements.txt Python deps (numpy, imageio, OpenImageIO bindings, etc.).
CHANGELOG.md Per-release notes.
sync_and_push.bat Author convenience: copies the live custom_node files into this repo, commits, and pushes.

Node: LTXRelightLoadHDRI

Inputs

Input Range / default Notes
hdri_path str Absolute path to a .exr / .hdr / .png panorama (equirect).
rotation_deg -180 … 180, 0 Yaw rotation of the equirect.
scale_percent 10 … 100, 50 Output downscale (structural — usually leave alone).
exposure_stops -10 … 10, 0 Multiplies linear values by 2^stops before WB.
wb_gain_r/g/b 0.1 … 10, 1.0 Per-channel multipliers — driven by the eyedropper.
wb_temperature 2000 … 15000 K, 6500 Image color-temperature target. Low = warm image, high = cool. 6500 K = D65 = no-op.
wb_tint -100 … 100, 0 Magenta (+) ↔ green (-) shift. ±30 % max on green.
log_gain structural, 4.0 Final log encode gain — matches LoRA training.

Apply order

rotate_equirect → resize → exposure (×2^stops)
                → WB ([r,g,b] × Kelvin/tint composed)
                → log_encode_hdr

Verified Kelvin math (with tint=0)

Kelvin (r, g, b) gain
2000 K (1.86, 1.00, 0.10) — warm
6500 K (1.00, 1.00, 1.00) — neutral
15000 K (0.88, 1.00, 1.26) — cool

Uses the Tanner Helland blackbody approximation for CCT → RGB, then computes gains as target / D65 and normalizes green to 1.0.


In-graph viewer

The node renders a live preview directly inside the ComfyUI graph:

  • Live JPEG preview updates as you scrub any of the adjustment widgets.
  • 🎯 Pick White (eyedropper) — click the button, then click any neutral pixel in the preview. Computes WB gains from a small averaged patch, with a luminance-preserving target and soft clamps at [0.25, 4.0] so near-black or blown samples don't blow up the gains.
  • Reset WB — clears only wb_gain_r/g/b to 1.0.
  • Reset All — clears exposure_stops, all WB gains, Kelvin, and tint back to defaults in one click.
  • Drift polling — if the widgets are changed externally (graph load, undo, another node), the viewer detects it and reloads the preview.

The eyedropper sample is taken on the server side via /ltx_relight/sample_pixel after applying current rotation, exposure, and WB, so what you click is exactly what you see.


Installation

Via ComfyUI Manager (when listed)

Search for ComfyUI_LTXRelight.

Manual

cd ComfyUI/custom_nodes
git clone https://github.com/gregtee2/ComfyUI_LTXRelight.git ltx_relight
cd ltx_relight
pip install -r requirements.txt

Restart ComfyUI. The node appears under loaders (or wherever NODE_CLASS_MAPPINGS places it) as LTX Relight — Load HDRI.


Companion repo

The training / dataset side of this project lives in gregtee2/LTX-Relight-LoRA (private). This repo only ships the ComfyUI inference-time helpers.


License

MIT (see LICENSE — to be added).

About

ComfyUI node for LTX Relight LoRA — HDRI viewer with eyedropper white balance, Kelvin/tint controls, and live preview

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors