ComfyUI Extension: ComfyUI-ReLight
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.
Transform your images with cinematic lighting effects in a single click! ReLight is a powerful ComfyUI node that adds professional-grade lighting capabilities including multiple light sources, rim lighting, and 3D lighting simulation.
Looking for a different extension?
Custom Nodes (0)
README
✨ ReLight Node for ComfyUI
Relight your images without re-generating them.
ReLight is a single, self-contained ComfyUI node that adds up to 3 positionable light sources to any image — colored additive light or precise color correction, with presets, directional gradients, rim lighting, and mask-aware 3D occlusion. It's fast and deterministic: pure image processing, no diffusion pass, no models to download.
Built on the ComfyUI v3 node schema.
🌟 Features
Powerful Lighting Control
- Multiple Light Sources - Place up to 3 independent light sources anywhere in your image
- Dynamic Lighting Modes:
- 🎨 Colored Lights - Add RGB light with controllable intensity
- 🔄 Color Correction - Apply precise adjustments to brightness, contrast, saturation, temperature, tint and gamma
- Flexible Mask Shapes:
- 🔵 Circular Falloff - Natural radial lighting with inner/outer radius control
- ↗️ Gradient - Directional lighting for effects like sunset rays or window light
Advanced 3D Lighting Simulation
- Subject Interaction (when used with mask input):
- 🔆 Front Lighting - Light illuminates the subject more strongly than background
- ✨ Rim Lighting - Creates dramatic edge highlighting with background glow
- 🌐 Standard Lighting - Traditional lighting without subject occlusion
Production-Ready Features
-
Ready-to-Use Presets for instant professional results:
- "Soft Window Light" - Natural diffused lighting
- "Dramatic Side Light" - Cinematic chiaroscuro effect
- "Warm Sunset Glow" - Golden hour atmosphere
- "Cool Blue Moonlight" - Mysterious night-time look
- "Studio Key Light" - Professional portrait lighting
- "Rim Light" - Striking edge highlights
- "Spotlight" - Focused dramatic lighting
- "Negative Light" - Creative darkening effects
-
Visual Debugging - See exactly where your lights are positioned and how they interact
-
Fine-Tuning Controls - Perfect your lighting with precision adjustments for blur, strength, and rim amplification
🔧 Installation
Using ComfyUI-Manager (Recommended)
- Open ComfyUI and navigate to the Manager
- Search for "ReLight" in the available custom nodes
- Click Install
- Restart ComfyUI
Manual Installation
# Navigate to your ComfyUI custom_nodes directory
cd path/to/ComfyUI/custom_nodes
# Clone this repository
git clone https://github.com/EnragedAntelope/comfyui-relight
# Install dependencies
pip install -r comfyui-relight/requirements.txt
# Restart ComfyUI
Dependencies
ReLight needs numpy, Pillow, and scipy (installed automatically from requirements.txt; torch is provided by ComfyUI itself).
ReLight works best with high-quality foreground masks. We recommend installing:
- ComfyUI Essentials - Provides enhanced mask generation and background removal tools
🚀 Quick Start Guide
- Add the ReLight 💡 node to your workflow (found under category "image/lighting")
- Connect your source image
- Connect a foreground mask (white = subject, black = background) — optional, but required for occlusion ("Behind Subject" / "In Front of Subject") and background compositing
- Select a preset like "Rim Light (Behind)" or design your own lighting
- Adjust settings to taste
- Preview your results in real-time
Sample Workflow
A ready-to-load workflow is included: example workflow.json
The repository includes a sample workflow file (example workflow.json) that demonstrates:
- Loading an image
- Removing the background using ComfyUI Essentials' RemBG nodes
- Applying the ReLight node with "Warm Sunset Glow" preset in "Behind Subject" mode
- Viewing the results through both standard preview and debug visualization
Simply load this workflow in ComfyUI to see ReLight in action!
📸 Examples
Dramatic Three-Point RGB Lighting
This example uses three colored lights to create a purposely over the top striking RGB lighting setup:
-
Main Settings:
- 3 light sources
- "Behind Subject" light direction
- 2.0 effect strength
-
Light 1 (Red):
- Position: far right (0.99, 0.15)
- RGB Color: (255, 0, 0)
- High intensity (2.0)
-
Light 2 (Green):
- Position: left side (0.2, 0.3)
- RGB Color: (0, 255, 0)
- Medium intensity (0.7)
-
Light 3 (Blue):
- Position: bottom center (0.3, 0.8)
- RGB Color: (0, 0, 255)
- Low intensity (0.2)
This setup creates vibrant color separation while maintaining the "Behind Subject" mode to emphasize the edges of the figure with dramatic rim lighting.
Other Lighting Ideas to Try
Here are some additional lighting scenarios that showcase ReLight's versatility:
Split Lighting Portrait
Create dramatic portrait lighting with a strong contrast between light and shadow:
- Single light source at position (0.05, 0.5)
- Large outer radius (0.8)
- High contrast (25)
- Reduced saturation (-15)
- "In Front of Subject" light direction
Sunset Silhouette
Create a beautiful sunset silhouette effect:
- Light positioned low and centered (0.5, 0.9)
- Warm colors (255, 180, 100) (enable "use colored lights")
- "Behind Subject" light direction
- High rim amplification (3.0)
- Moderate mask blur (60)
Atmospheric Fog Light
Simulate light breaking through fog or mist:
- Light positioned high (0.5, 0.1)
- Cool blue-white color (200, 220, 255) (enable "use colored lights")
- "In Front of Subject" light direction
- High mask blur (100)
- Gradient mode enabled
- Medium intensity (1.5)
Moonlight Through Window
Simulate soft moonlight streaming through a window:
- Light positioned at upper corner (0.8, 0.2)
- Cool blue color (120, 150, 255) (enable "use colored lights")
- Gradient mode enabled
- Low brightness (-10)
- High blue cast (Temperature -30)
💡 Pro Tips
- Layer Multiple Lights - Use several ReLight nodes in sequence for complex lighting setups
- Debug View - Enable
show_debug_infoto visualize light positions and better understand the effect - Mask Quality Matters - The better your foreground mask, the more realistic your lighting effects
- Combine with ControlNet - Use ReLight results as input for ControlNet for guided image generation
- Perfect Rim Lighting - For the best rim effects:
- Position light behind subject
- Use "Behind Subject" light direction
- Increase rim_amplification for stronger edges
- Keep mask_blur values low (20-40) for crisp edges
📝 Parameter Guide
Core Parameters
| Parameter | Description | |-----------|-------------| | image | Input image to apply lighting effects | | mask | Foreground mask (white=subject, black=background) | | preset | Select from pre-configured lighting setups | | num_light_sources | How many lights to use (1-3) | | use_colored_lights | Toggle between additive color and correction modes | | apply_3d_lighting | Enable simulated subject occlusion effects | | light_direction | How light interacts with subject ("No Occlusion", "In Front", "Behind") | | effect_strength | Master intensity control for all lighting effects | | mask_blur | Controls softness of light edges and transitions | | rim_amplification | Specifically enhances rim light intensity |
Light Positioning
| Parameter | Description | |-----------|-------------| | light_position_x/y | Normalized (0-1) coordinates of light center | | inner_circle_radius | Core area of strongest light effect | | outer_circle_radius | Maximum extent of light falloff |
For full parameter list, please refer to the detailed section below.
🔍 Troubleshooting
| Problem | Solution | |---------|----------| | No visible effect | Increase effect_strength or light_intensity | | Light too strong | Decrease effect_strength or specific intensity/brightness values | | Occlusion not working | Ensure apply_3d_lighting is True and mask is connected | | Black debug image | Check ComfyUI console for errors | | Node fails to load | Ensure scipy is installed | | Poor mask quality | Use RemBG from ComfyUI Essentials for better masks | | Preset not working as expected | Try toggling use_colored_lights or apply_3d_lighting | | Subject looks unlit / effect appears reversed | Your mask may be inverted — ReLight expects white=subject, black=background (invert it upstream with an InvertMask node) | | Debug image not showing correctly | Enable show_debug_info and check console logs |
📚 Detailed Parameters Reference
Core Inputs
- image: Input image to apply lighting effects
- mask (optional): Foreground mask (White=Subject, Black=Background). Required for occlusion modes and background compositing
Global Behavior
- preset: Pre-configured starting points
- num_light_sources: Use 1, 2, or 3 lights
- preserve_positioning: Keep manual light positions when changing presets
- show_debug_info: Output visualization showing base masks and light positions
Lighting Mode & Occlusion
- use_colored_lights: Use additive colored light instead of color correction
- use_gradient_mode: Use directional gradient masks instead of radial
- apply_3d_lighting: Simulate light occlusion by subject (requires mask)
- light_direction: How light interacts with subject
- remove_background: Composite result using mask
Global Modifiers
- effect_strength: Overall intensity multiplier for lighting
- mask_blur: Blur radius for light mask edges
- rim_amplification: Boost specifically for rim light component
Light Specific Settings (per light)
- Position: light_position_x/_y coordinates
- Shape: inner_circle_radius/outer_circle_radius
- Color (when using colored lights): light_color_r/_g/_b, light_intensity
- Corrections (when using color correction): Brightness, Contrast, Saturation, Temperature, Tint, Gamma
📜 License
MIT License - Feel free to use in personal and commercial projects
💪 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
🔄 Updates
-
v2.1.0 - Correctness & polish
- Fixed: outer-area color correction now actually applies. The
outer_*(brightness/contrast/saturation/temperature/tint/gamma) parameters were previously never used — standard-mode lighting now applies inner settings inside the inner radius and outer settings in the surrounding ring, as documented (this is what presets like "Soft Window Light" and "Spotlight" were designed around) - Colored lights in standard mode now have true radial falloff (full strength inside the inner radius, fading to zero at the outer radius) —
inner_circle_radiuspreviously had no effect maskinput is now optional (matching actual behavior); without a mask the node applies plain lighting and disables occlusion/compositing- Removed silent mask auto-inversion heuristic that could corrupt masks of large subjects; a console warning is logged instead if a mask looks inverted
- Fixed v3 schema output ids (schema now passes ComfyUI validation)
- Console spam removed — verbose diagnostics moved to debug-level logging
- Packaging: removed
torchfrom requirements (ComfyUI provides it)
- Fixed: outer-area color correction now actually applies. The
-
v2.0.0 - ComfyUI v3 Migration
- Fully migrated to ComfyUI v3 schema
- Updated to use new io.ComfyNode base class
- Converted INPUT_TYPES to define_schema with proper type objects
- All methods converted to classmethods for v3 compatibility
- Updated outputs to use proper display_name labels
- Modernized extension registration with ComfyExtension and comfy_entrypoint
-
v1.0 - Initial Release
- Added support for multiple light sources
- Implemented rim lighting and 3D lighting simulation
- Included 8 professional lighting presets
- Added debug visualization
- Improved mask handling and compatibility with ComfyUI Essentials
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.