AI-Powered Relighting for 3D Gaussian Splatting
LightForge 3DGS is a ComfyUI Custom Node that allows you to physically relight 3D Gaussian Splatting models using light parameters extracted from reference images or HDRI maps, powered by Google Gemini 3.
Project for Google DeepMind Hackathon.
- Physical Relighting: Modifies Spherical Harmonics (SH) coefficients of the 3DGS model to match the new lighting.
- Robust Normal Computation: Automatically computes normals if missing or invalid (using SciPy/PCA).
- Gemini 3 Integration: Analyze reference images to extract realistic lighting parameters.
- Drag & Drop: Load models easily from the ComfyUI input folder or absolute paths.
-
Navigate to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes/ -
Clone this repository:
git clone https://github.com/mromerocastro/ComfyUI-LightForge3DGS.git
-
Install Dependencies: Go to the
ComfyUI-LightForge3DGSfolder and install the requirements.cd ComfyUI-LightForge3DGS pip install -r requirements.txtNote: If you are using the ComfyUI Portable version, make sure to use the embedded python (e.g.,
..\..\python_embeded\python.exe -m pip install -r requirements.txt).
Loads a Gaussian Splatting PLY file.
- Input: Path to
.ply. - Output: GS_MODEL.
Returns text statistics about the model.
- Input: GS_MODEL.
- Output: String.
Segments the model into clusters.
- Input: GS_MODEL, n_clusters.
- Output: GS_MODEL (with labels).
Uses Gemini 3 Vision to analyze an image and estimate lighting.
- Input: Image (from Load Image or Generator), API Key.
- Output: LIGHT_PARAMS.
Applies the lighting parameters to the model. Behavior:
-
Automatic: Connect the
LIGHT_PARAMSoutput from Gemini Extractor to thelight_paramsinput. -
Manual: Use the sliders (Azimuth, Elevation, etc.).
-
Visuals: Check the Preview Widget (visual light) and the Debug Info output (text).
-
Input: GS_MODEL, LIGHT_PARAMS (optional), Manual Overrides.
-
Output: GS_MODEL (Relit), DEBUG_INFO (String).
Saves the modified model.
- Input: GS_MODEL.
- Output: File Path.
Included in this folder is an example JSON file:
workflow_ai_relight.json: (Create this yourself easily)Load 3DGS+Load Imagenodes ->Gemini Extractor->Relight 3DGS.
How to use:
- Open ComfyUI.
- Drag one of the
.jsonfiles onto the canvas. - Update the
Load3DGSnode with the path to your.plyfile. - (Optional) Add your Gemini API Key if using AI features.
- Queue Prompt!