The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Relight: place coloured lights on a photo, see them land, then blend in the generated light
Adarsh336af6fe6ef2
diff --git a/CREDITS.md b/CREDITS.mdindex ceeef5cf..bcd7cc46 100644--- a/CREDITS.md+++ b/CREDITS.md@@ -10,8 +10,9 @@ This file is generated by `node scripts/credits.mjs` from `src/lib/licences.ts`,Some licences ask the app that runs their model to say so.-- **MiniMax H3**: Fuobe Character swap, MiniMax H3, H3 Character Swap · Relay 2.0, H3 Person Removal · Relay 2.0, H3 Character Swap · studio segment, MiniMax H3 Text to Video + Audio (20 steps), MiniMax H3 Image to Video + Audio (20 steps), MiniMax H3 Start + End Frame to Video + Audio (20 steps), MiniMax H3 360-degree orbit of a still + Audio (Orbit LoRA, 28 steps)+- **MiniMax H3**: Fuobe Character swap, MiniMax H3, Open-H3 Regenerate, H3 Character Swap · Relay 2.0, H3 Person Removal · Relay 2.0, H3 Character Swap · studio segment, MiniMax H3 Text to Video + Audio (20 steps), MiniMax H3 Image to Video + Audio (20 steps), MiniMax H3 Start + End Frame to Video + Audio (20 steps), MiniMax H3 360-degree orbit of a still + Audio (Orbit LoRA, 28 steps)- **Built with Llama**: HiDream-I1 Dev+- **Keep the licence text and NVIDIA's notices when you share the weights**: RE-USE (clean up voice), Clean the dialogue of a soundtrack and keep its music and effects (DBS + NVIDIA RE-USE)- **Built with DINOv3**: Pixal3D, TRELLIS.2, TRELLIS.2 Multi-view, Qwen-Image 2.1 → TRELLIS.2, TripoSplat## Attributions@@ -20,10 +21,11 @@ Some licences ask the app that runs their model to say so.- [BS-RoFormer, copyright (c) 2023 Phil Wang](https://github.com/lucidrains/BS-RoFormer). MIT. For dialogue, music and effects separation.- [Music-Source-Separation-Training, copyright (c) 2024 Roman Solovyev (ZFTurbo)](https://github.com/ZFTurbo/Music-Source-Separation-Training). MIT. For dialogue, music and effects separation.- [TIGER / Look2Hear, copyright (c) 2026 Kai Li](https://github.com/JusperLee/TIGER). MIT. For dialogue, music and effects separation.+- [RE-USE speech enhancement model, copyright (c) 2026 NVIDIA Corporation](https://huggingface.co/nvidia/NVIDIA-NemotronLabs-RE-USE). OpenMDW-1.1. For clean up voice. Trained in part on WSJ (LDC) and an internal NVIDIA set (model card). The older nvidia/RE-USE repository is non-commercial (NSCLv1); Fuobe uses only the NemotronLabs repositories.## Open model licences-147 models, one row for each set of open weights Fuobe runs: 84 allow commercial use, 29 with conditions, 21 are non-commercial and 13 aren't available everywhere.+158 models, one row for each set of open weights Fuobe runs: 89 allow commercial use, 32 with conditions, 23 are non-commercial and 14 aren't available everywhere.| Model | By | Kind | Licence | Note || --- | --- | --- | --- | --- |@@ -47,9 +49,13 @@ Some licences ask the app that runs their model to say so.| Fuobe Angles | Fuobe Original | Image | [Apache-2.0 (Qwen-Image-Edit 2509, dx8152 Multiple-angles LoRA, Qwen-Image-Lightning)](https://spdx.org/licenses/Apache-2.0.html) | || Fuobe Speak | Fuobe Original | Video | [Apache-2.0 (InfiniteTalk, Wan 2.1, lightx2v; FusioniX: Apache-2.0 card; the LoRAs it merges carry their own licences)](https://spdx.org/licenses/Apache-2.0.html) | || Fuobe Speak · Motion | Fuobe Original | Video | [Apache-2.0 (Wan 2.2, umT5, lightx2v)](https://spdx.org/licenses/Apache-2.0.html) | |+| Fuobe Restore | Fuobe Original | Video | [LTX-2.x Community License (LTX-2.5 22B distilled, its video VAE, and Lightricks' Restore and Detail Refine IC-LoRAs, both gated on Hugging Face: free under US$10M annual revenue); Gemma 4 text encoder packaged by Lightricks; ComfyUI-LTXVideo nodes under the LTX-2 Community License (its LICENSE file)](https://huggingface.co/Lightricks/LTX-2.5) | Conditions apply || Ideogram 4 | Ideogram | Image | [Ideogram Non-Commercial Model Agreement: NON-COMMERCIAL (research and personal use; commercial use needs a paid Ideogram licence)](https://huggingface.co/ideogram-ai/ideogram-4-fp8/blob/main/LICENSE.md) | Non-commercial || Qwen-Image 2.1 | Alibaba Qwen | Image | [Qwen Research License Agreement (Qwen-Image 2.1): NON-COMMERCIAL, research and evaluation only](https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE); [Qwen Research License Agreement (Qwen-Image 2.1): NON-COMMERCIAL, research and evaluation only; AusBoss nodes MIT](https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE); [Qwen Research License Agreement (Qwen-Image 2.1): NON-COMMERCIAL, research and evaluation only; outpaint LoRA by AusBoss under the same licence; AusBoss nodes MIT](https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE) | Non-commercial || Qwen-Image 2.1 Turbo | Alibaba Qwen | Image | [Qwen Research License Agreement (Qwen-Image 2.1): NON-COMMERCIAL, research and evaluation only](https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE) | Non-commercial |+| Qwen-Image 2.1 Live | Alibaba Qwen | Image | [Qwen Research License Agreement (Qwen-Image 2.1 and the DMD2 2-step LoRA by linoyts, a derivative): NON-COMMERCIAL, research and evaluation only; Fuobe live nodes MIT](https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE) | Non-commercial |+| FLUX 3 Klein | Black Forest Labs | Image | [FLUX Kommunity License v1.0 (FLUX 3 Image Klein and Klein Base: non-commercial use, plus commercial outputs for Qualifying Users under US$5M gross annual revenue; other commercial use needs a BFL licence; not blanket permission for commercial fine-tuning or distribution); Qwen3-VL-4B-Instruct encoder and the FLUX 3 prompt upsampler (Qwen3.5 9B fine-tune) Apache-2.0; FLUX.2 VAE Apache-2.0](https://huggingface.co/black-forest-labs/flux-3-image-klein) | Conditions apply |+| FLUX 3 Klein Base | Black Forest Labs | Image | [FLUX Kommunity License v1.0 (FLUX 3 Image Klein and Klein Base: non-commercial use, plus commercial outputs for Qualifying Users under US$5M gross annual revenue; other commercial use needs a BFL licence; not blanket permission for commercial fine-tuning or distribution); Qwen3-VL-4B-Instruct encoder and the FLUX 3 prompt upsampler (Qwen3.5 9B fine-tune) Apache-2.0; FLUX.2 VAE Apache-2.0](https://huggingface.co/black-forest-labs/flux-3-image-klein) | Conditions apply || Krea 2 Realism | Krea | Image | [Krea 2 Community License (free under US$1M yearly revenue; enterprise terms above it); Krea2-realism-V2 LoRA MIT](https://huggingface.co/Comfy-Org/Krea-2) | Conditions apply || Krea 2 Turbo | Krea | Image | [Krea 2 Community License (free under US$1M yearly revenue; enterprise terms above it)](https://huggingface.co/Comfy-Org/Krea-2) | Conditions apply || MOSS-Image | OpenMOSS | Image | [Apache-2.0 (MOSS-Image SFT and Base, Qwen3.5-9B, FLUX.2 small decoder, byte-identical to BFL's Apache-2.0 FLUX.2-small-decoder; Fast: Spectrallic's MOSS-Image SFT 8-step DMD int8 file, Apache-2.0)](https://spdx.org/licenses/Apache-2.0.html) | |@@ -93,6 +99,7 @@ Some licences ask the app that runs their model to say so.| InfiniteTalk Long | MeiGen | Video | [Apache-2.0 (InfiniteTalk, Wan 2.1, lightx2v; FusioniX: Apache-2.0 card; the LoRAs it merges carry their own licences)](https://spdx.org/licenses/Apache-2.0.html) | || Wan 2.2 S2V | Alibaba Wan | Video | [Apache-2.0 (Wan 2.2, umT5, lightx2v)](https://spdx.org/licenses/Apache-2.0.html) | || SeedVR2 (video) | ByteDance Seed | Video | [SeedVR2 (Apache-2.0); VideoHelperSuite GPL-3.0 code](https://spdx.org/licenses/Apache-2.0.html) | |+| Open-H3 Regenerate | NVIDIA | Video | [MiniMax H3 Community License (the H3 FL2VA model, its video and audio VAEs, the packaged Qwen3-VL text encoder, NVIDIA's Open-H3-Regenerate-2K LoRA and the fast H3 VAE decoder, a distilled Model Derivative): territory EXCLUDES the US, the EU, the UK and South Korea; commercial use above US$20M yearly revenue needs MiniMax's written authorization; show "MiniMax H3" on the product's interface; Comfy's docs add that commercial use of locally made outputs needs a MiniMax licence · the LoRA's merged LightX2V Turbo v1.2 part Apache-2.0 (at 3ec17a3), its LMS Sharp part no stated licence · LBH latent upscaler weights Apache-2.0, its node code MIT · ComfyUI-Open-H3-Regenerate Apache-2.0 · Qwen3-VL-32B base Apache-2.0](https://huggingface.co/MiniMaxAI/MiniMax-H3/blob/42ed227ee7df40d41602854ae760620d6eb651fe/LICENSE) | Not available in the US, the EU, the UK and South Korea || ESRGAN video upscale | Open source | Video | [Real-ESRGAN weights (BSD-3-Clause); VideoHelperSuite GPL-3.0 code](https://spdx.org/licenses/BSD-3-Clause.html) | || RIFE interpolation | Open source | Video | [RIFE 4.26 and FILM weights from Comfy-Org/frame_interpolation (MIT / Apache-2.0); VideoHelperSuite (GPL-3.0 code) for Select Every Nth](https://spdx.org/licenses/Apache-2.0.html) | || MMAudio | hkchengrex | Video | [CC-BY-NC-4.0 (MMAudio weights: NON-COMMERCIAL)](https://spdx.org/licenses/CC-BY-NC-4.0.html) | Non-commercial |@@ -116,6 +123,8 @@ Some licences ask the app that runs their model to say so.| SAM 3.1 person mask · H3 Relay | Meta × Akatz Labs | Video | [SAM 3.1 under Meta's SAM License (commercial use allowed under its terms) · H3 Relay nodes GPL-3.0 (Sendy Software LLC and contributors)](https://huggingface.co/Comfy-Org/sam3.1) | Conditions apply || Qwen-Image-Edit Relight | Alibaba Qwen | Image | [Apache-2.0 (Qwen-Image-Edit-2509, Relight LoRA, Lightning LoRA)](https://spdx.org/licenses/Apache-2.0.html) | || Qwen-Image-Edit Relight (reference) | Alibaba Qwen | Image | [Apache-2.0 (Qwen-Image-Edit-2509, Light-Migration LoRA, Lightning LoRA)](https://spdx.org/licenses/Apache-2.0.html) | |+| Relight | Alibaba Qwen | Image | [Qwen Research License Agreement (Qwen-Image 2.1 and Viggle's turbo LoRA, a derivative): NON-COMMERCIAL, research and evaluation only; the viggle_turbo node file ships in the same model repo under the same terms](https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE) | Non-commercial |+| Relight scene read | Open source | Image | [Depth Anything 3 mono large: Apache-2.0 (model card) · BiRefNet: MIT](https://spdx.org/licenses/Apache-2.0.html) | || Qwen-Image-Edit Next Scene | Alibaba Qwen | Image | [Apache-2.0 (Qwen-Image-Edit-2509, Lightning LoRA); next-scene LoRA MIT (lovis93)](https://spdx.org/licenses/Apache-2.0.html) | || Chatterbox Multilingual | Resemble AI | Audio | [Chatterbox weights MIT (ResembleAI); pack repo has no LICENSE file](https://spdx.org/licenses/MIT.html) | || IndexTTS-2 | Bilibili | Audio | bilibili IndexTTS-2 Model Use License: commercial use allowed below 100M MAU / RMB 1B annual revenue; may not be used to improve other AI models. Pack code: no LICENSE file | Conditions apply |@@ -130,6 +139,7 @@ Some licences ask the app that runs their model to say so.| USO Style Reference | ByteDance | Image | [USO LoRA/projector Apache-2.0, but the FLUX.1 [dev] base is NON-COMMERCIAL (outputs may be used commercially per the BFL licence; running it as a paid service is not)](https://huggingface.co/black-forest-labs/FLUX.1-dev) | Non-commercial || Z-Image Turbo · Palette | Alibaba Tongyi | Image | [Apache-2.0 (Z-Image Turbo); ColorTransfer has no model](https://spdx.org/licenses/Apache-2.0.html) | || Wan 2.2 Fun VACE Restyle | Alibaba Wan | Video | [Apache-2.0 (Wan 2.2 Fun VACE, lightx2v, Depth Anything 3 mono-large)](https://spdx.org/licenses/Apache-2.0.html) | |+| Wan 2.2 Fun VACE Blockout | Alibaba Wan | Video | [Apache-2.0 (Wan 2.2 Fun VACE, lightx2v)](https://spdx.org/licenses/Apache-2.0.html) | || Z-Image Mixed Media | Alibaba Tongyi | Video | [Apache-2.0 (Z-Image Turbo, Z-Image-Turbo-Fun-Controlnet-Union)](https://spdx.org/licenses/Apache-2.0.html) | || Stable Audio 3 Small SFX | Stability AI | Audio | [Stability AI Community License (free below US$1M annual revenue)](https://stability.ai/community-license-agreement) | Conditions apply || Stable Audio Open 1.0 | Stability AI | Audio | [Stability AI Community License (free below US$1M annual revenue; enterprise licence above)](https://stability.ai/community-license-agreement) | Conditions apply |@@ -138,7 +148,9 @@ Some licences ask the app that runs their model to say so.| MMAudio (text to audio) | hkchengrex | Audio | [CC-BY-NC-4.0 (MMAudio weights: NON-COMMERCIAL)](https://spdx.org/licenses/CC-BY-NC-4.0.html) | Non-commercial || ThinkSound | FunAudioLLM | Audio | [Apache-2.0 (ThinkSound weights, FunAudioLLM); wrapper code has no LICENSE file](https://spdx.org/licenses/Apache-2.0.html) | || MelBand RoFormer + Qwen3-ASR | Open source | Audio | [MelBand RoFormer weights MIT (KimberleyJSN); Qwen3-ASR / ForcedAligner Apache-2.0; ComfyUI-QwenASR code GPL-3.0 (same as ComfyUI)](https://spdx.org/licenses/Apache-2.0.html) | |+| DBS + Qwen3-ASR | Open source | Audio | [DBS weights Apache-2.0 (trained on DnR v2, CC BY 4.0); Qwen3-ASR / ForcedAligner Apache-2.0; ComfyUI-QwenASR GPL-3.0; ComfyUI-DBS MIT](https://spdx.org/licenses/Apache-2.0.html) | || DBS (dialogue, music, effects) | Open source | Audio | [DBS weights Apache-2.0 (JusperLee; trained on DnR v2, CC BY 4.0); ComfyUI-DBS code MIT; bundled DBS code Apache-2.0 with MIT notices (BS-RoFormer, MSST, TIGER)](https://spdx.org/licenses/Apache-2.0.html) | |+| RE-USE (clean up voice) | NVIDIA | Audio | [RE-USE weights OpenMDW-1.1 (NVIDIA; 'ready for commercial use' on the card; the card's safety section points to the NVIDIA Open Model License for use-case limits); ComfyUI-RE-USE code MIT with adapted RE-USE code OpenMDW-1.1](https://huggingface.co/nvidia/NVIDIA-NemotronLabs-RE-USE/blob/31f82f2efad1095034492f236e8dac9239ba713b/LICENSE) | || Qwen3-ASR | Alibaba Qwen | Text | [Qwen3-ASR / ForcedAligner Apache-2.0; ComfyUI-QwenASR code GPL-3.0](https://spdx.org/licenses/Apache-2.0.html) | || Whisper captions | OpenAI × yuvraj108c | Video | [Whisper weights MIT (OpenAI); ComfyUI-Whisper code CC-BY-NC-SA-4.0 (NON-COMMERCIAL: the author asks to be contacted for commercial use)](https://spdx.org/licenses/CC-BY-NC-SA-4.0.html) | Non-commercial || Qwen3.5 4B translate | Alibaba Qwen | Text | [Apache-2.0 (Qwen3.5)](https://spdx.org/licenses/Apache-2.0.html) | |@@ -174,6 +186,7 @@ Some licences ask the app that runs their model to say so.| Frame Interpolation (RIFE 4.26, native) | Workflow library | Interpolate | [MIT (RIFE)](https://spdx.org/licenses/MIT.html) | || Frame Interpolation (RIFE VFI custom pack) | Workflow library | Interpolate | [MIT (RIFE)](https://spdx.org/licenses/MIT.html) | || LTX-2.3 22B distilled text to video + LoRAs | Workflow library | T2V | [LTX-2 Community License (LTX-2.3 22B: free under US$10M annual revenue); Gemma 3 text encoder (Gemma Terms of Use)](https://huggingface.co/Lightricks/LTX-2.3-fp8) | Conditions apply |+| Clean the dialogue of a soundtrack and keep its music and effects (DBS + NVIDIA RE-USE) | Workflow library | Enhance voice | [RE-USE weights OpenMDW-1.1 (NVIDIA; 'ready for commercial use' on the card; the card's safety section points to the NVIDIA Open Model License for use-case limits); ComfyUI-RE-USE code MIT with adapted RE-USE code OpenMDW-1.1; DBS weights Apache-2.0 (JusperLee; trained on DnR v2, CC BY 4.0); ComfyUI-DBS code MIT; vendored DBS code Apache-2.0 with MIT notices (BS-RoFormer, MSST, TIGER)](https://huggingface.co/nvidia/NVIDIA-NemotronLabs-RE-USE/blob/31f82f2efad1095034492f236e8dac9239ba713b/LICENSE) | |## Tools with no model weights@@ -202,14 +215,20 @@ The custom nodes Fuobe's workflows install, with their licences.| [ComfyUI-Whisper](https://github.com/yuvraj108c/ComfyUI-Whisper) | [CC BY-NC-SA 4.0](https://spdx.org/licenses/CC-BY-NC-SA-4.0.html) | Word-timed captions in one job; non-commercial code (the author asks to be contacted for commercial use). The Whisper weights are MIT || [ComfyUI-LatentSyncWrapper](https://github.com/ShmuelRonen/ComfyUI-LatentSyncWrapper) | Not recorded | The repository has no LICENSE file; the LatentSync 1.6 weights are CreativeML OpenRAIL++-M || [ComfyUI-ThinkSound_Wrapper](https://github.com/ShmuelRonen/ComfyUI-ThinkSound_Wrapper) | Not recorded | The repository has no LICENSE file; the ThinkSound weights are Apache-2.0 |+| [fuobe-live](https://github.com/workingprototype/Fuobe) | [MIT](https://spdx.org/licenses/MIT.html) | Fuobe's own live edit nodes (fuobe_live.py, shipped with Fuobe): a loader, a cached reference encode, a crop, a paste-back and a socket save. The Qwen-Image 2.1 weights and the DMD2 LoRA they run are non-commercial || [ausboss-nodes](https://github.com/ausboss/ComfyUI-AusBoss) | [MIT](https://spdx.org/licenses/MIT.html) | Crop For Inpaint, Stitch Inpaint and Crop + Rotate + Pad for Qwen-Image 2.1's inpaint and expand; MIT code. The Qwen-Image 2.1 weights they run are non-commercial || [h3_character_swap](https://github.com/akatz-labs/h3-character-swap-tool/tree/0670e4fdf95adf2262caa4b81afed2a9c4ae4b7b/worker_nodes/h3_character_swap) | [GPL-3.0](https://spdx.org/licenses/GPL-3.0-only.html) | MiniMax H3 character swap nodes (Akatz Labs); GPL-3.0 code, a modified NVIDIA INT8 kernel inside is Apache-2.0. The MiniMax H3 weights it runs leave out the US, the EU, the UK and South Korea || [h3-relay](https://github.com/akatz-ai/h3-relay/tree/e2a7665b6eb8ea37a88c0de2c9c6b69a8f7c9220) | [GPL-3.0](https://spdx.org/licenses/GPL-3.0-only.html) | H3 Relay 2.0 (Sendy Software LLC and contributors); GPL-3.0 code, vendored Context Loop and Spectrum GPL-3.0. Opt-in (H3_RELAY=1): it registers HTTP routes when it loads |+| [ComfyUI-LTXVideo](https://github.com/Lightricks/ComfyUI-LTXVideo/tree/220e1d45aa0469f518e982102fca4dca92a61862) | LTX-2 Community License | Lightricks' LTX nodes (IC-LoRA loader and guide, per-step tiled latent fusion); the repository's LICENSE is the LTX-2 Community License: free, commercial use included, below US$10M annual revenue || [ComfyUI-DBS](https://github.com/hiroki-abe-58/ComfyUI-DBS/tree/f656e53434b5485c148a2866fbd6ddc6b6152ed6) | [MIT](https://spdx.org/licenses/MIT.html) | Dialogue, music and effects separation; MIT code, bundled DBS code Apache-2.0 with MIT notices. The DBS weights are Apache-2.0, trained on DnR v2 (CC BY 4.0), some of whose clips carry their own licences || [comfyui-krea2edit](https://github.com/lbouaraba/comfyui-krea2edit) | [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) | Krea 2 Identity Edit's nodes (Krea 2 Edit and Identity Edit); Apache-2.0 code. The V2 edit LoRAs they run are non-commercial without a licence from their author || [ComfyUI-Krea2-Ostris-Edit](https://github.com/ostris/ComfyUI-Krea2-Ostris-Edit) | [MIT](https://spdx.org/licenses/MIT.html) | Ostris' Krea 2 edit nodes (Krea 2 Inpaint); MIT code. The inpaint LoRA it runs is under the Krea 2 Community License || [ComfyUI-MiniMax-H3-Turbo](https://github.com/Larryvrh/ComfyUI-MiniMax-H3-Turbo/tree/77bfa67575b14e3be6214f1747732e540c68b5dd) | [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) | larryvrh's turbo LoRA loader and sampler for MiniMax H3 (8 steps); Apache-2.0 code, and the turbo v4 LoRA is Apache-2.0. The MiniMax H3 weights it runs leave out the US, the EU, the UK and South Korea || [plaguekind-nodes](https://github.com/PlagueKind/ComfyUI-PlagueKind-Nodes/tree/d58d006a4ea32c25c06499f2ff104f0852a045a6) | [MIT](https://spdx.org/licenses/MIT.html) | PlagueKind's H3 SLA attention (needs Triton) and AdaLN LoRA fix for MiniMax H3; MIT code |+| [ComfyUI-Open-H3-Regenerate](https://github.com/rdh9616/ComfyUI-Open-H3-Regenerate/tree/9b686c5ffd380e9d1351f9b8beef6d20d703ca3e) | [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) | rdh9616's Open-H3 Regenerate nodes (NVIDIA's refine recipe, with NVIDIA's fast H3 VAE decoder vendored); Apache-2.0 code with a NOTICE file. The MiniMax H3 weights and the refiner LoRA it runs leave out the US, the EU, the UK and South Korea |+| [Comfyui_Minimax_h3_latent_Upscaler](https://github.com/LBH-123-AI/Comfyui_Minimax_h3_latent_Upscaler/tree/40316cf008b2fd8663263270669eb4da23f89d2c) | [MIT](https://spdx.org/licenses/MIT.html) | LBH-123-AI's H3 latent upscaler nodes (the Open-H3 Regenerate nodes call them by name); MIT code, copyright (c) 2026 LBH-123-AI. Its upscaler weights are Apache-2.0 |+| [ComfyUI-RE-USE](https://github.com/workingprototype/Fuobe/tree/8cc0417b5cb8a603f06502d97d5c6d8c6035ea0d/comfy-nodes/ComfyUI-RE-USE) | [MIT](https://spdx.org/licenses/MIT.html) | Fuobe's own pack. The network code is adapted from NVIDIA's RE-USE repository (OpenMDW-1.1, notices kept), and the Mamba layer is a plain-PyTorch rewrite (no mamba-ssm). It matches the reference maths numerically, but it is not NVIDIA's code path |+| [viggle_turbo](https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/tree/009a44a895ef85f7e643c80fdca9543795248867/comfyui) | [Qwen Research License](https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE) | Viggle's ComfyUI nodes for its Qwen-Image 2.1 turbo LoRA (the loader that reads the LoRA's strength from its metadata, and the 6-step schedule); they ship in the model repo, a Qwen-Image 2.1 derivative under the same research licence |## Elsewherediff --git a/scripts/comfy/build-library.mjs b/scripts/comfy/build-library.mjsindex 9f1dc924..bfd6f66a 100644--- a/scripts/comfy/build-library.mjs+++ b/scripts/comfy/build-library.mjs@@ -72,6 +72,8 @@ export const LOADER_FOLDERS = {LTXICLoRALoaderModelOnly: { lora_name: 'loras' },// MiniMax H3 video: larryvrh's turbo LoRA loader (ComfyUI-MiniMax-H3-Turbo) reads models/loras.MiniMaxH3TurboLoRA: { lora_name: 'loras' },+ // Relight: Viggle's speed-LoRA loader (viggle_turbo) reads models/loras.+ ViggleTurboLora: { lora_name: 'loras' },// Open-H3 Regenerate (rdh9616's pack): the merged refiner LoRA, LBH's latent upscaler and NVIDIA's fast H3 VAE decoder.OpenH3RegenLora: { lora_name: 'loras' },OpenH3RegenUpscale: { model_name: 'latent_upscale_models' },diff --git a/scripts/comfy/build-requirements.mjs b/scripts/comfy/build-requirements.mjsindex 4a2518e3..63550a23 100644--- a/scripts/comfy/build-requirements.mjs+++ b/scripts/comfy/build-requirements.mjs@@ -206,6 +206,8 @@ export function buildIndex({ manifest, graphs, subset, packs, pins, packClassesfolders: uniq(p.folders ?? []),isolated: !!p.isolated,...(p.subdir && { subdir: p.subdir }),+ // One node file in a model repo (viggle_turbo): downloaded, not cloned.+ ...(p.file && { file: p.file }),requirementsTxt: !!p.requirementsTxt,install: p.registry?.version ? 'registry' : 'manual',};diff --git a/scripts/comfy/hand-built/qwen-image-21-relight.json b/scripts/comfy/hand-built/qwen-image-21-relight.jsonnew file mode 100644index 00000000..3e556e44--- /dev/null+++ b/scripts/comfy/hand-built/qwen-image-21-relight.json@@ -0,0 +1,221 @@+{+ "1": {+ "class_type": "UNETLoader",+ "inputs": {+ "unet_name": "qwen_image_2.1_int8_convrot.safetensors",+ "weight_dtype": "default"+ },+ "_meta": {+ "title": "Load Diffusion Model"+ }+ },+ "2": {+ "class_type": "CLIPLoader",+ "inputs": {+ "clip_name": "qwen3vl_8b_int8_convrot.safetensors",+ "type": "qwen_image",+ "device": "default"+ },+ "_meta": {+ "title": "Load CLIP (Qwen3-VL 8B)"+ }+ },+ "3": {+ "class_type": "VAELoader",+ "inputs": {+ "vae_name": "qwen_image_2.1_vae_bf16.safetensors"+ },+ "_meta": {+ "title": "Load VAE"+ }+ },+ "4": {+ "class_type": "ViggleTurboLora",+ "inputs": {+ "model": [+ "1",+ 0+ ],+ "lora_name": "Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors",+ "strength": 1+ },+ "_meta": {+ "title": "Speed LoRA (Viggle 6-step, unmerged, reads alpha from metadata)"+ }+ },+ "10": {+ "class_type": "LoadImage",+ "inputs": {+ "image": "image_1.png"+ },+ "_meta": {+ "title": "Photo (image 1)"+ }+ },+ "11": {+ "class_type": "LoadImage",+ "inputs": {+ "image": "image_2.png"+ },+ "_meta": {+ "title": "Light guide (image 2, optional)"+ }+ },+ "30": {+ "class_type": "TextEncodeQwenImage21",+ "inputs": {+ "prompt": "",+ "negative_prompt": "",+ "resolution": 1024,+ "clip": [+ "2",+ 0+ ],+ "vae": [+ "3",+ 0+ ],+ "images.image_1": [+ "10",+ 0+ ],+ "images.image_2": [+ "11",+ 0+ ]+ },+ "_meta": {+ "title": "Text Encode Qwen Image 2.1 (~1 MP)"+ }+ },+ "31": {+ "class_type": "QwenImage21Cache",+ "inputs": {+ "device": "auto",+ "dtype": "default",+ "model": [+ "4",+ 0+ ]+ },+ "_meta": {+ "title": "Qwen Image 2.1 Cache"+ }+ },+ "32": {+ "class_type": "SamplerCustomAdvanced",+ "inputs": {+ "noise": [+ "70",+ 0+ ],+ "guider": [+ "71",+ 0+ ],+ "sampler": [+ "72",+ 0+ ],+ "sigmas": [+ "73",+ 0+ ],+ "latent_image": [+ "30",+ 2+ ]+ },+ "_meta": {+ "title": "Sampler"+ }+ },+ "33": {+ "class_type": "VAEDecode",+ "inputs": {+ "samples": [+ "32",+ 0+ ],+ "vae": [+ "3",+ 0+ ]+ },+ "_meta": {+ "title": "VAE Decode"+ }+ },+ "34": {+ "class_type": "SplitImageWithAlpha",+ "inputs": {+ "image": [+ "33",+ 0+ ]+ },+ "_meta": {+ "title": "Drop the alpha"+ }+ },+ "70": {+ "class_type": "RandomNoise",+ "inputs": {+ "noise_seed": 0+ },+ "_meta": {+ "title": "Seed"+ }+ },+ "71": {+ "class_type": "BasicGuider",+ "inputs": {+ "model": [+ "31",+ 0+ ],+ "conditioning": [+ "30",+ 0+ ]+ },+ "_meta": {+ "title": "Basic Guider (no CFG)"+ }+ },+ "72": {+ "class_type": "KSamplerSelect",+ "inputs": {+ "sampler_name": "euler"+ },+ "_meta": {+ "title": "euler"+ }+ },+ "73": {+ "class_type": "ViggleTurboSigmas",+ "inputs": {+ "latent": [+ "30",+ 2+ ],+ "nodes": "1.0, 0.9375, 0.875, 0.75, 0.5, 0.25"+ },+ "_meta": {+ "title": "Viggle 6-step sigmas"+ }+ },+ "90": {+ "class_type": "SaveImage",+ "inputs": {+ "filename_prefix": "fuobe/qwen-image-21-relight",+ "images": [+ "34",+ 0+ ]+ },+ "_meta": {+ "title": "Save relit"+ }+ }+}diff --git a/scripts/comfy/hand-built/relight-scene-read.json b/scripts/comfy/hand-built/relight-scene-read.jsonnew file mode 100644index 00000000..ce62a1a0--- /dev/null+++ b/scripts/comfy/hand-built/relight-scene-read.json@@ -0,0 +1,110 @@+{+ "1": {+ "class_type": "LoadImage",+ "inputs": {+ "image": "input.png"+ },+ "_meta": {+ "title": "Photo"+ }+ },+ "2": {+ "class_type": "LoadDA3Model",+ "inputs": {+ "model_name": "depth_anything_3_mono_large.safetensors",+ "weight_dtype": "default"+ },+ "_meta": {}+ },+ "3": {+ "class_type": "DA3Inference",+ "inputs": {+ "da3_model": [+ "2",+ 0+ ],+ "image": [+ "1",+ 0+ ],+ "resolution": 504,+ "resize_method": "lower_bound_resize",+ "mode": "mono"+ },+ "_meta": {}+ },+ "4": {+ "class_type": "DA3Render",+ "inputs": {+ "da3_geometry": [+ "3",+ 0+ ],+ "output": "depth",+ "output.normalization": "v2_style",+ "output.apply_sky_clip": false+ },+ "_meta": {+ "title": "Depth (near = bright)"+ }+ },+ "5": {+ "class_type": "SaveImage",+ "inputs": {+ "images": [+ "4",+ 0+ ],+ "filename_prefix": "fuobe/relight-scene-depth"+ },+ "_meta": {+ "title": "Save depth"+ }+ },+ "6": {+ "class_type": "LoadBackgroundRemovalModel",+ "inputs": {+ "bg_removal_name": "birefnet.safetensors"+ },+ "_meta": {}+ },+ "7": {+ "class_type": "RemoveBackground",+ "inputs": {+ "bg_removal_model": [+ "6",+ 0+ ],+ "image": [+ "1",+ 0+ ]+ },+ "_meta": {}+ },+ "8": {+ "class_type": "MaskToImage",+ "inputs": {+ "mask": [+ "7",+ 0+ ]+ },+ "_meta": {+ "title": "Matte"+ }+ },+ "9": {+ "class_type": "SaveImage",+ "inputs": {+ "images": [+ "8",+ 0+ ],+ "filename_prefix": "fuobe/relight-scene-matte"+ },+ "_meta": {+ "title": "Save matte"+ }+ }+}diff --git a/scripts/comfy/library.spec.mjs b/scripts/comfy/library.spec.mjsindex c587be88..d3c1b4ee 100644--- a/scripts/comfy/library.spec.mjs+++ b/scripts/comfy/library.spec.mjs@@ -190,6 +190,11 @@ export const CUSTOM_NODE_REPOS = {'ComfyUI-RE-USE': 'https://github.com/workingprototype/Fuobe/tree/8cc0417b5cb8a603f06502d97d5c6d8c6035ea0d/comfy-nodes/ComfyUI-RE-USE',// Live edit: Fuobe's own node file (src/lib/comfy-live-nodes.ts), shipped with Fuobe rather than cloned from a repo.'fuobe-live': 'https://github.com/workingprototype/Fuobe',+ // Relight (qwen-image-21-relight): Viggle's speed-LoRA loader and step schedule, one file in the model repo itself+ // (comfyui/viggle_turbo.py), at the revision checked against the installed copy (only a tooltip differs). The address+ // is the file: it is downloaded as custom_nodes/viggle_turbo/__init__.py, never cloned (the repo holds the weights).+ // Qwen Research License (a Qwen-Image 2.1 derivative). Not on the validation server: the entry lists it with `packs`.+ viggle_turbo: 'https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/009a44a895ef85f7e643c80fdca9543795248867/comfyui/viggle_turbo.py',};// Node classes of the packs entries list in `packs` (packs the validation server doesn't have installed): the build@@ -212,6 +217,7 @@ export const PACK_CLASSES = {'ComfyUI-RE-USE': /^REUSE(Loader|Enhance)$/,// Live edit's nodes (fuobe_live.py), which Fuobe writes into custom_nodes itself.'fuobe-live': /FuobeLive$/,+ viggle_turbo: /^ViggleTurbo(Lora|Sigmas)$/,};// Model download locations for files that the source workflow does not annotate@@ -222,6 +228,10 @@ export const KNOWN_MODELS = {// Live edit: linoyts' 2-step DMD2 LoRA for Qwen-Image 2.1 (pytorch_lora_weights.safetensors upstream, kept under a// name of its own), pinned at the revision whose file was measured.'Qwen-Image-2.1-DMD2-2steps.safetensors': { folder: 'loras', url: 'https://huggingface.co/linoyts/Qwen-Image-2.1-DMD2-2steps/resolve/5bae28369ecea3232405c17a53c04d35d15796b8/pytorch_lora_weights.safetensors' },+ // Relight: Viggle's 6-step speed LoRA for Qwen-Image 2.1 (v0.2.1, rank 256, alpha 256; the r128 cut for smaller GPUs),+ // pinned at the revision whose files were hash-checked on the GPU box (r256 2a0148f5…, r128 bafb91d0…).+ 'Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors': { folder: 'loras', url: 'https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/009a44a895ef85f7e643c80fdca9543795248867/Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors' },+ 'Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r128.safetensors': { folder: 'loras', url: 'https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/009a44a895ef85f7e643c80fdca9543795248867/Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r128.safetensors' },'ltx-2.3-22b-distilled-fp8.safetensors': { folder: 'checkpoints', url: 'https://huggingface.co/Lightricks/LTX-2.3-fp8/resolve/main/ltx-2.3-22b-distilled-fp8.safetensors' },'gemma_3_12B_it_fp4_mixed.safetensors': { folder: 'text_encoders', url: 'https://huggingface.co/Comfy-Org/ltx-2/resolve/main/split_files/text_encoders/gemma_3_12B_it_fp4_mixed.safetensors' },'RealESRGAN_x4plus.safetensors': { folder: 'upscale_models', url: 'https://huggingface.co/Comfy-Org/Real-ESRGAN_repackaged/resolve/main/RealESRGAN_x4plus.safetensors' },@@ -2597,6 +2607,49 @@ export const SPEC = ['No steps binding: the sigmas are the schedule. Removed: the prompt enhancer branch (Qwen3.5 9B PE model, off in the workflow), the custom-size switch, compare and notes. ' +'In a blind test it matched 25 steps (21 vs 22 of 48 outfit edits) and was weaker only on hard camera turns and product rotations (use qwen-image-21-edit there).',},+ // ---- Relight with placed lights (the Relight app's own tool, src/components/relight): Generate lighting and the scene read.+ {+ id: 'qwen-image-21-relight',+ title: 'Relight with placed lights: Qwen-Image 2.1 + Viggle 6-step speed LoRA, the photo plus words written from the lights (viggle_turbo)',+ capability: 'edit',+ handBuilt: 'hand-built/qwen-image-21-relight.json',+ packs: ['viggle_turbo'],+ bindings: {+ prompt: [b('30', 'prompt')], image: [b('10', 'image')], image2: [b('11', 'image')], seed: [b('70', 'noise_seed')],+ },+ outputs: [{ node: '90', kind: 'image' }],+ limits: { maxWidth: 2048, maxHeight: 2048 },+ vramGb: 24,+ license:+ 'Qwen Research License Agreement (Qwen-Image 2.1 and Viggle\'s turbo LoRA, a derivative): NON-COMMERCIAL, research and evaluation only; ' ++ 'the viggle_turbo node file ships in the same model repo under the same terms',+ notes:+ 'Built from Viggle\'s ComfyUI edit workflow (Viggle/Qwen-Image-2.1-viggle-turbo, comfyui/) with one reference: the int8 Qwen-Image 2.1 model, ' ++ 'the v0.2.1 6-step LoRA (r256) on ViggleTurboLora at 1.0 (applied unmerged; it reads lora_alpha / r from the file\'s metadata), QwenImage21Cache auto, ' ++ 'TextEncodeQwenImage21 at resolution 1024 (about 1 MP, sides on the 32 grid), positive only, BasicGuider (no CFG), euler, ' ++ 'ViggleTurboSigmas "1.0, 0.9375, 0.875, 0.75, 0.5, 0.25" (the raw nodes, shifted for the latent\'s size), RandomNoise, SamplerCustomAdvanced, VAEDecode. ' ++ 'The words come from the placed lights ("Relight the photo with a strong sunset orange light coming from the left, at face height, far away. The scene is in ' ++ 'darkness, lit only by these lights …"), so the result is lit only by them and the page blends it with the original (Intensity). Image 2 is an optional ' ++ 'light-guide picture (the rig drawn over the darkened photo), dropped when not given. The seed comes from the photo, so moving one light changes only that light. ' ++ 'A Pruna 8-step v0.1 LoRA in its place must also load through ViggleTurboLora at 1.0: its x2 strength is only in the metadata, so LoraLoaderModelOnly at 1.0 gives half.',+ },+ {+ id: 'relight-scene-read',+ title: 'Relight scene read: depth (Depth Anything 3 mono large) and the subject\'s matte (BiRefNet) of one photo (core)',+ capability: 'bg-remove',+ handBuilt: 'hand-built/relight-scene-read.json',+ bindings: { image: [b('1', 'image')] },+ outputs: [+ { node: '5', kind: 'image', role: 'depth' },+ { node: '9', kind: 'image', role: 'matte' },+ ],+ vramGb: 6,+ license: 'Depth Anything 3 mono large: Apache-2.0 (model card) · BiRefNet: MIT',+ notes:+ 'One photo in, two grey PNGs out, for the Relight page\'s depth-true preview: DA3Inference (mono, 504, lower-bound resize) and DA3Render depth with ' ++ 'v2_style normalisation (near = bright), and the core background-removal nodes (birefnet.safetensors) with the mask saved as a picture (white = subject). ' ++ 'Runs once per photo; its runs are helper steps the Library leaves out.',+ },{id: 'qwen-image-21-live-edit',title: 'Qwen-Image 2.1 Live Edit (2-step DMD2 LoRA, as you type)',diff --git a/scripts/eval/README.md b/scripts/eval/README.mdindex 6f520e1b..0f505fc2 100644--- a/scripts/eval/README.md+++ b/scripts/eval/README.md@@ -127,6 +127,7 @@ One JSON file per Original in `cases/`. Later Original packages add their own fi| `popcorn` | Storyboards in Fuobe Soul's looks (O13) | 4 four-frame boards (through `/api/storyboards`): 3 looks and the same board without one | `original` | clip, continuity, aesthetic || `cinema` | Fuobe Cinema (O6) | 3 Director scenes (the prompt Cinema compiles), 4 camera moves as LTX-2.3's `camera_lora` (cloud), 2 films of 3 shots | `original`, `words` (no camera LoRA), `expansion` (fal's prompt expansion on), `wan` (Wan 2.2 A14B hosted), `partner` (Seedance 2.5); all but `original` cloud only | clip, temporal, continuity || `marketing` | Fuobe Marketing Image, Fuobe Try-On, the AI Influencer sheet and Instadump (O10) | 7: a Standalone product shot (the product-shot graph on your GPU; hosted Qwen-Image-Edit in the cloud), an ad's picture, a poster without a product, a try-on, the builder's sheet (through `/api/influencer`), an Instadump photo from a selfie | `original`, `partner` (cloud: GPT Image 2.5, Nano Banana Pro, Ideogram 3.0, FASHN) | clip, aesthetic, style (the product), identity (try-on, Instadump) |+| `relight` | Relight with placed lights | 12 portraits of your own (`local/relight/<id>.png`: 8 editorial portraits and 4 more) × the four named looks, Neon night with its softness said once, and one white and one teal light at each of the 9 side × height spots | `viggle` (Generate lighting as the tool runs it), `turbo-today` (Qwen-Image 2.1 Turbo, the same words), `light-migration` (Qwen-Image-Edit 2509 Relight) | identity, clip, aesthetic || `turnaround` | Turnaround video (N7-6) | 4 through `/api/turnaround`: four views, the front and the back (sides drawn by the Angles app), the front alone, a sheet alone (a front drawn from it) | `default` (Frames on your GPU, H3 Max references in the cloud), `keyframes` (cloud: FLUX 3 Max), `camera` (cloud: H3 Max camera controls) | identity of 8 sampled frames against the views, temporal, clip |`soul.json`, `soul-cinema.json`, `soul-hex.json`, `dop.json`, `dop-mix.json` and `dop-mixed-media.json` are **generated** from the research. They come fromdiff --git a/scripts/eval/cases/relight.json b/scripts/eval/cases/relight.jsonnew file mode 100644index 00000000..d004798e--- /dev/null+++ b/scripts/eval/cases/relight.json@@ -0,0 +1,1382 @@+{+ "$schema": "./case.schema.json",+ "suite": "relight",+ "title": "Relight · placed lights on a portrait",+ "description": "The Relight tool's Generate lighting (Qwen-Image 2.1 + Viggle's 6-step speed LoRA, words written from the placed lights by src/lib/relight/lights.ts) on 12 portraits you supply in local/relight/<id>.png: 8 editorial portraits and 4 more. Each case runs the four named looks, Neon night with its softness said once, and one white and one teal light at each of the 9 side x height spots (the 'lands where placed' check). Measures identity against the photo (the acceptance bar is 0.85 on every portrait at 100 %, median 0.90), CLIP and aesthetic. Today's Relight engine (Qwen-Image 2.1 Turbo, 8 steps) and the older Light-Migration path run the same words for comparison. The guide-picture, Pruna 8-step and r128 arms change the graph itself, so they run as graphs of their own and are recorded next to this suite. Light placement, stray colour cast, background edges and the alignment residual are measured from the aligned results with the tool's own maths (src/lib/relight/align.ts, blend.ts).",+ "original": "oss-qwen-image-21-relight",+ "kind": "image",+ "decides": "The default engine variant, whether the light-guide picture is sent, the blend mode and the look tuning (RELIGHT_SETTINGS in src/lib/relight/engine.ts).",+ "targets": {+ "open": {+ "models": [+ "oss-qwen-image-21-relight"+ ]+ },+ "demo": {+ "models": [+ "oss-qwen-image-21-relight"+ ]+ }+ },+ "defaults": {+ "seeds": [+ 1001+ ],+ "metrics": [+ "identity",+ "clip",+ "aesthetic"+ ],+ "timeoutSeconds": 1800,+ "candidate": "viggle"+ },+ "variants": {+ "viggle": {+ "description": "Generate lighting as the tool runs it: Viggle 6-step r256, the photo and the words only"+ },+ "turbo-today": {+ "description": "Today's Relight recipe engine: Qwen-Image 2.1 Turbo (8 steps), the same words",+ "engines": [+ "open"+ ],+ "models": {+ "open": [+ "oss-qwen-image-21-turbo"+ ]+ }+ },+ "light-migration": {+ "description": "The older path: Qwen-Image-Edit 2509 + Relight LoRA, the same words",+ "engines": [+ "open"+ ],+ "models": {+ "open": [+ "oss-qwen-relight"+ ]+ }+ }+ },+ "cases": [+ {+ "id": "relight/studio",+ "title": "Studio portrait, soft even light",+ "op": "edit",+ "inputs": {+ "images": [+ "local/relight/studio.png"+ ]+ },+ "demoInputs": {+ "images": [+ "fixtures/start-frame.png"+ ]+ },+ "references": "local/relight/studio.png",+ "prompts": [+ {+ "id": "golden-hour",+ "text": "Relight the photo with a strong soft sunset orange light coming from the left, at face height, far away; and a gentle broad, diffused warm white light coming from the right, at face height, far away. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "studio-rim",+ "text": "Relight the photo with a soft clean white light coming from the left, high above, at a medium distance; a strong hard, crisp cool moonlight blue light behind the subject, rimming the right edge of the silhouette, high above, close to the subject; and a hard, crisp cool moonlight blue light behind the subject, rimming the left edge of the silhouette, high above, close to the subject. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "candlelight",+ "text": "Relight the photo with a strong warm amber light coming from the front, below, close to the subject. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night-shared",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-low",+ "text": "Relight the photo with a strong clean white light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-face",+ "text": "Relight the photo with a strong clean white light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-high",+ "text": "Relight the photo with a strong clean white light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-low",+ "text": "Relight the photo with a strong clean white light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-face",+ "text": "Relight the photo with a strong clean white light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-high",+ "text": "Relight the photo with a strong clean white light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-low",+ "text": "Relight the photo with a strong clean white light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-face",+ "text": "Relight the photo with a strong clean white light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-high",+ "text": "Relight the photo with a strong clean white light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-low",+ "text": "Relight the photo with a strong teal light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-face",+ "text": "Relight the photo with a strong teal light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-high",+ "text": "Relight the photo with a strong teal light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-low",+ "text": "Relight the photo with a strong teal light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-face",+ "text": "Relight the photo with a strong teal light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-high",+ "text": "Relight the photo with a strong teal light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-low",+ "text": "Relight the photo with a strong teal light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-face",+ "text": "Relight the photo with a strong teal light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-high",+ "text": "Relight the photo with a strong teal light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ }+ ]+ },+ {+ "id": "relight/street-dusk",+ "title": "Street at dusk",+ "op": "edit",+ "inputs": {+ "images": [+ "local/relight/street-dusk.png"+ ]+ },+ "demoInputs": {+ "images": [+ "fixtures/start-frame.png"+ ]+ },+ "references": "local/relight/street-dusk.png",+ "prompts": [+ {+ "id": "golden-hour",+ "text": "Relight the photo with a strong soft sunset orange light coming from the left, at face height, far away; and a gentle broad, diffused warm white light coming from the right, at face height, far away. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "studio-rim",+ "text": "Relight the photo with a soft clean white light coming from the left, high above, at a medium distance; a strong hard, crisp cool moonlight blue light behind the subject, rimming the right edge of the silhouette, high above, close to the subject; and a hard, crisp cool moonlight blue light behind the subject, rimming the left edge of the silhouette, high above, close to the subject. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "candlelight",+ "text": "Relight the photo with a strong warm amber light coming from the front, below, close to the subject. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night-shared",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-low",+ "text": "Relight the photo with a strong clean white light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-face",+ "text": "Relight the photo with a strong clean white light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-high",+ "text": "Relight the photo with a strong clean white light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-low",+ "text": "Relight the photo with a strong clean white light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-face",+ "text": "Relight the photo with a strong clean white light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-high",+ "text": "Relight the photo with a strong clean white light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-low",+ "text": "Relight the photo with a strong clean white light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-face",+ "text": "Relight the photo with a strong clean white light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-high",+ "text": "Relight the photo with a strong clean white light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-low",+ "text": "Relight the photo with a strong teal light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-face",+ "text": "Relight the photo with a strong teal light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-high",+ "text": "Relight the photo with a strong teal light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-low",+ "text": "Relight the photo with a strong teal light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-face",+ "text": "Relight the photo with a strong teal light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-high",+ "text": "Relight the photo with a strong teal light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-low",+ "text": "Relight the photo with a strong teal light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-face",+ "text": "Relight the photo with a strong teal light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-high",+ "text": "Relight the photo with a strong teal light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ }+ ]+ },+ {+ "id": "relight/interior",+ "title": "Interior, window light",+ "op": "edit",+ "inputs": {+ "images": [+ "local/relight/interior.png"+ ]+ },+ "demoInputs": {+ "images": [+ "fixtures/start-frame.png"+ ]+ },+ "references": "local/relight/interior.png",+ "prompts": [+ {+ "id": "golden-hour",+ "text": "Relight the photo with a strong soft sunset orange light coming from the left, at face height, far away; and a gentle broad, diffused warm white light coming from the right, at face height, far away. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "studio-rim",+ "text": "Relight the photo with a soft clean white light coming from the left, high above, at a medium distance; a strong hard, crisp cool moonlight blue light behind the subject, rimming the right edge of the silhouette, high above, close to the subject; and a hard, crisp cool moonlight blue light behind the subject, rimming the left edge of the silhouette, high above, close to the subject. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "candlelight",+ "text": "Relight the photo with a strong warm amber light coming from the front, below, close to the subject. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night-shared",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-low",+ "text": "Relight the photo with a strong clean white light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-face",+ "text": "Relight the photo with a strong clean white light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-high",+ "text": "Relight the photo with a strong clean white light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-low",+ "text": "Relight the photo with a strong clean white light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-face",+ "text": "Relight the photo with a strong clean white light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-high",+ "text": "Relight the photo with a strong clean white light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-low",+ "text": "Relight the photo with a strong clean white light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-face",+ "text": "Relight the photo with a strong clean white light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-high",+ "text": "Relight the photo with a strong clean white light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-low",+ "text": "Relight the photo with a strong teal light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-face",+ "text": "Relight the photo with a strong teal light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-high",+ "text": "Relight the photo with a strong teal light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-low",+ "text": "Relight the photo with a strong teal light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-face",+ "text": "Relight the photo with a strong teal light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-high",+ "text": "Relight the photo with a strong teal light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-low",+ "text": "Relight the photo with a strong teal light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-face",+ "text": "Relight the photo with a strong teal light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-high",+ "text": "Relight the photo with a strong teal light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ }+ ]+ },+ {+ "id": "relight/beach",+ "title": "Beach, bright overcast",+ "op": "edit",+ "inputs": {+ "images": [+ "local/relight/beach.png"+ ]+ },+ "demoInputs": {+ "images": [+ "fixtures/start-frame.png"+ ]+ },+ "references": "local/relight/beach.png",+ "prompts": [+ {+ "id": "golden-hour",+ "text": "Relight the photo with a strong soft sunset orange light coming from the left, at face height, far away; and a gentle broad, diffused warm white light coming from the right, at face height, far away. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "studio-rim",+ "text": "Relight the photo with a soft clean white light coming from the left, high above, at a medium distance; a strong hard, crisp cool moonlight blue light behind the subject, rimming the right edge of the silhouette, high above, close to the subject; and a hard, crisp cool moonlight blue light behind the subject, rimming the left edge of the silhouette, high above, close to the subject. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "candlelight",+ "text": "Relight the photo with a strong warm amber light coming from the front, below, close to the subject. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night-shared",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-low",+ "text": "Relight the photo with a strong clean white light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-face",+ "text": "Relight the photo with a strong clean white light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-high",+ "text": "Relight the photo with a strong clean white light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-low",+ "text": "Relight the photo with a strong clean white light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-face",+ "text": "Relight the photo with a strong clean white light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-high",+ "text": "Relight the photo with a strong clean white light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-low",+ "text": "Relight the photo with a strong clean white light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-face",+ "text": "Relight the photo with a strong clean white light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-high",+ "text": "Relight the photo with a strong clean white light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-low",+ "text": "Relight the photo with a strong teal light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-face",+ "text": "Relight the photo with a strong teal light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-high",+ "text": "Relight the photo with a strong teal light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-low",+ "text": "Relight the photo with a strong teal light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-face",+ "text": "Relight the photo with a strong teal light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-high",+ "text": "Relight the photo with a strong teal light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-low",+ "text": "Relight the photo with a strong teal light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-face",+ "text": "Relight the photo with a strong teal light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-high",+ "text": "Relight the photo with a strong teal light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ }+ ]+ },+ {+ "id": "relight/full-body",+ "title": "Full-body fashion shot",+ "op": "edit",+ "inputs": {+ "images": [+ "local/relight/full-body.png"+ ]+ },+ "demoInputs": {+ "images": [+ "fixtures/start-frame.png"+ ]+ },+ "references": "local/relight/full-body.png",+ "prompts": [+ {+ "id": "golden-hour",+ "text": "Relight the photo with a strong soft sunset orange light coming from the left, at face height, far away; and a gentle broad, diffused warm white light coming from the right, at face height, far away. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "studio-rim",+ "text": "Relight the photo with a soft clean white light coming from the left, high above, at a medium distance; a strong hard, crisp cool moonlight blue light behind the subject, rimming the right edge of the silhouette, high above, close to the subject; and a hard, crisp cool moonlight blue light behind the subject, rimming the left edge of the silhouette, high above, close to the subject. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "candlelight",+ "text": "Relight the photo with a strong warm amber light coming from the front, below, close to the subject. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night-shared",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-low",+ "text": "Relight the photo with a strong clean white light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-face",+ "text": "Relight the photo with a strong clean white light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-high",+ "text": "Relight the photo with a strong clean white light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-low",+ "text": "Relight the photo with a strong clean white light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-face",+ "text": "Relight the photo with a strong clean white light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-high",+ "text": "Relight the photo with a strong clean white light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-low",+ "text": "Relight the photo with a strong clean white light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-face",+ "text": "Relight the photo with a strong clean white light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-high",+ "text": "Relight the photo with a strong clean white light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-low",+ "text": "Relight the photo with a strong teal light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-face",+ "text": "Relight the photo with a strong teal light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-high",+ "text": "Relight the photo with a strong teal light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-low",+ "text": "Relight the photo with a strong teal light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-face",+ "text": "Relight the photo with a strong teal light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-high",+ "text": "Relight the photo with a strong teal light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-low",+ "text": "Relight the photo with a strong teal light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-face",+ "text": "Relight the photo with a strong teal light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-high",+ "text": "Relight the photo with a strong teal light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ }+ ]+ },+ {+ "id": "relight/close-up",+ "title": "Beauty close-up",+ "op": "edit",+ "inputs": {+ "images": [+ "local/relight/close-up.png"+ ]+ },+ "demoInputs": {+ "images": [+ "fixtures/start-frame.png"+ ]+ },+ "references": "local/relight/close-up.png",+ "prompts": [+ {+ "id": "golden-hour",+ "text": "Relight the photo with a strong soft sunset orange light coming from the left, at face height, far away; and a gentle broad, diffused warm white light coming from the right, at face height, far away. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "studio-rim",+ "text": "Relight the photo with a soft clean white light coming from the left, high above, at a medium distance; a strong hard, crisp cool moonlight blue light behind the subject, rimming the right edge of the silhouette, high above, close to the subject; and a hard, crisp cool moonlight blue light behind the subject, rimming the left edge of the silhouette, high above, close to the subject. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "candlelight",+ "text": "Relight the photo with a strong warm amber light coming from the front, below, close to the subject. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night-shared",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-low",+ "text": "Relight the photo with a strong clean white light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-face",+ "text": "Relight the photo with a strong clean white light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-high",+ "text": "Relight the photo with a strong clean white light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-low",+ "text": "Relight the photo with a strong clean white light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-face",+ "text": "Relight the photo with a strong clean white light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-high",+ "text": "Relight the photo with a strong clean white light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-low",+ "text": "Relight the photo with a strong clean white light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-face",+ "text": "Relight the photo with a strong clean white light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-high",+ "text": "Relight the photo with a strong clean white light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-low",+ "text": "Relight the photo with a strong teal light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-face",+ "text": "Relight the photo with a strong teal light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-high",+ "text": "Relight the photo with a strong teal light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-low",+ "text": "Relight the photo with a strong teal light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-face",+ "text": "Relight the photo with a strong teal light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-high",+ "text": "Relight the photo with a strong teal light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-low",+ "text": "Relight the photo with a strong teal light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-face",+ "text": "Relight the photo with a strong teal light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-high",+ "text": "Relight the photo with a strong teal light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ }+ ]+ },+ {+ "id": "relight/editorial-dark",+ "title": "Editorial portrait, deeper skin tone",+ "op": "edit",+ "inputs": {+ "images": [+ "local/relight/editorial-dark.png"+ ]+ },+ "demoInputs": {+ "images": [+ "fixtures/start-frame.png"+ ]+ },+ "references": "local/relight/editorial-dark.png",+ "prompts": [+ {+ "id": "golden-hour",+ "text": "Relight the photo with a strong soft sunset orange light coming from the left, at face height, far away; and a gentle broad, diffused warm white light coming from the right, at face height, far away. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "studio-rim",+ "text": "Relight the photo with a soft clean white light coming from the left, high above, at a medium distance; a strong hard, crisp cool moonlight blue light behind the subject, rimming the right edge of the silhouette, high above, close to the subject; and a hard, crisp cool moonlight blue light behind the subject, rimming the left edge of the silhouette, high above, close to the subject. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "candlelight",+ "text": "Relight the photo with a strong warm amber light coming from the front, below, close to the subject. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night-shared",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-low",+ "text": "Relight the photo with a strong clean white light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-face",+ "text": "Relight the photo with a strong clean white light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-high",+ "text": "Relight the photo with a strong clean white light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-low",+ "text": "Relight the photo with a strong clean white light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-face",+ "text": "Relight the photo with a strong clean white light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-high",+ "text": "Relight the photo with a strong clean white light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-low",+ "text": "Relight the photo with a strong clean white light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-face",+ "text": "Relight the photo with a strong clean white light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-high",+ "text": "Relight the photo with a strong clean white light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-low",+ "text": "Relight the photo with a strong teal light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-face",+ "text": "Relight the photo with a strong teal light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-high",+ "text": "Relight the photo with a strong teal light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-low",+ "text": "Relight the photo with a strong teal light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-face",+ "text": "Relight the photo with a strong teal light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-high",+ "text": "Relight the photo with a strong teal light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-low",+ "text": "Relight the photo with a strong teal light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-face",+ "text": "Relight the photo with a strong teal light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-high",+ "text": "Relight the photo with a strong teal light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ }+ ]+ },+ {+ "id": "relight/editorial-light",+ "title": "Editorial portrait, lighter skin tone",+ "op": "edit",+ "inputs": {+ "images": [+ "local/relight/editorial-light.png"+ ]+ },+ "demoInputs": {+ "images": [+ "fixtures/start-frame.png"+ ]+ },+ "references": "local/relight/editorial-light.png",+ "prompts": [+ {+ "id": "golden-hour",+ "text": "Relight the photo with a strong soft sunset orange light coming from the left, at face height, far away; and a gentle broad, diffused warm white light coming from the right, at face height, far away. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "studio-rim",+ "text": "Relight the photo with a soft clean white light coming from the left, high above, at a medium distance; a strong hard, crisp cool moonlight blue light behind the subject, rimming the right edge of the silhouette, high above, close to the subject; and a hard, crisp cool moonlight blue light behind the subject, rimming the left edge of the silhouette, high above, close to the subject. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "candlelight",+ "text": "Relight the photo with a strong warm amber light coming from the front, below, close to the subject. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night-shared",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-low",+ "text": "Relight the photo with a strong clean white light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-face",+ "text": "Relight the photo with a strong clean white light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-high",+ "text": "Relight the photo with a strong clean white light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-low",+ "text": "Relight the photo with a strong clean white light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-face",+ "text": "Relight the photo with a strong clean white light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-high",+ "text": "Relight the photo with a strong clean white light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-low",+ "text": "Relight the photo with a strong clean white light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-face",+ "text": "Relight the photo with a strong clean white light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-high",+ "text": "Relight the photo with a strong clean white light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-low",+ "text": "Relight the photo with a strong teal light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-face",+ "text": "Relight the photo with a strong teal light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-high",+ "text": "Relight the photo with a strong teal light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-low",+ "text": "Relight the photo with a strong teal light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-face",+ "text": "Relight the photo with a strong teal light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-high",+ "text": "Relight the photo with a strong teal light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-low",+ "text": "Relight the photo with a strong teal light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-face",+ "text": "Relight the photo with a strong teal light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-high",+ "text": "Relight the photo with a strong teal light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ }+ ]+ },+ {+ "id": "relight/dancer",+ "title": "Dancer in motion",+ "op": "edit",+ "inputs": {+ "images": [+ "local/relight/dancer.png"+ ]+ },+ "demoInputs": {+ "images": [+ "fixtures/start-frame.png"+ ]+ },+ "references": "local/relight/dancer.png",+ "prompts": [+ {+ "id": "golden-hour",+ "text": "Relight the photo with a strong soft sunset orange light coming from the left, at face height, far away; and a gentle broad, diffused warm white light coming from the right, at face height, far away. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "studio-rim",+ "text": "Relight the photo with a soft clean white light coming from the left, high above, at a medium distance; a strong hard, crisp cool moonlight blue light behind the subject, rimming the right edge of the silhouette, high above, close to the subject; and a hard, crisp cool moonlight blue light behind the subject, rimming the left edge of the silhouette, high above, close to the subject. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "candlelight",+ "text": "Relight the photo with a strong warm amber light coming from the front, below, close to the subject. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night-shared",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-low",+ "text": "Relight the photo with a strong clean white light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-face",+ "text": "Relight the photo with a strong clean white light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-high",+ "text": "Relight the photo with a strong clean white light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-low",+ "text": "Relight the photo with a strong clean white light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-face",+ "text": "Relight the photo with a strong clean white light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-high",+ "text": "Relight the photo with a strong clean white light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-low",+ "text": "Relight the photo with a strong clean white light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-face",+ "text": "Relight the photo with a strong clean white light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-high",+ "text": "Relight the photo with a strong clean white light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-low",+ "text": "Relight the photo with a strong teal light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-face",+ "text": "Relight the photo with a strong teal light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-high",+ "text": "Relight the photo with a strong teal light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-low",+ "text": "Relight the photo with a strong teal light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-face",+ "text": "Relight the photo with a strong teal light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-high",+ "text": "Relight the photo with a strong teal light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-low",+ "text": "Relight the photo with a strong teal light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-face",+ "text": "Relight the photo with a strong teal light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-high",+ "text": "Relight the photo with a strong teal light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ }+ ]+ },+ {+ "id": "relight/headwrap",+ "title": "Portrait in a headwrap",+ "op": "edit",+ "inputs": {+ "images": [+ "local/relight/headwrap.png"+ ]+ },+ "demoInputs": {+ "images": [+ "fixtures/start-frame.png"+ ]+ },+ "references": "local/relight/headwrap.png",+ "prompts": [+ {+ "id": "golden-hour",+ "text": "Relight the photo with a strong soft sunset orange light coming from the left, at face height, far away; and a gentle broad, diffused warm white light coming from the right, at face height, far away. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "studio-rim",+ "text": "Relight the photo with a soft clean white light coming from the left, high above, at a medium distance; a strong hard, crisp cool moonlight blue light behind the subject, rimming the right edge of the silhouette, high above, close to the subject; and a hard, crisp cool moonlight blue light behind the subject, rimming the left edge of the silhouette, high above, close to the subject. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "candlelight",+ "text": "Relight the photo with a strong warm amber light coming from the front, below, close to the subject. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night-shared",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-low",+ "text": "Relight the photo with a strong clean white light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-face",+ "text": "Relight the photo with a strong clean white light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-high",+ "text": "Relight the photo with a strong clean white light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-low",+ "text": "Relight the photo with a strong clean white light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-face",+ "text": "Relight the photo with a strong clean white light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-high",+ "text": "Relight the photo with a strong clean white light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-low",+ "text": "Relight the photo with a strong clean white light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-face",+ "text": "Relight the photo with a strong clean white light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-high",+ "text": "Relight the photo with a strong clean white light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-low",+ "text": "Relight the photo with a strong teal light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-face",+ "text": "Relight the photo with a strong teal light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-high",+ "text": "Relight the photo with a strong teal light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-low",+ "text": "Relight the photo with a strong teal light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-face",+ "text": "Relight the photo with a strong teal light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-high",+ "text": "Relight the photo with a strong teal light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-low",+ "text": "Relight the photo with a strong teal light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-face",+ "text": "Relight the photo with a strong teal light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-high",+ "text": "Relight the photo with a strong teal light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ }+ ]+ },+ {+ "id": "relight/dark-portrait",+ "title": "Low-key portrait",+ "op": "edit",+ "inputs": {+ "images": [+ "local/relight/dark-portrait.png"+ ]+ },+ "demoInputs": {+ "images": [+ "fixtures/start-frame.png"+ ]+ },+ "references": "local/relight/dark-portrait.png",+ "prompts": [+ {+ "id": "golden-hour",+ "text": "Relight the photo with a strong soft sunset orange light coming from the left, at face height, far away; and a gentle broad, diffused warm white light coming from the right, at face height, far away. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "studio-rim",+ "text": "Relight the photo with a soft clean white light coming from the left, high above, at a medium distance; a strong hard, crisp cool moonlight blue light behind the subject, rimming the right edge of the silhouette, high above, close to the subject; and a hard, crisp cool moonlight blue light behind the subject, rimming the left edge of the silhouette, high above, close to the subject. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "candlelight",+ "text": "Relight the photo with a strong warm amber light coming from the front, below, close to the subject. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night-shared",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-low",+ "text": "Relight the photo with a strong clean white light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-face",+ "text": "Relight the photo with a strong clean white light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-high",+ "text": "Relight the photo with a strong clean white light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-low",+ "text": "Relight the photo with a strong clean white light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-face",+ "text": "Relight the photo with a strong clean white light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-high",+ "text": "Relight the photo with a strong clean white light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-low",+ "text": "Relight the photo with a strong clean white light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-face",+ "text": "Relight the photo with a strong clean white light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-high",+ "text": "Relight the photo with a strong clean white light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-low",+ "text": "Relight the photo with a strong teal light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-face",+ "text": "Relight the photo with a strong teal light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-high",+ "text": "Relight the photo with a strong teal light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-low",+ "text": "Relight the photo with a strong teal light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-face",+ "text": "Relight the photo with a strong teal light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-high",+ "text": "Relight the photo with a strong teal light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-low",+ "text": "Relight the photo with a strong teal light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-face",+ "text": "Relight the photo with a strong teal light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-high",+ "text": "Relight the photo with a strong teal light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ }+ ]+ },+ {+ "id": "relight/western",+ "title": "Western costume portrait",+ "op": "edit",+ "inputs": {+ "images": [+ "local/relight/western.png"+ ]+ },+ "demoInputs": {+ "images": [+ "fixtures/start-frame.png"+ ]+ },+ "references": "local/relight/western.png",+ "prompts": [+ {+ "id": "golden-hour",+ "text": "Relight the photo with a strong soft sunset orange light coming from the left, at face height, far away; and a gentle broad, diffused warm white light coming from the right, at face height, far away. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "studio-rim",+ "text": "Relight the photo with a soft clean white light coming from the left, high above, at a medium distance; a strong hard, crisp cool moonlight blue light behind the subject, rimming the right edge of the silhouette, high above, close to the subject; and a hard, crisp cool moonlight blue light behind the subject, rimming the left edge of the silhouette, high above, close to the subject. The scene is in darkness, lit only by these lights. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "candlelight",+ "text": "Relight the photo with a strong warm amber light coming from the front, below, close to the subject. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "neon-night-shared",+ "text": "Relight the photo with a strong vivid neon magenta light coming from the left, at face height, close to the subject; and a strong electric neon blue light coming from the right, at face height, close to the subject. The scene is in darkness, lit only by these lights, with hard, crisp light and sharp, defined shadows. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-low",+ "text": "Relight the photo with a strong clean white light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-face",+ "text": "Relight the photo with a strong clean white light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-left-high",+ "text": "Relight the photo with a strong clean white light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-low",+ "text": "Relight the photo with a strong clean white light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-face",+ "text": "Relight the photo with a strong clean white light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-front-high",+ "text": "Relight the photo with a strong clean white light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-low",+ "text": "Relight the photo with a strong clean white light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-face",+ "text": "Relight the photo with a strong clean white light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "white-right-high",+ "text": "Relight the photo with a strong clean white light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-low",+ "text": "Relight the photo with a strong teal light coming from the left, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-face",+ "text": "Relight the photo with a strong teal light coming from the left, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-left-high",+ "text": "Relight the photo with a strong teal light coming from the left, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-low",+ "text": "Relight the photo with a strong teal light coming from the front, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-face",+ "text": "Relight the photo with a strong teal light coming from the front, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-front-high",+ "text": "Relight the photo with a strong teal light coming from the front, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-low",+ "text": "Relight the photo with a strong teal light coming from the right, below, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-face",+ "text": "Relight the photo with a strong teal light coming from the right, at face height, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ },+ {+ "id": "teal-right-high",+ "text": "Relight the photo with a strong teal light coming from the right, high above, at a medium distance. The scene is in darkness, lit only by these lights, with soft light and smooth shadow edges. Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change."+ }+ ]+ }+ ]+}diff --git a/src/app/(studio)/apps/[id]/page.tsx b/src/app/(studio)/apps/[id]/page.tsxindex b190bf75..888206d0 100644--- a/src/app/(studio)/apps/[id]/page.tsx+++ b/src/app/(studio)/apps/[id]/page.tsx@@ -3,6 +3,7 @@ import { notFound } from "next/navigation";import { Suspense } from "react";import { Studio } from "@/components/studio/studio";import { CleanVoiceTool } from "@/components/audio-tools/clean-voice-tool";+import { RelightTool } from "@/components/relight/relight-tool";import { APPS, getModel, getPreset } from "@/lib/catalog";import { withRecipe } from "@/lib/catalog/preset-recipes";import { appStudio } from "@/lib/studios";@@ -23,6 +24,8 @@ async function AppStudio({ params }: { params: PageProps<"/apps/[id]">["params"]if (!preset || preset.type !== "app") notFound();// An app that is a tool of its own (Clean up voice): the same tool as its Audio mode, under the app's name.if (preset.tool === "clean-voice") return <CleanVoiceTool app={{ name: preset.name, description: preset.description }} />;+ // Relight: tap the photo to place lights, a live preview, then Generate lighting and an instant Intensity blend.+ if (preset.tool === "relight") return <RelightTool app={{ name: preset.name, description: preset.description }} />;// The app opens on the model its preview was made with, its own route one pick away.return <Studio config={withRecipe(appStudio(preset), (m) => !!getModel(m))} />;}diff --git a/src/app/api/generations/local/route.ts b/src/app/api/generations/local/route.tsindex 2a8e4ea1..909b52a6 100644--- a/src/app/api/generations/local/route.ts+++ b/src/app/api/generations/local/route.ts@@ -4,14 +4,14 @@ import { recordLocalGeneration } from "@/server/generations";const Body = z.object({feature: z.string().min(1).max(80),modelId: z.string().min(1),- op: z.literal("grade"),+ op: z.enum(["grade", "relight"]),prompt: z.string().max(2000),inputs: z.object({ images: z.array(z.string()).max(1).optional(), video: z.string().optional() }),params: z.object({ extra: z.record(z.string(), z.unknown()).optional() }).optional(),output: z.object({ url: z.string().startsWith("/api/files/").max(500), kind: z.enum(["image", "video"]), contentType: z.string().optional() }),});-/** Record a result rendered in the browser (e.g. a colour grade) so it shows up in the library. */+/** Record a result rendered in the browser (a colour grade, a Relight blend) so it shows up in the library. */export async function POST(request: Request) {const parsed = Body.safeParse(await request.json().catch(() => null));if (!parsed.success) return Response.json({ error: "Invalid result" }, { status: 400 });diff --git a/src/components/relight/align-client.ts b/src/components/relight/align-client.tsnew file mode 100644index 00000000..87d477eb--- /dev/null+++ b/src/components/relight/align-client.ts@@ -0,0 +1,72 @@+"use client";++import { alignFit, WORK, type AlignResult } from "@/lib/relight/align";+import type { AlignReply, AlignRequest } from "./align.worker";+import type { Pic } from "./relight-renderer";++/**+ * Lines a relit picture up with its photo in a Web Worker (src/lib/relight/align.ts). A browser without module+ * workers runs the same maths on the main thread (well under a second).+ */++let worker: Worker | null = null;+let broken = false;+let seq = 0;+const waiting = new Map<number, (r: AlignResult | null) => void>();++function getWorker(): Worker | null {+ if (worker || broken) return worker;+ if (typeof Worker === "undefined") return null;+ try {+ worker = new Worker(new URL("./align.worker.ts", import.meta.url), { type: "module" });+ worker.onmessage = (e: MessageEvent<AlignReply>) => {+ waiting.get(e.data.id)?.(e.data.result);+ waiting.delete(e.data.id);+ };+ worker.onerror = () => {+ for (const done of waiting.values()) done(null);+ waiting.clear();+ worker?.terminate();+ worker = null;+ broken = true;+ };+ return worker;+ } catch {+ broken = true;+ return null;+ }+}++/** A picture's luma at size × size (each axis resampled on its own), 0..1. */+function lumaMap(p: Pic, size: number): Float32Array {+ const c = document.createElement("canvas");+ c.width = size;+ c.height = size;+ const ctx = c.getContext("2d", { willReadFrequently: true })!;+ ctx.drawImage(p, 0, 0, size, size);+ const d = ctx.getImageData(0, 0, size, size).data;+ const out = new Float32Array(size * size);+ for (let i = 0; i < out.length; i++) out[i] = (0.2126 * d[i * 4] + 0.7152 * d[i * 4 + 1] + 0.0722 * d[i * 4 + 2]) / 255;+ return out;+}++export async function alignPictures(photo: Pic, relit: Pic): Promise<AlignResult | null> {+ const a = lumaMap(photo, WORK);+ const b = lumaMap(relit, WORK);+ const w = getWorker();+ if (!w) return alignFit(a, b, WORK);+ const id = ++seq;+ return new Promise((resolve) => {+ const timer = setTimeout(() => {+ waiting.delete(id);+ resolve(alignFit(a, b, WORK));+ }, 4000);+ waiting.set(id, (r) => {+ clearTimeout(timer);+ resolve(r);+ });+ const pa = a.slice();+ const pb = b.slice();+ w.postMessage({ id, photo: pa, relit: pb, size: WORK } satisfies AlignRequest, [pa.buffer, pb.buffer]);+ });+}diff --git a/src/components/relight/align.worker.ts b/src/components/relight/align.worker.tsnew file mode 100644index 00000000..32e773d8--- /dev/null+++ b/src/components/relight/align.worker.ts@@ -0,0 +1,28 @@+/**+ * Lines the relit picture up with the photo off the main thread (src/lib/relight/align.ts): two WORK × WORK grey maps+ * in, the fit out. Nothing leaves the browser.+ */+import { alignFit, type AlignResult } from "@/lib/relight/align";++export interface AlignRequest {+ id: number;+ photo: Float32Array;+ relit: Float32Array;+ size: number;+}++export interface AlignReply {+ id: number;+ result: AlignResult | null;+}++self.onmessage = (e: MessageEvent<AlignRequest>) => {+ const { id, photo, relit, size } = e.data;+ let result: AlignResult | null = null;+ try {+ result = alignFit(photo, relit, size);+ } catch {+ result = null;+ }+ (self as unknown as Worker).postMessage({ id, result } satisfies AlignReply);+};diff --git a/src/components/relight/relight-panel.tsx b/src/components/relight/relight-panel.tsxnew file mode 100644index 00000000..7d6f712e--- /dev/null+++ b/src/components/relight/relight-panel.tsx@@ -0,0 +1,213 @@+"use client";++import { Check, Plus, Trash2 } from "lucide-react";+import { useId } from "react";+import { Button } from "@/components/ui/button";+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";+import { Slider } from "@/components/ui/slider";+import { Switch } from "@/components/ui/switch";+import { ColorPicker } from "@/components/palettes/color-picker";+import { radioKeys, radioTab } from "@/components/studio/radio-keys";+import {+ chipOf,+ COLOR_CHIPS,+ DISTANCE_LABELS,+ DISTANCES,+ FEATURED_LOOKS,+ HEIGHT_LABELS,+ HEIGHTS,+ LOOKS,+ MAX_LIGHTS,+ SOFTNESS_LABELS,+ SOFTNESSES,+ STRENGTH_LABELS,+ STRENGTHS,+ strengthFromValue,+ strengthValueOf,+ yForHeight,+ type Light,+ type LookId,+} from "@/lib/relight/lights";+import { cn } from "@/lib/utils";++/** A row of preset chips: 44 px tall on phones, a radio group for the keyboard. */+export function Chips<T extends string | number>({+ label,+ value,+ options,+ onChange,+ className,+}: {+ label: string;+ value: T | null;+ options: { value: T; label: string; swatch?: string }[];+ onChange: (v: T) => void;+ className?: string;+}) {+ return (+ <div role="radiogroup" aria-label={label} onKeyDown={radioKeys} className={cn("flex min-w-0 flex-wrap gap-1.5", className)}>+ {options.map((o) => {+ const on = value === o.value;+ return (+ <button+ key={String(o.value)}+ type="button"+ role="radio"+ aria-checked={on}+ tabIndex={radioTab(on || (value === null && o === options[0]))}+ onClick={() => onChange(o.value)}+ className={cn(+ "inline-flex h-11 items-center gap-1.5 rounded-full border px-3.5 text-[13px] font-medium whitespace-nowrap transition outline-none focus-visible:ring-2 focus-visible:ring-ring sm:h-9",+ on ? "border-foreground bg-foreground text-background" : "border-border bg-background text-foreground hover:bg-muted",+ )}+ >+ {o.swatch && <span aria-hidden className="size-3.5 rounded-full border border-black/15" style={{ background: o.swatch }} />}+ {o.label}+ </button>+ );+ })}+ </div>+ );+}++function Field({ label, children }: { label: string; children: React.ReactNode }) {+ return (+ <div className="space-y-1.5">+ <p className="text-[12px] font-medium text-muted-foreground">{label}</p>+ {children}+ </div>+ );+}++/** The Looks row: one tap places a full rig. The four named looks first. */+export function LooksRow({ look, onLook }: { look: LookId | null; onLook: (id: LookId) => void }) {+ const ordered = [...LOOKS].sort((a, b) => rank(a.id) - rank(b.id));+ return (+ <Field label={look ? "Looks" : "Looks · Your lights"}>+ <Chips label="Looks" value={look} options={ordered.map((l) => ({ value: l.id, label: l.label, swatch: l.lights[0].color }))} onChange={onLook} />+ </Field>+ );+}++const rank = (id: LookId) => {+ const i = FEATURED_LOOKS.indexOf(id);+ return i < 0 ? 10 + LOOKS.findIndex((l) => l.id === id) : i;+};++/** The selected light's chips (and, on a desktop, its strength slider). */+export function LightPanel({+ lights,+ selected,+ onSelect,+ onChange,+ onRemove,+ onAdd,+ fine,+}: {+ lights: Light[];+ selected: string | null;+ onSelect: (id: string) => void;+ onChange: (l: Light) => void;+ onRemove: (id: string) => void;+ onAdd: () => void;+ /** A mouse is here: sliders show under the chips. */+ fine: boolean;+}) {+ const l = lights.find((x) => x.id === selected) ?? null;+ const behindId = useId();+ const full = lights.length >= MAX_LIGHTS;+ return (+ <div className="space-y-3" id="relight-light-panel">+ <div className="flex flex-wrap items-center gap-1.5">+ {lights.map((x, i) => (+ <button+ key={x.id}+ type="button"+ onClick={() => onSelect(x.id)}+ aria-pressed={x.id === selected}+ className={cn(+ "inline-flex h-11 items-center gap-1.5 rounded-full border px-3 text-[13px] font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring sm:h-9",+ x.id === selected ? "border-foreground" : "border-border text-muted-foreground",+ )}+ >+ <span aria-hidden className={cn("size-3.5 rounded-full border border-black/15", x.behind && "ring-1 ring-foreground/40 ring-offset-1")} style={{ background: x.color }} />+ Light {i + 1}+ </button>+ ))}+ <Button variant="outline" className="h-11 rounded-full sm:h-9" onClick={onAdd} disabled={full} title={full ? "Up to 3 lights" : undefined}>+ <Plus className="size-3.5" /> Add light+ </Button>+ {full && <span className="text-[12px] text-muted-foreground">Up to 3 lights</span>}+ </div>+ {!l ? (+ <p className="text-[13px] text-muted-foreground">{lights.length ? "Pick a light to change it." : "Tap the photo to place a light, or add one."}</p>+ ) : (+ <div className="space-y-3">+ <Field label="Colour">+ <div className="flex flex-wrap items-center gap-1.5">+ <Chips label="Colour" value={chipOf(l.color)?.id ?? null} options={COLOR_CHIPS.map((c) => ({ value: c.id, label: c.label, swatch: c.hex }))} onChange={(id) => onChange({ ...l, color: COLOR_CHIPS.find((c) => c.id === id)!.hex })} />+ <Popover>+ <PopoverTrigger asChild>+ <button+ type="button"+ className={cn(+ "inline-flex h-11 items-center gap-1.5 rounded-full border px-3.5 text-[13px] font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring sm:h-9",+ chipOf(l.color) ? "border-border" : "border-foreground bg-foreground text-background",+ )}+ >+ <span aria-hidden className="size-3.5 rounded-full border border-black/15" style={{ background: chipOf(l.color) ? "conic-gradient(red, yellow, lime, cyan, blue, magenta, red)" : l.color }} />+ Custom+ {!chipOf(l.color) && <Check className="size-3.5" />}+ </button>+ </PopoverTrigger>+ <PopoverContent className="w-[min(92vw,280px)] p-3" collisionPadding={12}>+ <ColorPicker value={l.color} onChange={(hex) => onChange({ ...l, color: hex })} />+ </PopoverContent>+ </Popover>+ </div>+ </Field>+ <Field label="Height">+ <Chips label="Height" value={l.height} options={HEIGHTS.map((h) => ({ value: h, label: HEIGHT_LABELS[h] }))} onChange={(h) => onChange({ ...l, height: h, y: yForHeight(l.y, h) })} />+ </Field>+ <Field label="Distance">+ <Chips label="Distance" value={l.distance} options={DISTANCES.map((d) => ({ value: d, label: DISTANCE_LABELS[d] }))} onChange={(d) => onChange({ ...l, distance: d })} />+ </Field>+ <Field label="Softness">+ <Chips label="Softness" value={l.softness} options={SOFTNESSES.map((s) => ({ value: s, label: SOFTNESS_LABELS[s] }))} onChange={(s) => onChange({ ...l, softness: s })} />+ </Field>+ <Field label="Strength">+ <Chips+ label="Strength"+ value={l.strengthValue === undefined ? l.strength : null}+ options={STRENGTHS.map((s) => ({ value: s, label: STRENGTH_LABELS[s] }))}+ onChange={(s) => onChange({ ...l, strength: s, strengthValue: undefined })}+ />+ {fine && (+ <Slider+ className="mt-2 max-w-xs"+ aria-label="Strength"+ aria-valuetext={`${Math.round(strengthValueOf(l) * 100)} %`}+ min={0}+ max={100}+ step={1}+ value={[Math.round(strengthValueOf(l) * 100)]}+ onValueChange={([v]) => onChange({ ...l, strengthValue: v / 100, strength: strengthFromValue(v / 100) })}+ />+ )}+ </Field>+ <div className="flex flex-wrap items-center justify-between gap-3">+ <div className="flex min-h-11 items-center gap-2">+ <Switch id={behindId} checked={!!l.behind} onCheckedChange={(on) => onChange({ ...l, behind: on || undefined })} />+ <label htmlFor={behindId} className="text-[13px]">+ Behind the subject+ </label>+ </div>+ <Button variant="ghost" className="h-11 rounded-full text-muted-foreground sm:h-9" onClick={() => onRemove(l.id)}>+ <Trash2 className="size-3.5" /> Remove light+ </Button>+ </div>+ </div>+ )}+ </div>+ );+}diff --git a/src/components/relight/relight-renderer.ts b/src/components/relight/relight-renderer.tsnew file mode 100644index 00000000..52cc9bb7--- /dev/null+++ b/src/components/relight/relight-renderer.ts@@ -0,0 +1,160 @@+"use client";++import { FRAGMENT, uniforms, VERTEX, type StageState } from "@/lib/relight/shader";++export type Pic = HTMLImageElement | HTMLCanvasElement | ImageBitmap;++const sizeOf = (p: Pic): [number, number] => (p instanceof HTMLImageElement ? [p.naturalWidth, p.naturalHeight] : [p.width, p.height]);++/** A picture no larger than `max` on its long side (the same picture when it already is). */+export function fit(p: Pic, max: number): Pic {+ const [w, h] = sizeOf(p);+ const s = Math.min(1, max / Math.max(1, w, h));+ if (s >= 1) return p;+ const c = document.createElement("canvas");+ c.width = Math.max(1, Math.round(w * s));+ c.height = Math.max(1, Math.round(h * s));+ c.getContext("2d")!.drawImage(p, 0, 0, c.width, c.height);+ return c;+}++export function picSize(p: Pic): [number, number] {+ return sizeOf(p);+}++const UNITS = { uPhoto: 0, uDepth: 1, uMatte: 2, uRelit: 3 } as const;+type Unit = keyof typeof UNITS;++/**+ * One WebGL context that draws the Relight stage (src/lib/relight/shader.ts): the photo, its scene read, the relit+ * picture and the lights. One draw per change; nothing runs while idle.+ */+export class RelightRenderer {+ gl: WebGLRenderingContext;+ prog: WebGLProgram;+ tex = {} as Record<Unit, WebGLTexture>;+ loc = new Map<string, WebGLUniformLocation | null>();+ size: [number, number] = [1, 1];+ depthSize: [number, number] = [1, 1];++ constructor(public canvas: HTMLCanvasElement) {+ const gl = canvas.getContext("webgl", { preserveDrawingBuffer: true, premultipliedAlpha: false, antialias: false });+ if (!gl) throw new Error("WebGL isn't available in this browser");+ this.gl = gl;+ const sh = (type: number, src: string) => {+ const s = gl.createShader(type)!;+ gl.shaderSource(s, src);+ gl.compileShader(s);+ if (!gl.getShaderParameter(s, gl.COMPILE_STATUS)) throw new Error(gl.getShaderInfoLog(s) ?? "shader error");+ return s;+ };+ const prog = gl.createProgram()!;+ gl.attachShader(prog, sh(gl.VERTEX_SHADER, VERTEX));+ gl.attachShader(prog, sh(gl.FRAGMENT_SHADER, FRAGMENT));+ gl.linkProgram(prog);+ if (!gl.getProgramParameter(prog, gl.LINK_STATUS)) throw new Error(gl.getProgramInfoLog(prog) ?? "link error");+ gl.useProgram(prog);+ this.prog = prog;+ const buf = gl.createBuffer();+ gl.bindBuffer(gl.ARRAY_BUFFER, buf);+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), gl.STATIC_DRAW);+ const pos = gl.getAttribLocation(prog, "a_pos");+ gl.enableVertexAttribArray(pos);+ gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);+ for (const unit of Object.keys(UNITS) as Unit[]) {+ const t = gl.createTexture()!;+ gl.activeTexture(gl.TEXTURE0 + UNITS[unit]);+ gl.bindTexture(gl.TEXTURE_2D, t);+ for (const [k, v] of [+ [gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE],+ [gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE],+ [gl.TEXTURE_MIN_FILTER, gl.LINEAR],+ [gl.TEXTURE_MAG_FILTER, gl.LINEAR],+ ])+ gl.texParameteri(gl.TEXTURE_2D, k, v);+ // A 1×1 black texture until a picture comes.+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, new Uint8Array(3));+ gl.uniform1i(gl.getUniformLocation(prog, unit), UNITS[unit]);+ this.tex[unit] = t;+ }+ }++ get maxSize(): number {+ return this.gl.getParameter(this.gl.MAX_TEXTURE_SIZE) as number;+ }++ private u(name: string) {+ if (!this.loc.has(name)) this.loc.set(name, this.gl.getUniformLocation(this.prog, name));+ return this.loc.get(name)!;+ }++ set(unit: Unit, p: Pic | null) {+ const gl = this.gl;+ gl.activeTexture(gl.TEXTURE0 + UNITS[unit]);+ gl.bindTexture(gl.TEXTURE_2D, this.tex[unit]);+ if (p) gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, p);+ else gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, new Uint8Array(3));+ if (unit === "uPhoto" && p) this.size = sizeOf(p);+ if (unit === "uDepth") this.depthSize = p ? sizeOf(p) : [1, 1];+ }++ /** Draw at `width` × `height` (the canvas takes that size). */+ draw(state: Omit<StageState, "width" | "height" | "depthWidth" | "depthHeight">, width: number, height: number) {+ const gl = this.gl;+ if (this.canvas.width !== width || this.canvas.height !== height) {+ this.canvas.width = width;+ this.canvas.height = height;+ }+ gl.viewport(0, 0, width, height);+ const u = uniforms({ ...state, width: this.size[0], height: this.size[1], depthWidth: this.depthSize[0], depthHeight: this.depthSize[1] });+ for (const [k, v] of Object.entries(u.scalars)) gl.uniform1f(this.u(k), v);+ for (const [k, v] of Object.entries(u.ints)) gl.uniform1i(this.u(k), v);+ for (const [k, v] of Object.entries(u.vec2)) gl.uniform2f(this.u(k), v[0], v[1]);+ for (const [k, v] of Object.entries(u.vec4)) gl.uniform4f(this.u(k), v[0], v[1], v[2], v[3]);+ gl.uniform3fv(this.u("uPos[0]") ?? this.u("uPos"), u.arrays.uPos);+ gl.uniform3fv(this.u("uColor[0]") ?? this.u("uColor"), u.arrays.uColor);+ gl.uniform4fv(this.u("uParams[0]") ?? this.u("uParams"), u.arrays.uParams);+ gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);+ }++ dispose() {+ try {+ this.gl.getExtension("WEBGL_lose_context")?.loseContext();+ } catch {}+ }+}++/** Load a picture (same origin, or a blob: address). */+export function loadPic(url: string): Promise<HTMLImageElement> {+ return new Promise((resolve, reject) => {+ const img = new Image();+ img.crossOrigin = "anonymous";+ img.decoding = "async";+ img.onload = () => resolve(img);+ img.onerror = () => reject(new Error("That picture didn't load"));+ img.src = url;+ });+}++/** A picture's grey values at w × h (0..255, one per pixel). */+export function greyOf(p: Pic, w: number, h: number): Uint8Array {+ const c = document.createElement("canvas");+ c.width = w;+ c.height = h;+ const ctx = c.getContext("2d", { willReadFrequently: true })!;+ ctx.drawImage(p, 0, 0, w, h);+ const d = ctx.getImageData(0, 0, w, h).data;+ const out = new Uint8Array(w * h);+ for (let i = 0; i < out.length; i++) out[i] = d[i * 4];+ return out;+}++/** A picture's RGBA pixels at w × h. */+export function pixelsOf(p: Pic, w: number, h: number): Uint8ClampedArray {+ const c = document.createElement("canvas");+ c.width = w;+ c.height = h;+ const ctx = c.getContext("2d", { willReadFrequently: true })!;+ ctx.drawImage(p, 0, 0, w, h);+ return ctx.getImageData(0, 0, w, h).data;+}diff --git a/src/components/relight/relight-stage.tsx b/src/components/relight/relight-stage.tsxnew file mode 100644index 00000000..05dd939b--- /dev/null+++ b/src/components/relight/relight-stage.tsx@@ -0,0 +1,316 @@+"use client";++import { useEffect, useRef, useState } from "react";+import { MAX_LIGHTS, type Light } from "@/lib/relight/lights";+import type { BlendMode } from "@/lib/relight/engine";+import type { AlignFit } from "@/lib/relight/shader";+import { cn } from "@/lib/utils";+import { fit, picSize, RelightRenderer, type Pic } from "./relight-renderer";++export interface StageScene {+ depth: Pic;+ matte: Pic;+ subjectDepth: number;+}++export interface StageProps {+ photo: Pic | null;+ alt: string;+ relit: Pic | null;+ align: AlignFit | null;+ scene: StageScene | null;+ lights: Light[];+ selected: string | null;+ intensity: number;+ blend: BlendMode;+ glow: boolean;+ ambient: number;+ /** A line under the photo while something runs ("Reading the scene…"). */+ status?: string | null;+ /** A light sweep over the photo while Generate runs. */+ working?: boolean;+ onTap: (x: number, y: number) => void;+ onSelect: (id: string | null) => void;+ onMove: (id: string, x: number, y: number) => void;+ onRemove: (id: string) => void;+ onAddDefault: () => void;+ onGenerate: () => void;+ /** Tapping the selected light again: show its chips. */+ onOpenLight: (id: string) => void;+ /** Drawn on every frame the stage paints (the e2e test reads it). */+ onPainted?: (ms: number) => void;+ className?: string;+}++const HOLD_MS = 350;+const MOVE_PX = 8;++/** How big the preview texture may be: phones 1280 on the long side, desktops 2048. */+function previewMax(): number {+ if (typeof window === "undefined") return 1280;+ return window.matchMedia?.("(pointer: coarse)").matches || window.innerWidth < 768 ? 1280 : 2048;+}++/**+ * The photo with its lights: the WebGL preview (or the blended result), a marker per light, tap to place or select,+ * press and hold to see the original. Drag and the keyboard are desktop extras.+ */+export function RelightStage(p: StageProps) {+ const canvas = useRef<HTMLCanvasElement>(null);+ const box = useRef<HTMLDivElement>(null);+ const renderer = useRef<RelightRenderer | null>(null);+ const [failed, setFailed] = useState(false);+ const [original, setOriginal] = useState(false);+ const [cssSize, setCssSize] = useState<[number, number]>([0, 0]);+ const press = useRef<{ x: number; y: number; timer: number; held: boolean; moved: boolean } | null>(null);+ const drag = useRef<{ id: string; pointer: number; moved: boolean; wasSelected: boolean } | null>(null);+ const latest = useRef(p);+ useEffect(() => {+ latest.current = p;+ });++ // One context for the stage's life.+ useEffect(() => {+ if (!canvas.current) return;+ try {+ renderer.current = new RelightRenderer(canvas.current);+ } catch {+ // eslint-disable-next-line react-hooks/set-state-in-effect -- WebGL can only be tried once the canvas is mounted+ setFailed(true);+ }+ const c = canvas.current;+ const lost = (e: Event) => {+ e.preventDefault();+ setFailed(true);+ };+ c.addEventListener("webglcontextlost", lost);+ return () => {+ c.removeEventListener("webglcontextlost", lost);+ renderer.current?.dispose();+ renderer.current = null;+ };+ }, []);++ // The stage's size on screen.+ useEffect(() => {+ const el = box.current;+ if (!el) return;+ const ro = new ResizeObserver(() => setCssSize([el.clientWidth, el.clientHeight]));+ ro.observe(el);+ setCssSize([el.clientWidth, el.clientHeight]);+ return () => ro.disconnect();+ }, []);++ // Pictures go to the GPU when they change, not on every draw.+ useEffect(() => {+ renderer.current?.set("uPhoto", p.photo ? fit(p.photo, previewMax()) : null);+ }, [p.photo]);+ useEffect(() => {+ renderer.current?.set("uRelit", p.relit ? fit(p.relit, previewMax()) : null);+ }, [p.relit]);+ useEffect(() => {+ renderer.current?.set("uDepth", p.scene?.depth ?? null);+ renderer.current?.set("uMatte", p.scene?.matte ?? null);+ }, [p.scene]);++ const [pw, ph] = p.photo ? picSize(p.photo) : [4, 3];+ const aspect = pw / Math.max(1, ph);++ // One draw per change.+ useEffect(() => {+ const r = renderer.current;+ if (!r || !p.photo || !cssSize[0]) return;+ const frame = requestAnimationFrame(() => {+ const t0 = performance.now();+ const dpr = Math.min(2, window.devicePixelRatio || 1);+ const max = Math.min(previewMax(), r.maxSize);+ let w = Math.round(cssSize[0] * dpr);+ let h = Math.round(w / aspect);+ const s = Math.min(1, max / Math.max(w, h));+ w = Math.max(1, Math.round(w * s));+ h = Math.max(1, Math.round(h * s));+ r.draw(+ {+ lights: p.lights,+ intensity: p.intensity,+ aspect,+ scene: { hasScene: !!p.scene, subjectDepth: p.scene?.subjectDepth ?? 0.5 },+ mode: p.relit ? "result" : "preview",+ blend: p.blend,+ glow: p.glow,+ original,+ align: p.align ?? undefined,+ ambient: p.ambient,+ },+ w,+ h,+ );+ p.onPainted?.(performance.now() - t0);+ });+ return () => cancelAnimationFrame(frame);+ // p.onPainted is a report, not an input.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [p.photo, p.relit, p.scene, p.lights, p.intensity, p.blend, p.glow, p.align, p.ambient, original, cssSize, aspect]);++ const spot = (clientX: number, clientY: number) => {+ const r = box.current!.getBoundingClientRect();+ return { x: Math.min(1, Math.max(0, (clientX - r.left) / r.width)), y: Math.min(1, Math.max(0, 1 - (clientY - r.top) / r.height)) };+ };++ const onPointerDown = (e: React.PointerEvent<HTMLDivElement>) => {+ if ((e.target as HTMLElement).closest("[data-light]")) return;+ if (e.button !== 0) return;+ const timer = window.setTimeout(() => {+ if (press.current && !press.current.moved) {+ press.current.held = true;+ setOriginal(true);+ }+ }, HOLD_MS);+ press.current = { x: e.clientX, y: e.clientY, timer, held: false, moved: false };+ };+ const onPointerMove = (e: React.PointerEvent<HTMLDivElement>) => {+ const d = drag.current;+ if (d && d.pointer === e.pointerId) {+ d.moved = true;+ const s = spot(e.clientX, e.clientY);+ latest.current.onMove(d.id, s.x, s.y);+ return;+ }+ const pr = press.current;+ if (pr && !pr.moved && Math.hypot(e.clientX - pr.x, e.clientY - pr.y) > MOVE_PX) {+ pr.moved = true;+ clearTimeout(pr.timer);+ }+ };+ const endPress = (e: React.PointerEvent<HTMLDivElement>, cancelled = false) => {+ const d = drag.current;+ if (d && d.pointer === e.pointerId) {+ drag.current = null;+ if (!d.moved && d.wasSelected) latest.current.onOpenLight(d.id);+ return;+ }+ const pr = press.current;+ press.current = null;+ if (!pr) return;+ clearTimeout(pr.timer);+ if (pr.held) return setOriginal(false);+ if (cancelled || pr.moved) return;+ const s = spot(e.clientX, e.clientY);+ latest.current.onTap(s.x, s.y);+ };++ const onMarkerDown = (e: React.PointerEvent<HTMLButtonElement>, l: Light) => {+ e.stopPropagation();+ const wasSelected = p.selected === l.id;+ p.onSelect(l.id);+ // Drag is for a mouse or a pen; on touch a light is moved by tapping where it goes or with its chips.+ if (e.pointerType !== "touch") {+ box.current?.setPointerCapture(e.pointerId);+ drag.current = { id: l.id, pointer: e.pointerId, moved: false, wasSelected };+ } else if (wasSelected) {+ p.onOpenLight(l.id);+ }+ };++ const onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {+ const sel = p.lights.find((l) => l.id === p.selected);+ const step = e.shiftKey ? 0.08 : 0.02;+ const move: Record<string, [number, number]> = { ArrowLeft: [-step, 0], ArrowRight: [step, 0], ArrowUp: [0, step], ArrowDown: [0, -step] };+ if (move[e.key] && sel) {+ e.preventDefault();+ p.onMove(sel.id, sel.x + move[e.key][0], sel.y + move[e.key][1]);+ } else if ((e.key === "Delete" || e.key === "Backspace") && sel) {+ e.preventDefault();+ p.onRemove(sel.id);+ } else if (/^[1-3]$/.test(e.key) && p.lights[Number(e.key) - 1]) {+ p.onSelect(p.lights[Number(e.key) - 1].id);+ } else if (e.key === "n" || e.key === "N") {+ e.preventDefault();+ p.onAddDefault();+ } else if (e.key === "g" || e.key === "G") {+ e.preventDefault();+ p.onGenerate();+ } else if (e.key === " ") {+ e.preventDefault();+ setOriginal(true);+ }+ };+ const onKeyUp = (e: React.KeyboardEvent<HTMLDivElement>) => {+ if (e.key === " ") setOriginal(false);+ };++ return (+ <div className={cn("relative", p.className)}>+ <div+ ref={box}+ role="group"+ tabIndex={0}+ aria-label={`${p.alt}. Tap to place a light (up to ${MAX_LIGHTS}); press and hold to see the original.`}+ aria-keyshortcuts="1 2 3 ArrowLeft ArrowRight ArrowUp ArrowDown Delete N G Space"+ data-testid="relight-stage"+ data-original={original ? "1" : undefined}+ className="relative w-full touch-manipulation overflow-hidden rounded-2xl bg-media outline-none select-none focus-visible:ring-2 focus-visible:ring-ring"+ style={{ aspectRatio: `${pw} / ${ph}` }}+ onPointerDown={onPointerDown}+ onPointerMove={onPointerMove}+ onPointerUp={(e) => endPress(e)}+ onPointerCancel={(e) => endPress(e, true)}+ onPointerLeave={(e) => press.current && e.pointerType === "mouse" && endPress(e, true)}+ onContextMenu={(e) => e.preventDefault()}+ onKeyDown={onKeyDown}+ onKeyUp={onKeyUp}+ >+ <canvas ref={canvas} className={cn("absolute inset-0 size-full", failed && "hidden")} aria-hidden />+ {failed && p.photo instanceof HTMLImageElement && (+ // Without WebGL: the photo, the relit picture faded over it by Intensity.+ <>+ {/* eslint-disable-next-line @next/next/no-img-element */}+ <img src={p.photo.src} alt="" className="absolute inset-0 size-full object-cover" />+ {p.relit instanceof HTMLImageElement && !original && (+ // eslint-disable-next-line @next/next/no-img-element+ <img src={p.relit.src} alt="" className="absolute inset-0 size-full object-cover" style={{ opacity: p.intensity }} />+ )}+ </>+ )}+ {p.working && <div aria-hidden className="pointer-events-none absolute inset-0 animate-pulse bg-gradient-to-r from-transparent via-white/10 to-transparent" />}+ {!original &&+ p.lights.map((l, i) => (+ <button+ key={l.id}+ type="button"+ data-light={l.id}+ aria-label={`Light ${i + 1}${p.selected === l.id ? " (selected)" : ""}`}+ aria-pressed={p.selected === l.id}+ onPointerDown={(e) => onMarkerDown(e, l)}+ onClick={(e) => {+ // Keyboard activation (pointer taps are handled on pointer down).+ if (e.detail === 0) p.onSelect(l.id);+ }}+ className="absolute grid size-11 -translate-x-1/2 -translate-y-1/2 cursor-grab place-items-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring active:cursor-grabbing"+ style={{ left: `${l.x * 100}%`, top: `${(1 - l.y) * 100}%` }}+ >+ <span+ className={cn(+ "grid size-6 place-items-center rounded-full border-2 text-[11px] font-semibold text-black/80 shadow-[0_0_0_1px_rgba(0,0,0,0.35),0_2px_8px_rgba(0,0,0,0.35)]",+ l.behind ? "border-dashed" : "border-solid",+ p.selected === l.id ? "scale-110 border-white ring-2 ring-white/70" : "border-white/80",+ )}+ style={{ background: l.color }}+ >+ {i + 1}+ </span>+ </button>+ ))}+ {original && <span className="pointer-events-none absolute top-2 left-2 rounded-full bg-black/55 px-2 py-0.5 text-[12px] text-white">Original</span>}+ </div>+ {p.status && (+ <div className="mt-1.5 flex items-center gap-2 text-[12px] text-muted-foreground" role="status" aria-live="polite">+ <span className="relative h-0.5 w-16 overflow-hidden rounded-full bg-muted">+ <span className="absolute inset-y-0 left-0 w-1/2 animate-pulse rounded-full bg-primary" />+ </span>+ {p.status}+ </div>+ )}+ </div>+ );+}diff --git a/src/components/relight/relight-tool.tsx b/src/components/relight/relight-tool.tsxnew file mode 100644index 00000000..5f549cf3--- /dev/null+++ b/src/components/relight/relight-tool.tsx@@ -0,0 +1,785 @@+"use client";++import { Check, ChevronRight, Clapperboard, Download, ImagePlus, Library, Loader2, PenLine, Save, Sparkles, Wand2 } from "lucide-react";+import Link from "next/link";+import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";+import { toast } from "sonner";+import { downloadBlob } from "@/components/ads/render";+import { Panel, ToolShell } from "@/components/av/tool-shell";+import { useGeneration } from "@/components/av/use-generation";+import { openConnect } from "@/components/gpu/open-connect";+import { Feed } from "@/components/studio/feed";+import { ACCEPT, LibraryGrid } from "@/components/studio/media-slot";+import { Button } from "@/components/ui/button";+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";+import { Slider } from "@/components/ui/slider";+import { Switch } from "@/components/ui/switch";+import { Textarea } from "@/components/ui/textarea";+import { askToSignUp, uploadFile, useCreateGeneration, useGenerations, useHydrated, useIsAccount, useIsGuest, useIsOwner, useStatus } from "@/lib/api";+import type { Generation } from "@/lib/catalog/types";+import { DEFAULT_DEMO, type RelightDemo } from "@/lib/relight/demo";+import {+ INTENSITY_CHIPS,+ RELIGHT_BLEND_FEATURE,+ RELIGHT_BLEND_MODEL,+ RELIGHT_MAX_SIDE,+ RELIGHT_MODEL,+ RELIGHT_SCENE_FEATURE,+ RELIGHT_SETTINGS,+ relightRequest,+ sceneRequest,+ type BlendMode,+} from "@/lib/relight/engine";+import { drawGuide, guideSize } from "@/lib/relight/guide";+import {+ defaultLight,+ getLook,+ isLook,+ lightAt,+ lightsOfLook,+ LOOKS,+ lookFromLegacy,+ moveLight,+ promptFor,+ relightExtraOf,+ resultKey,+ seedFor,+ type Light,+ type LookId,+} from "@/lib/relight/lights";+import type { AlignFit } from "@/lib/relight/shader";+import { subjectDepthOf } from "@/lib/relight/shader";+import { responseError, toastError } from "@/lib/refusals";+import { alignPictures } from "./align-client";+import { Chips, LightPanel, LooksRow } from "./relight-panel";+import { fit, greyOf, loadPic, picSize, pixelsOf, RelightRenderer, type Pic } from "./relight-renderer";+import { RelightStage, type StageScene } from "./relight-stage";++/**+ * Relight (the app's own tool): tap the photo to place up to three coloured lights, see them land at once in the+ * browser, then Generate lighting makes the real thing on a GPU and Intensity blends it in, instantly. The page opens+ * on a demo photo with its result shipped, so everyone (guests too) can try the looks and the blend at once.+ */++export const HERO = "Light your photo like a set.";+export const SUB = "Tap to place a light, pick its colour and feel, then generate the real thing. Blend it in as softly or boldly as you like.";+const GUEST_LINE = "Create a free account to light your own photos.";+const NO_GPU_LINE = "Connect your GPU to generate the lighting.";+const HINT_KEY = "fuobe:relight-intensity-hint";++interface Photo {+ /** What results are cached by (and the seed comes from). */+ key: string;+ /** What the stage shows. */+ url: string;+ /** The stored file a run reads (null until uploaded; a guest's photo stays in the browser). */+ serverUrl: string | null;+ file?: File;+ demo?: RelightDemo;+ name: string;+ uploading?: boolean;+}++interface Result {+ url: string;+ pic?: Pic;+ fit?: AlignFit | null;+ genId?: string;+ /** Kept to the Library already (its file). */+ kept?: string;+ tiles?: number;+}++const demoPhoto = (d: RelightDemo): Photo => ({ key: d.photo, url: d.photo, serverUrl: null, demo: d, name: d.alt });+/** The key a demo's shipped result is cached under: its photo and the look it was made with. */+const demoKey = (d: RelightDemo) =>+ `${d.photo}#${resultKey({ prompt: promptFor(lightsOfLook(getLook(d.look)!), null, RELIGHT_SETTINGS.softness), variant: RELIGHT_SETTINGS.variant, seed: seedFor(d.photo), guide: RELIGHT_SETTINGS.guide })}`;+++function useFinePointer(): boolean {+ const [fine, setFine] = useState(false);+ useEffect(() => {+ const m = window.matchMedia?.("(pointer: fine)");+ if (!m) return;+ const on = () => setFine(m.matches);+ on();+ m.addEventListener("change", on);+ return () => m.removeEventListener("change", on);+ }, []);+ return fine;+}++/** The first image a run made, and its depth and matte (a scene read). */+const imageOut = (g?: Generation | null) => g?.outputs.find((o) => o.kind === "image" && !o.meta?.role)?.url ?? g?.outputs.find((o) => o.kind === "image")?.url;+const roleOut = (g: Generation | undefined | null, role: string) => g?.outputs.find((o) => o.meta?.role === role)?.url;+const firstImage = (g: Generation) => g.request?.inputs?.images?.[0];++/** A picture as a File (a demo photo sent to a run is uploaded first, like any other). */+async function fileFrom(url: string, name: string): Promise<File> {+ const res = await fetch(url);+ if (!res.ok) throw new Error("That picture didn't load");+ const blob = await res.blob();+ return new File([blob], name, { type: blob.type || "image/jpeg" });+}++/** A photo too big for a run, made smaller first (the blend keeps the original's detail). */+async function smallerFile(file: File, img: HTMLImageElement): Promise<File> {+ const [w, h] = picSize(img);+ if (Math.max(w, h) <= RELIGHT_MAX_SIDE) return file;+ const c = fit(img, RELIGHT_MAX_SIDE) as HTMLCanvasElement;+ const blob = await new Promise<Blob | null>((res) => c.toBlob(res, "image/jpeg", 0.95));+ return blob ? new File([blob], file.name.replace(/\.[^.]+$/, "") + ".jpg", { type: "image/jpeg" }) : file;+}++export function RelightTool({ app }: { app?: { name: string; description: string } }) {+ const hydrated = useHydrated();+ const guest = useIsGuest();+ const owner = useIsOwner();+ const account = useIsAccount();+ const status = useStatus().data;+ const gpu = !!status?.viewer?.gpu?.connected;+ const canRun = owner || (account && gpu);+ const fine = useFinePointer();+ const create = useCreateGeneration();++ const [photo, setPhoto] = useState<Photo>(() => demoPhoto(DEFAULT_DEMO));+ const [loaded, setLoaded] = useState<{ url: string; pic: HTMLImageElement } | null>(null);+ const [lights, setLights] = useState<Light[]>(() => lightsOfLook(getLook(DEFAULT_DEMO.look)!));+ const [selected, setSelected] = useState<string | null>("l1");+ const [intensity, setIntensity] = useState<number>(RELIGHT_SETTINGS.intensity);+ const [blend, setBlend] = useState<BlendMode>(RELIGHT_SETTINGS.blend);+ const [glowAsked, setGlowAsked] = useState<boolean | null>(null);+ const [override, setOverride] = useState<string | null>(null);+ const [sceneLoaded, setSceneLoaded] = useState<{ key: string; scene: StageScene } | null>(null);+ const [runId, setRunId] = useState<string | null>(null);+ const [sceneId, setSceneId] = useState<string | null>(null);+ const [aligning, setAligning] = useState(false);+ // The demo's shipped result, under the key of the look it was made with; then every result seen here.+ const [results, setResults] = useState<Map<string, Result>>(() => new Map([[demoKey(DEFAULT_DEMO), { url: DEFAULT_DEMO.relit }]]));+ const [relit, setRelit] = useState<{ key: string; pic: Pic; fit: AlignFit | null } | null>(null);+ const [hint, setHint] = useState<string | null>(null);+ const [showIntensityHint, setShowIntensityHint] = useState(false);+ const [painted, setPainted] = useState<number | null>(null);+ const [startedAt, setStartedAt] = useState<number | null>(null);+ const [took, setTook] = useState<number | null>(null);+ const [saving, setSaving] = useState<"keep" | "download" | null>(null);+ const sceneAsked = useRef(new Set<string>());+ const inputId = useId();+ const promptId = useId();+ const glowId = useId();++ const seed = useMemo(() => seedFor(photo.key), [photo.key]);+ const look: LookId | null = useMemo(() => LOOKS.find((l) => isLook(lights, l))?.id ?? null, [lights]);+ const prompt = promptFor(lights, override, RELIGHT_SETTINGS.softness);+ const key = `${photo.key}#${resultKey({ prompt, variant: RELIGHT_SETTINGS.variant, seed, guide: RELIGHT_SETTINGS.guide })}`;+ const img = loaded?.url === photo.url ? loaded.pic : null;+ const showing = relit?.key === key ? relit : null;+ const glow = glowAsked ?? !showing;++ // The photo's picture.+ useEffect(() => {+ let live = true;+ loadPic(photo.url)+ .then((pic) => live && setLoaded({ url: photo.url, pic }))+ .catch(() => live && toast.error("That picture didn't load"));+ return () => {+ live = false;+ };+ }, [photo.url]);++ // The run going now.+ const run = useGeneration(runId);+ const g = run.data;+ // Earlier runs on this photo (this session or before) and the one just made: their results come back without a run.+ const earlier = useGenerations({ models: [RELIGHT_MODEL], statuses: ["succeeded"], limit: 30 });+ const fromRuns = useMemo(() => {+ const m = new Map<string, Result>();+ if (!photo.serverUrl) return m;+ for (const r of [...(g?.status === "succeeded" ? [g] : []), ...(earlier.data ?? [])]) {+ const out = imageOut(r);+ const ex = relightExtraOf(r.request?.params?.extra);+ if (!out || !ex || firstImage(r) !== photo.serverUrl || !r.request.prompt) continue;+ const k = `${photo.key}#${resultKey({ prompt: r.request.prompt, variant: ex.variant, seed: ex.seed, guide: ex.guide })}`;+ if (!m.has(k)) m.set(k, { url: out, genId: r.id });+ }+ return m;+ }, [g, earlier.data, photo.serverUrl, photo.key]);+ const current = results.get(key) ?? fromRuns.get(key);+ const anyResult = useMemo(() => [...results.keys(), ...fromRuns.keys()].some((k) => k.startsWith(`${photo.key}#`)), [results, fromRuns, photo.key]);++ // The result for these lights, when there is one: loaded and lined up once, then instant.+ useEffect(() => {+ if (!current || !img) return;+ let live = true;+ (async () => {+ let pic = current.pic;+ let fitOf = current.fit;+ if (!pic) pic = await loadPic(current.url);+ if (fitOf === undefined) {+ setAligning(true);+ const a = photo.demo ? null : await alignPictures(img, pic).catch(() => null);+ fitOf = a?.fit ?? null;+ setResults((m) => new Map(m).set(key, { ...current, pic, fit: fitOf, tiles: a?.tiles }));+ setAligning(false);+ }+ if (live) setRelit({ key, pic, fit: fitOf ?? null });+ })().catch(() => {+ setAligning(false);+ });+ return () => {+ live = false;+ };+ }, [current, img, key, photo.demo]);++ // The run finished: what follows it, once (its result comes in through fromRuns).+ useEffect(() => {+ if (!g || g.id !== runId) return;+ if (g.status === "succeeded") {+ if (imageOut(g)) {+ // eslint-disable-next-line react-hooks/set-state-in-effect -- the run's end is an outside event+ setGlowAsked(null);+ if (startedAt) setTook((Date.now() - startedAt) / 1000);+ try {+ if (!localStorage.getItem(HINT_KEY)) {+ setShowIntensityHint(true);+ localStorage.setItem(HINT_KEY, "1");+ }+ } catch {}+ }+ setRunId(null);+ } else if (g.status === "failed") {+ setRunId(null);+ toast.error(g.error ?? "The lighting didn't come out. Please try again.");+ }+ }, [g, runId, startedAt]);++ // The scene read: once per stored photo, on the viewer's own GPU (or the studio's for its owner).+ const scenes = useGenerations({ features: [RELIGHT_SCENE_FEATURE], statuses: ["succeeded"], limit: 30, steps: true }, {});+ const sceneRun = useGeneration(sceneId);+ const sceneGen = useMemo(() => {+ if (sceneRun.data?.status === "succeeded" && firstImage(sceneRun.data) === photo.serverUrl) return sceneRun.data;+ return photo.serverUrl ? scenes.data?.find((s) => firstImage(s) === photo.serverUrl) : undefined;+ }, [sceneRun.data, scenes.data, photo.serverUrl]);+ useEffect(() => {+ const url = photo.serverUrl;+ if (!url || !canRun || sceneGen || !scenes.isFetched || sceneAsked.current.has(url)) return;+ sceneAsked.current.add(url);+ create.mutate(sceneRequest(url), {+ onSuccess: (items) => setSceneId(items[0]?.id ?? null),+ // The preview stays flat: nothing to say to the visitor.+ onError: () => {},+ });+ // create is stable enough; a new photo or viewer asks again.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [photo.serverUrl, canRun, sceneGen, scenes.isFetched]);+ const sceneUrls = useMemo(() => {+ if (photo.demo?.depth && photo.demo.matte) return { depth: photo.demo.depth, matte: photo.demo.matte };+ const depth = roleOut(sceneGen, "depth");+ const matte = roleOut(sceneGen, "matte");+ return depth && matte ? { depth, matte } : null;+ }, [photo.demo, sceneGen]);+ const sceneKey = sceneUrls ? `${sceneUrls.depth}|${sceneUrls.matte}` : null;+ const scene = sceneLoaded && sceneLoaded.key === sceneKey ? sceneLoaded.scene : null;+ useEffect(() => {+ if (!sceneUrls || !sceneKey) return;+ let live = true;+ Promise.all([loadPic(sceneUrls.depth), loadPic(sceneUrls.matte)])+ .then(([depth, matte]) => {+ if (!live) return;+ const d = greyOf(depth, 128, 128);+ const m = greyOf(matte, 128, 128);+ setSceneLoaded({ key: sceneKey, scene: { depth, matte, subjectDepth: subjectDepthOf(d, m) } });+ })+ .catch(() => {});+ return () => {+ live = false;+ };+ }, [sceneUrls, sceneKey]);++ // ?image= from the Library, Edit or Live edit (and ?gen= puts that run's lights back), read once.+ useEffect(() => {+ const q = new URLSearchParams(window.location.search);+ const url = q.get("image");+ const gen = q.get("gen");+ if (url?.startsWith("/api/files/")) {+ // eslint-disable-next-line react-hooks/set-state-in-effect -- the address is read once after hydration+ setPhoto({ key: url, url, serverUrl: url, name: decodeURIComponent(url.split("/").pop() ?? "Photo") });+ }+ if (gen && /^[\w-]{4,40}$/.test(gen)) {+ fetch(`/api/generations/${gen}`)+ .then((r) => (r.ok ? (r.json() as Promise<Generation>) : null))+ .then((prev) => {+ // A run of this tool (its lights), or of the Relight app before it (its look).+ if (!prev || (prev.presetId !== "app-relight" && !relightExtraOf(prev.request?.params?.extra))) return;+ const ex = relightExtraOf(prev.request?.params?.extra);+ const old = lookFromLegacy(prev.request?.presetOptions?.light);+ const ls = ex?.lights ?? (old ? lightsOfLook(old) : null);+ if (ls?.length) {+ setLights(ls);+ setSelected(ls[0].id);+ }+ if (ex?.typed && prev.request.prompt) setOverride(prev.request.prompt);+ })+ .catch(() => {});+ }+ }, []);++ const changeLights = (next: Light[]) => {+ setLights(next);+ setShowIntensityHint(false);+ };+ const updateLight = (l: Light) => changeLights(lights.map((x) => (x.id === l.id ? l : x)));+ const removeLight = (id: string) => {+ const next = lights.filter((l) => l.id !== id);+ changeLights(next);+ setSelected(next[0]?.id ?? null);+ };+ const addAt = (x: number, y: number) => {+ // An empty spot gets a new light (a tap on a light selects it: the stage handles that).+ const l = lightAt(lights, x, y);+ if (!l) return void toast("Up to 3 lights. Tap one to move or change it.");+ changeLights([...lights, l]);+ setSelected(l.id);+ };+ const addDefault = () => {+ const l = defaultLight(lights);+ if (!l) return;+ changeLights([...lights, l]);+ setSelected(l.id);+ };+ const pickLook = (id: LookId) => {+ const lk = getLook(id);+ if (!lk) return;+ const ls = lightsOfLook(lk);+ changeLights(ls);+ setSelected(ls[0]?.id ?? null);+ setOverride(null);+ };++ const takeFile = async (f: File | undefined) => {+ if (!f) return;+ if (!f.type.startsWith("image/")) return void toast("Pick a photo (PNG, JPEG or WebP)");+ const url = URL.createObjectURL(f);+ const p: Photo = { key: `file:${f.name}:${f.size}:${f.lastModified}`, url, serverUrl: null, file: f, name: f.name, uploading: canRun };+ setPhoto(p);+ setRelit(null);+ setRunId(null);+ if (!lights.length) addDefaultFor();+ if (!canRun) return;+ try {+ const pic = await loadPic(url);+ const asset = await uploadFile(await smallerFile(f, pic));+ setPhoto((cur) => (cur.key === p.key ? { ...cur, serverUrl: asset.url, uploading: false } : cur));+ } catch (e) {+ setPhoto((cur) => (cur.key === p.key ? { ...cur, uploading: false } : cur));+ toastError(e);+ }+ };+ const addDefaultFor = () => {+ const ls = lightsOfLook(getLook("golden-hour")!);+ setLights(ls);+ setSelected(ls[0].id);+ };++ /** The stored file a run reads: uploads the photo first when it isn't stored yet. */+ const ensureServerPhoto = async (): Promise<string> => {+ if (photo.serverUrl) return photo.serverUrl;+ const file = photo.file ?? (await fileFrom(photo.url, `${photo.demo?.id ?? "photo"}.jpg`));+ const asset = await uploadFile(img ? await smallerFile(file, img) : file);+ setPhoto((cur) => (cur.key === photo.key ? { ...cur, serverUrl: asset.url } : cur));+ return asset.url;+ };++ /** The light-guide picture, stored (only when the engine takes it). */+ const guideFile = async (): Promise<string | null> => {+ if (!RELIGHT_SETTINGS.guide || !img) return null;+ const [w, h] = picSize(img);+ const s = guideSize(w, h);+ const px = pixelsOf(img, s.width, s.height);+ const matte = scene ? greyOf(scene.matte, s.width, s.height) : null;+ const out = drawGuide(px, s.width, s.height, lights, matte);+ const c = document.createElement("canvas");+ c.width = s.width;+ c.height = s.height;+ c.getContext("2d")!.putImageData(new ImageData(out, s.width, s.height), 0, 0);+ const blob = await new Promise<Blob | null>((res) => c.toBlob(res, "image/png"));+ if (!blob) return null;+ return (await uploadFile(new File([blob], "light-guide.png", { type: "image/png" }))).url;+ };++ const generate = useCallback(async () => {+ if (!lights.length) return void toast("Place a light first: tap the photo");+ if (guest) {+ setHint(GUEST_LINE);+ return void askToSignUp("run");+ }+ if (account && !gpu) {+ setHint(NO_GPU_LINE);+ return void openConnect();+ }+ if (current) return;+ setHint(null);+ try {+ const url = await ensureServerPhoto();+ const guide = await guideFile();+ const req = relightRequest({ photo: url, guide, lights, look: look ?? undefined, promptOverride: override, seed });+ setStartedAt(Date.now());+ setTook(null);+ create.mutate(req, {+ onSuccess: (items) => setRunId(items[0]?.id ?? null),+ onError: (e) => toastError(e),+ });+ } catch (e) {+ toastError(e);+ }+ // The values it reads are listed; the helpers read the same state.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [lights, guest, account, gpu, current, look, override, seed, photo, img, scene]);++ /** The blend at the photo's full size, as a PNG. */+ const renderFull = async (): Promise<Blob> => {+ if (!img || !showing) throw new Error("Nothing to save yet");+ const c = document.createElement("canvas");+ const r = new RelightRenderer(c);+ try {+ const [w, h] = picSize(img);+ const s = Math.min(1, r.maxSize / Math.max(w, h));+ const W = Math.round(w * s);+ const H = Math.round(h * s);+ r.set("uPhoto", fit(img, r.maxSize));+ r.set("uRelit", showing.pic);+ if (scene) {+ r.set("uDepth", scene.depth);+ r.set("uMatte", scene.matte);+ }+ r.draw(+ {+ lights,+ intensity,+ aspect: w / h,+ scene: { hasScene: !!scene, subjectDepth: scene?.subjectDepth ?? 0.5 },+ mode: "result",+ blend,+ glow: false,+ original: false,+ align: showing.fit ?? undefined,+ ambient: RELIGHT_SETTINGS.ambient,+ },+ W,+ H,+ );+ const blob = await new Promise<Blob | null>((res) => c.toBlob(res, "image/png"));+ if (!blob) throw new Error("Couldn't make the picture");+ return blob;+ } finally {+ r.dispose();+ }+ };+ const stamp = () => new Date().toISOString().slice(0, 16).replace(/[:T]/g, "-");+ const download = async () => {+ setSaving("download");+ try {+ downloadBlob(await renderFull(), `relight-${stamp()}.png`);+ } catch (e) {+ toastError(e);+ } finally {+ setSaving(null);+ }+ };+ /** Keeps the blend: the owner's Library (a local result), an account's own uploads. Returns its file. */+ const keep = async (): Promise<string | null> => {+ if (current?.kept) return current.kept;+ setSaving("keep");+ try {+ const file = new File([await renderFull()], `relight-${stamp()}.png`, { type: "image/png" });+ const asset = await uploadFile(file);+ if (owner) {+ const res = await fetch("/api/generations/local", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({+ feature: RELIGHT_BLEND_FEATURE,+ modelId: RELIGHT_BLEND_MODEL,+ op: "relight",+ prompt: promptFor(lights, override, RELIGHT_SETTINGS.softness),+ inputs: { images: [photo.serverUrl ?? asset.url] },+ params: { extra: { relight: { lights, ...(look && { look }), seed, variant: RELIGHT_SETTINGS.variant, intensity, blend, ...(current?.genId && { parent: current.genId }) } } },+ output: { url: asset.url, kind: "image", contentType: "image/png" },+ }),+ });+ if (!res.ok) throw responseError(res, ((await res.json().catch(() => ({}))) as { error?: string }).error ?? "Couldn't save");+ }+ setResults((m) => (current ? new Map(m).set(key, { ...current, kept: asset.url }) : m));+ toast.success("Saved to your Library");+ return asset.url;+ } catch (e) {+ toastError(e);+ return null;+ } finally {+ setSaving(null);+ }+ };+ const keepThen = async (to: (url: string) => string) => {+ const url = await keep();+ if (url) window.location.assign(to(url));+ };++ const busy = !!runId || create.isPending;+ const sceneBusy = !!sceneId && sceneRun.data?.status !== "succeeded" && sceneRun.data?.status !== "failed";+ const line = busy ? "Lighting your photo…" : aligning ? "Lining it up…" : sceneBusy ? "Reading the scene…" : photo.uploading ? "Uploading…" : null;+ const keeper = owner || (account && gpu);+ const changed = anyResult && !current;+ const [pw, ph] = img ? picSize(img) : [photo.demo?.width ?? 4, photo.demo?.height ?? 3];++ return (+ <ToolShell+ title={app ? "Apps" : "Relight"}+ engineSwitch={false}+ wide+ header={+ app ? (+ <nav aria-label="Breadcrumb" className="hidden items-center gap-1 text-[13px] text-muted-foreground sm:flex">+ <Link href="/apps" className="hover:text-foreground">+ Apps+ </Link>+ <ChevronRight className="size-3.5" />+ <span className="text-foreground">{app.name}</span>+ </nav>+ ) : undefined+ }+ >+ <div className="pt-3 pb-2 sm:pt-6">+ <h2 className="font-heading text-[26px] leading-tight text-balance sm:text-[34px]">{HERO}</h2>+ <p className="mt-1 hidden max-w-2xl text-[13px] text-pretty text-muted-foreground sm:block">{SUB}</p>+ </div>+ <div className="grid gap-4 lg:grid-cols-[minmax(0,1fr)_380px] lg:items-start">+ <div className="space-y-2 max-lg:sticky max-lg:top-14 max-lg:z-10 max-lg:-mx-3 max-lg:bg-background/95 max-lg:px-3 max-lg:pb-2 max-lg:backdrop-blur lg:sticky lg:top-20">+ <div className="mx-auto w-full max-lg:max-w-[calc(40svh*var(--ar))]" style={{ "--ar": String(pw / Math.max(1, ph)) } as React.CSSProperties}>+ <RelightStage+ photo={img}+ alt={photo.demo?.alt ?? "Your photo"}+ relit={showing?.pic ?? null}+ align={showing?.fit ?? null}+ scene={scene}+ lights={lights}+ selected={selected}+ intensity={intensity}+ blend={blend}+ glow={glow}+ ambient={RELIGHT_SETTINGS.ambient}+ status={line}+ working={busy}+ onTap={addAt}+ onSelect={setSelected}+ onMove={(id, x, y) => {+ const l = lights.find((o) => o.id === id);+ if (l) updateLight(moveLight(l, x, y));+ }}+ onRemove={removeLight}+ onAddDefault={addDefault}+ onGenerate={() => void generate()}+ onOpenLight={() => document.getElementById("relight-light-panel")?.scrollIntoView({ behavior: "smooth", block: "nearest" })}+ onPainted={(ms) => setPainted(ms)}+ />+ </div>+ <div className="flex flex-wrap items-center gap-2 text-[12px] text-muted-foreground">+ <span className="max-sm:hidden">{fine ? "Click to place a light. Drag to move it." : "Tap the photo to place a light"}</span>+ <span className="sm:hidden">Tap the photo to place a light · hold to see the original</span>+ {changed && (+ <span className="inline-flex items-center gap-1.5 rounded-full bg-brand-faint px-2.5 py-1 text-[12px] font-medium text-brand-text" data-testid="lights-changed">+ Lights changed+ <button type="button" className="underline underline-offset-2" onClick={() => void generate()} disabled={busy}>+ Generate again+ </button>+ </span>+ )}+ {owner && (+ <span className="ml-auto font-mono text-[11px]" data-testid="relight-owner-status">+ {RELIGHT_SETTINGS.variant}+ {took ? ` · ${took.toFixed(1)} s` : ""}+ {current?.tiles ? ` · ${current.tiles} tiles` : ""}+ {showing?.fit ? ` · shift ${(showing.fit.tx * pw).toFixed(1)}, ${(showing.fit.ty * ph).toFixed(1)} px` : ""}+ {scene ? " · depth" : " · flat"}+ {painted !== null ? ` · ${painted.toFixed(1)} ms` : ""}+ </span>+ )}+ </div>+ </div>++ <div className="space-y-3">+ <Panel>+ <div className="space-y-4">+ <div className="flex flex-wrap items-center gap-2">+ <Button variant="outline" className="h-11 rounded-full sm:h-9" onClick={() => document.getElementById(inputId)?.click()}>+ <ImagePlus className="size-3.5" /> Use your photo+ </Button>+ {hydrated && !guest && (+ <Popover>+ <PopoverTrigger asChild>+ <Button variant="ghost" className="h-11 rounded-full sm:h-9">+ <Library className="size-3.5" /> From your Library+ </Button>+ </PopoverTrigger>+ <PopoverContent className="w-[min(92vw,360px)] p-2" collisionPadding={12}>+ <LibraryGrid+ kinds={["image"]}+ onPick={(v) => {+ if (!v.ref.startsWith("/api/files/")) return;+ setPhoto({ key: v.ref, url: v.ref, serverUrl: v.ref, name: v.name ?? "Photo" });+ setRelit(null);+ if (!lights.length) addDefaultFor();+ }}+ />+ </PopoverContent>+ </Popover>+ )}+ {!photo.demo && (+ <Button+ variant="ghost"+ className="h-11 rounded-full text-muted-foreground sm:h-9"+ onClick={() => {+ setPhoto(demoPhoto(DEFAULT_DEMO));+ pickLook(DEFAULT_DEMO.look);+ }}+ >+ Back to the sample+ </Button>+ )}+ <input+ id={inputId}+ type="file"+ accept={ACCEPT.image}+ hidden+ onChange={(e) => {+ void takeFile(e.target.files?.[0]);+ e.target.value = "";+ }}+ />+ </div>+ <LooksRow look={look} onLook={pickLook} />+ {!look && lights.length > 0 && <p className="-mt-2 text-[12px] text-muted-foreground">Your lights</p>}+ </div>+ </Panel>++ <Panel title="Light">+ <LightPanel lights={lights} selected={selected} onSelect={setSelected} onChange={updateLight} onRemove={removeLight} onAdd={addDefault} fine={fine} />+ </Panel>++ <Panel title="Intensity" aside={<span className="font-mono text-[12px] text-muted-foreground tabular-nums">{Math.round(intensity * 100)} %</span>}>+ <div className="space-y-3">+ <Chips+ label="Intensity"+ value={(INTENSITY_CHIPS as readonly number[]).includes(intensity) ? intensity : null}+ options={INTENSITY_CHIPS.map((v) => ({ value: v, label: `${Math.round(v * 100)} %` }))}+ onChange={setIntensity}+ />+ {fine && (+ <Slider aria-label="Intensity" aria-valuetext={`${Math.round(intensity * 100)} %`} min={0} max={100} step={1} value={[Math.round(intensity * 100)]} onValueChange={([v]) => setIntensity(v / 100)} />+ )}+ {showIntensityHint && <p className="text-[12px] text-muted-foreground">Intensity mixes your original with the new light. It changes instantly.</p>}+ <div className="flex min-h-11 items-center gap-2">+ <Switch id={glowId} checked={glow} onCheckedChange={setGlowAsked} />+ <label htmlFor={glowId} className="text-[13px]">+ Glow+ </label>+ </div>+ {owner && (+ <Chips+ label="Blend"+ value={blend}+ options={[+ { value: "transfer" as BlendMode, label: "Light transfer" },+ { value: "mix" as BlendMode, label: "Plain mix" },+ ]}+ onChange={setBlend}+ />+ )}+ </div>+ </Panel>++ <details className="group rounded-2xl border bg-background p-3 shadow-soft sm:p-4">+ <summary className="flex min-h-11 cursor-pointer list-none items-center gap-2 text-[13px] font-semibold sm:min-h-0">+ <label htmlFor={promptId} className="cursor-pointer">+ Prompt+ </label>+ <span className="rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground">{override?.trim() ? "edited" : "auto"}</span>+ </summary>+ <Textarea+ id={promptId}+ className="mt-3 min-h-28 text-[13px]"+ value={override ?? promptFor(lights, null, RELIGHT_SETTINGS.softness)}+ onChange={(e) => setOverride(e.target.value)}+ />+ {override !== null && (+ <Button variant="ghost" size="sm" className="mt-2 rounded-full" onClick={() => setOverride(null)}>+ <Wand2 className="size-3.5" /> Back to auto+ </Button>+ )}+ </details>++ <div className="space-y-2">+ <Button size="lg" className="h-12 w-full rounded-full" onClick={() => void generate()} disabled={busy || !lights.length || photo.uploading}>+ {busy ? <Loader2 className="size-4 animate-spin" /> : current ? <Check className="size-4" /> : <Sparkles className="size-4" />}+ {busy ? "Lighting your photo…" : current ? "Lit with these lights" : changed ? "Generate again" : "Generate lighting"}+ </Button>+ {hint && (+ <p className="text-center text-[12px] text-muted-foreground" role="status">+ {hint}+ </p>+ )}+ </div>++ {showing && (+ <Panel title="Your lit photo">+ <div className="flex flex-wrap gap-2">+ {keeper && (+ <Button className="h-11 rounded-full sm:h-9" onClick={() => void keep()} disabled={!!saving || !!current?.kept}>+ {saving === "keep" ? <Loader2 className="size-3.5 animate-spin" /> : current?.kept ? <Check className="size-3.5" /> : <Save className="size-3.5" />}+ {current?.kept ? "Kept" : "Keep"}+ </Button>+ )}+ <Button variant="outline" className="h-11 rounded-full sm:h-9" onClick={() => void download()} disabled={!!saving}>+ {saving === "download" ? <Loader2 className="size-3.5 animate-spin" /> : <Download className="size-3.5" />} Download+ </Button>+ {keeper && (+ <>+ <Button variant="outline" className="h-11 rounded-full sm:h-9" onClick={() => void keepThen((u) => `/edit?image=${encodeURIComponent(u)}`)} disabled={!!saving}>+ <PenLine className="size-3.5" /> Edit+ </Button>+ <Button+ variant="outline"+ className="h-11 rounded-full sm:h-9"+ onClick={() => void keepThen((u) => `/live-edit?image=${encodeURIComponent(u)}${current?.genId ? `&gen=${encodeURIComponent(current.genId)}` : ""}&from=relight`)}+ disabled={!!saving}+ >+ <Wand2 className="size-3.5" /> Live edit+ </Button>+ <Button variant="outline" className="h-11 rounded-full sm:h-9" onClick={() => void keepThen((u) => `/video?image=${encodeURIComponent(u)}`)} disabled={!!saving}>+ <Clapperboard className="size-3.5" /> Animate+ </Button>+ </>+ )}+ </div>+ </Panel>+ )}+ </div>+ </div>+ <Results />+ </ToolShell>+ );+}++/** Earlier lightings (and kept blends). */+function Results() {+ const items = useGenerations({ models: [RELIGHT_MODEL, RELIGHT_BLEND_MODEL], limit: 12 });+ if (!items.data?.length) return null;+ return (+ <section className="mx-auto mt-10 max-w-[1240px]" aria-labelledby="relight-results">+ <h3 id="relight-results" className="mb-3 font-heading text-[22px]">+ Your lit photos+ </h3>+ <Feed items={items.data} />+ </section>+ );+}+diff --git a/src/components/studio/result-actions.tsx b/src/components/studio/result-actions.tsxindex 94c37c5d..5c8c1ef7 100644--- a/src/components/studio/result-actions.tsx+++ b/src/components/studio/result-actions.tsx@@ -17,6 +17,7 @@ import {FolderDown,Heart,ImagePlus,+ Lamp,Layers2,Palette,LayoutDashboard,@@ -86,6 +87,7 @@ export const ACTION_ICONS: Record<OutputActionId, LucideIcon> = {upscale: ZoomIn,reference: ImagePlus,grade: SlidersHorizontal,+ relight: Lamp,layers: Layers2,"edit-layout": LayoutDashboard,"save-character": UserRoundPlus,diff --git a/src/lib/catalog/apps.ts b/src/lib/catalog/apps.tsindex 5c0c7960..060a3364 100644--- a/src/lib/catalog/apps.ts+++ b/src/lib/catalog/apps.ts@@ -445,9 +445,12 @@ export const APPS: Preset[] = [app({name: "Relight",category: "Camera",- description: "Change the lighting of any photo",+ description: "Place coloured lights on your photo and watch them land",icon: "Lamp",hue: 50,+ // Its page is its own tool (tap to place lights, a live preview, Generate lighting, an Intensity blend:+ // src/components/relight). The options and words below stay for the composer route the planner and Canvas use.+ tool: "relight",options: [opt("light", "Lighting", [["Golden hour", "warm golden hour sunlight"],diff --git a/src/lib/catalog/canvas.ts b/src/lib/catalog/canvas.tsindex 97572ba4..2c151f98 100644--- a/src/lib/catalog/canvas.ts+++ b/src/lib/catalog/canvas.ts@@ -349,7 +349,7 @@ export function nodeLabel(n: Pick<CanvasNode, "type" | "data">): string {* Ops the canvas can't feed (masks, browser-only tools, multi-speaker scripts, draft finishing, and* inputs it has no port for: a 3D model to rig, a list of audio clips to join).*/-const UNSUPPORTED_OPS = new Set<Operation>(["grade", "inpaint", "finalize", "dialogue", "rig-3d", "audio-join"]);+const UNSUPPORTED_OPS = new Set<Operation>(["grade", "relight", "inpaint", "finalize", "dialogue", "rig-3d", "audio-join"]);/** Models that only run on a painted mask or clicked points (VACE inpaint, Bria's point eraser): the canvas has neither. */const needsMarks = (m: ModelDef) => !!(m.options.requires?.mask || m.options.requires?.points);diff --git a/src/lib/catalog/models.ts b/src/lib/catalog/models.tsindex d89a72a6..d82c62b7 100644--- a/src/lib/catalog/models.ts+++ b/src/lib/catalog/models.ts@@ -1149,6 +1149,33 @@ const open: ModelDef[] = [options: { seed: true, negativePrompt: true, maxImages: 2 },hidden: true,}),+ // The Relight tool's Generate lighting (src/components/relight): the photo plus the words written from the placed+ // lights, a picture lit only by those lights that the page blends in. Image 2 is the light-guide picture, when sent.+ o({+ id: "oss-qwen-image-21-relight",+ // Its runs show this name in the Library: plain, as the tool says it (the engine is in the tagline and the licence).+ name: "Relight",+ vendor: "Alibaba Qwen",+ family: "qwen-image",+ kind: "image",+ tagline: "Relight with placed lights: Qwen-Image 2.1 with Viggle's 6-step speed LoRA · 24 GB GPU · non-commercial weights",+ routes: [{ ...comfy("edit", "qwen-image-21-relight", "6 steps, about 1 MP"), unsized: true }],+ options: { seed: true, maxImages: 2 },+ hidden: true,+ }),+ // Its scene read, once per photo: a depth map (Depth Anything 3) and the subject's matte (BiRefNet) for the page's+ // depth-true preview. A helper step: the Library leaves its runs out.+ o({+ id: "oss-relight-scene",+ name: "Relight scene read",+ vendor: "Open source",+ family: "birefnet",+ kind: "image",+ tagline: "Depth and subject cut-out for the Relight preview",+ routes: [comfy("bg-remove", "relight-scene-read")],+ options: { maxImages: 1 },+ hidden: true,+ }),o({id: "oss-qwen-next-scene",name: "Qwen-Image-Edit Next Scene",@@ -2425,6 +2452,19 @@ const local: ModelDef[] = [options: {},hidden: true,},+ // Relight: a photo blended with its relit picture at the chosen Intensity, kept from the browser.+ {+ id: "local-relight",+ name: "Relight blend",+ vendor: "Fuobe",+ family: "local",+ engine: "open",+ kind: "image",+ tagline: "The relit picture blended into the original in your browser",+ routes: [{ op: "relight", provider: "local", endpoint: "webgl" }],+ options: {},+ hidden: true,+ },// Ads Studio: a creative composited over its visual (headline, copy, CTA, logo in the brand fonts), saved from the browser.{id: "local-ad-compose",diff --git a/src/lib/catalog/types.ts b/src/lib/catalog/types.tsindex 7a45a35e..41dff2ba 100644--- a/src/lib/catalog/types.ts+++ b/src/lib/catalog/types.ts@@ -39,6 +39,7 @@ export type Operation =| "interpolate"| "extend" // video → the same clip, continued| "grade" // colour grade, rendered in the browser+ | "relight" // the Relight tool's blend of a photo and its relit picture, rendered in the browser| "reframe" // video → same video at a new aspect ratio (AI-filled edges)| "finalize" // draft video → full-quality render of the same take| "dialogue" // several speakers → one audio track@@ -113,6 +114,7 @@ export const OPERATION_LABELS: Record<Operation, string> = {interpolate: "Frame interpolation",extend: "Extend video",grade: "Color grade",+ relight: "Relight",reframe: "Reframe",finalize: "Final render",dialogue: "Dialogue",@@ -184,6 +186,7 @@ export const OPERATION_OUTPUT: Record<Operation, MediaKind> = {interpolate: "video",extend: "video",grade: "image",+ relight: "image",reframe: "video",finalize: "video",dialogue: "audio",@@ -1396,8 +1399,8 @@ export interface Preset {grade?: string;/** Fuobe DoP's relight effects: a step that makes the start frame first, on each engine (src/lib/catalog/dop.ts). */prestep?: PresetPrestep;- /** An app that is a tool of its own: its page renders that tool rather than the composer (Clean up voice). */- tool?: "clean-voice";+ /** An app that is a tool of its own: its page renders that tool rather than the composer (Clean up voice, Relight). */+ tool?: "clean-voice" | "relight";/** The recipe its preview was made with (src/lib/catalog/preset-recipe-book.json): the route it opens on follows it. */recipe?: PresetRecipeBook;}diff --git a/src/lib/comfy-install.ts b/src/lib/comfy-install.tsindex b2921a3b..8df675da 100644--- a/src/lib/comfy-install.ts+++ b/src/lib/comfy-install.ts@@ -28,6 +28,12 @@ export function pinnedRepo(url: string): { repo: string; ref: string; dir?: strireturn m ? { repo: m[1], ref: m[2], ...(m[3] ? { dir: m[3] } : {}) } : undefined;}+/** A node file in a Hugging Face repo at a commit (…/resolve/<sha>/<path>.py): the repo, the commit and the file. */+export function hfNodeFile(url: string): { repo: string; ref: string; file: string } | undefined {+ const m = /^(https:\/\/huggingface\.co\/[\w.-]+\/[\w.-]+)\/resolve\/([0-9a-f]{40})\/([\w./-]+\.py)$/.exec(url);+ return m ? { repo: m[1], ref: m[2], file: m[3] } : undefined;+}+/*** The commands that install one node pack into $COMFYUI/custom_nodes/<name>, safe to run again, as* scripts/comfy/install-comfyui.sh does. git can't clone a /tree/ page address, so a pinned pack is cloned from its@@ -36,6 +42,10 @@ export function pinnedRepo(url: string): { repo: string; ref: string; dir?: stri* already there.*/export function nodeInstall(node: { name: string; repo: string }): string {+ // One node file in a Hugging Face model repo, at a commit (Viggle's viggle_turbo.py): downloaded as the package's+ // __init__.py, never cloned (the repo holds gigabytes of weights).+ const file = hfNodeFile(node.repo);+ if (file) return `mkdir -p "$COMFYUI/custom_nodes/${node.name}" && wget -c -O "$COMFYUI/custom_nodes/${node.name}/__init__.py" "${node.repo}"`;const pin = pinnedRepo(node.repo);if (!pin) return `git -C "$COMFYUI/custom_nodes" clone ${node.repo}`;const dest = `"$COMFYUI/custom_nodes/${node.name}"`;diff --git a/src/lib/gpu/commands.ts b/src/lib/gpu/commands.tsindex 6d074a09..446b309c 100644--- a/src/lib/gpu/commands.ts+++ b/src/lib/gpu/commands.ts@@ -127,6 +127,12 @@ function packLines(shell: Shell, l: Layout, name: string, p: IndexPack, kind: Stconst req = l.under(shell, "custom_nodes", name, "requirements.txt");const pip = p.requirementsTxt ? [`${py} -m pip install -r ${req}`] : [];if (kind === "pack-repair") return [comment(shell, `${name} didn't start. Reinstall its Python packages, then restart ComfyUI`), ...pip];+ if (p.file) {+ // One node file in a model repo: fetched at the commit, as the package's __init__.py.+ const url = `${p.repo}/resolve/${p.commit}/${p.file}`;+ if (!plain(p.file) || !/\.py$/.test(p.file) || !PLAIN_URL.test(url)) return [comment(shell, `Install ${name} by hand: ${p.repo}`)];+ return [...download(shell, dest, l.under(shell, "custom_nodes", name, "__init__.py"), url, "", kind === "pack-update"), ...pip];+ }if (kind === "pack-update") return [`git -C ${dest} fetch origin`, `git -C ${dest} checkout ${p.commit}`, ...pip];if (p.subdir && plain(p.subdir)) {const src = l.under(shell, "custom_nodes", `.${name}-src`);diff --git a/src/lib/gpu/plan.ts b/src/lib/gpu/plan.tsindex 9b8b6df2..a4c27c2f 100644--- a/src/lib/gpu/plan.ts+++ b/src/lib/gpu/plan.ts@@ -49,7 +49,7 @@ export function whyOf(n: Need, inv: GpuInventory | null, idx: RequirementIndex,case "pack-install": {const p = n.pack ? idx.packs[n.pack] : undefined;if (noManager) return "no-manager";- if (p?.subdir) return "subfolder-pack";+ if (p?.subdir || p?.file) return "subfolder-pack";if (!p?.registry?.version) return "no-validated-version";return "manual-only";}diff --git a/src/lib/gpu/types.ts b/src/lib/gpu/types.tsindex b29fdbf9..5010297a 100644--- a/src/lib/gpu/types.ts+++ b/src/lib/gpu/types.ts@@ -46,6 +46,11 @@ export interface IndexPack {isolated: boolean;/** A pack that lives in a subfolder of its repo (h3_character_swap). */subdir?: string;+ /**+ * A pack that is one node file in a Hugging Face model repo (Viggle's viggle_turbo.py, next to the LoRAs): downloaded+ * at the commit into custom_nodes/<name>/__init__.py, never cloned (the repo holds gigabytes of weights).+ */+ file?: string;requirementsTxt: boolean;install: "registry" | "manual";}diff --git a/src/lib/licences.ts b/src/lib/licences.tsindex 69811577..f828bb88 100644--- a/src/lib/licences.ts+++ b/src/lib/licences.ts@@ -524,6 +524,13 @@ export const NODE_PACKS: NodePack[] = [url: SPDX("MIT"),note: "Fuobe's own pack. The network code is adapted from NVIDIA's RE-USE repository (OpenMDW-1.1, notices kept), and the Mamba layer is a plain-PyTorch rewrite (no mamba-ssm). It matches the reference maths numerically, but it is not NVIDIA's code path",}),+ // Relight: Viggle's node file (speed-LoRA loader and step schedule), in the model repo at the pinned revision.+ pack("viggle_turbo", "https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/tree/009a44a895ef85f7e643c80fdca9543795248867/comfyui", {+ name: "Qwen Research License",+ class: "non-commercial",+ url: "https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE",+ note: "Viggle's ComfyUI nodes for its Qwen-Image 2.1 turbo LoRA (the loader that reads the LoRA's strength from its metadata, and the 6-step schedule); they ship in the model repo, a Qwen-Image 2.1 derivative under the same research licence",+ }),];export const nodePack = (name: string): NodePack | undefined => NODE_PACKS.find((p) => p.name === name);diff --git a/src/lib/output-actions.ts b/src/lib/output-actions.tsindex 55302353..adad6b3a 100644--- a/src/lib/output-actions.ts+++ b/src/lib/output-actions.ts@@ -19,6 +19,7 @@ export type OutputActionId =| "animate"| "edit"| "live-edit"+ | "relight"| "upscale"| "reference"| "grade"@@ -120,6 +121,7 @@ export function outputActions(g: Generation, index: number, ctx: ActionContext =link("animate", "Animate", `/video?image=${q(o.url)}`, "primary");out.push(file, { id: "favorite", label: g.favorite ? "Unfavorite" : "Favorite", placement: "bar" });link("edit", "Edit", `/edit?image=${q(o.url)}`);+ link("relight", "Relight", `/apps/app-relight?image=${q(o.url)}&gen=${q(g.id)}`);link("live-edit", "Change it as you type", `/live-edit?image=${q(o.url)}&gen=${q(g.id)}&from=library`);link("upscale", "Upscale", `/upscale?image=${q(o.url)}`);link("reference", "Use as reference", `/image?ref=${q(o.url)}`);@@ -245,7 +247,9 @@ export function nextSteps(g: Generation, index: number, max = 3, ctx: Pick<Actioconst at = ids.indexOf("upscale");return at < 0 ? [...regen, ...ids] : [...ids.slice(0, at + 1), ...regen, ...ids.slice(at + 1)];};- const order: OutputActionId[] = o.kind === "video" ? [...(gradeOf(o) ? (["grade"] as const) : []), ...(withRegen(video) ?? [])] : (NEXT_STEPS[o.kind] ?? []);+ // A picture made in Edit: Relight in place of Edit (its composer is right there).+ const image: OutputActionId[] | undefined = o.kind === "image" && g.feature === "edit" ? ["animate", "relight", "upscale"] : NEXT_STEPS[o.kind];+ const order: OutputActionId[] = o.kind === "video" ? [...(gradeOf(o) ? (["grade"] as const) : []), ...(withRegen(video) ?? [])] : (image ?? []);return order.map((id) => all.find((a) => a.id === id && a.href)).filter((a): a is OutputAction => !!a)diff --git a/src/lib/relight/align.ts b/src/lib/relight/align.tsnew file mode 100644index 00000000..40120e59--- /dev/null+++ b/src/lib/relight/align.ts@@ -0,0 +1,236 @@+/**+ * Lines the relit picture up with the photo. The model's output comes back a few pixels off (and about 1 % scaled), and+ * blending two pictures out of register reads as a double exposure. A port of the registration in linoyts' Qwen-Image 2.1 Relight Space: edge+ * maps of both pictures (robust to the light changing), phase correlation on a grid of half-overlapping tiles with a+ * sub-pixel peak, tiles with a weak peak or a big shift dropped, then a robust per-axis scale-and-shift fit. Pure; the+ * page runs it in a worker (src/components/relight/align.worker.ts) and the shader applies the fit.+ *+ * Both pictures are measured as WORK × WORK grey maps (each axis resampled on its own: the fit is per axis, so the+ * squash does not matter) and the fit comes back in uv units (0..1 of the picture).+ */+import type { AlignFit } from "./shader";++export const WORK = 512;+const TILE = 128;+const MAX_SHIFT = 40;+const MIN_PEAK = 0.03;++/** Edge strength, normalised by its mean (central differences). */+export function edgeMap(g: Float32Array, w: number, h: number): Float32Array {+ const m = new Float32Array(w * h);+ let sum = 0;+ for (let y = 1; y < h - 1; y++) {+ for (let x = 1; x < w - 1; x++) {+ const i = y * w + x;+ const gx = g[i + 1] - g[i - 1];+ const gy = g[i + w] - g[i - w];+ const v = Math.sqrt(gx * gx + gy * gy);+ m[i] = v;+ sum += v;+ }+ }+ const mean = sum / (w * h) + 1e-6;+ for (let i = 0; i < m.length; i++) m[i] /= mean;+ return m;+}++/** In-place radix-2 FFT of one row (re, im), length a power of two. */+function fft1(re: Float64Array, im: Float64Array, inverse: boolean) {+ const n = re.length;+ for (let i = 1, j = 0; i < n; i++) {+ let bit = n >> 1;+ for (; j & bit; bit >>= 1) j ^= bit;+ j ^= bit;+ if (i < j) {+ [re[i], re[j]] = [re[j], re[i]];+ [im[i], im[j]] = [im[j], im[i]];+ }+ }+ for (let len = 2; len <= n; len <<= 1) {+ const ang = ((inverse ? 2 : -2) * Math.PI) / len;+ const wr = Math.cos(ang);+ const wi = Math.sin(ang);+ for (let i = 0; i < n; i += len) {+ let cr = 1;+ let ci = 0;+ for (let k = 0; k < len / 2; k++) {+ const a = i + k;+ const b = a + len / 2;+ const tr = re[b] * cr - im[b] * ci;+ const ti = re[b] * ci + im[b] * cr;+ re[b] = re[a] - tr;+ im[b] = im[a] - ti;+ re[a] += tr;+ im[a] += ti;+ const nr = cr * wr - ci * wi;+ ci = cr * wi + ci * wr;+ cr = nr;+ }+ }+ }+ if (inverse)+ for (let i = 0; i < n; i++) {+ re[i] /= n;+ im[i] /= n;+ }+}++/** 2D FFT of an n × n grid (rows then columns), in place. */+function fft2(re: Float64Array, im: Float64Array, n: number, inverse: boolean) {+ const r = new Float64Array(n);+ const c = new Float64Array(n);+ for (let y = 0; y < n; y++) {+ r.set(re.subarray(y * n, y * n + n));+ c.set(im.subarray(y * n, y * n + n));+ fft1(r, c, inverse);+ re.set(r, y * n);+ im.set(c, y * n);+ }+ for (let x = 0; x < n; x++) {+ for (let y = 0; y < n; y++) {+ r[y] = re[y * n + x];+ c[y] = im[y * n + x];+ }+ fft1(r, c, inverse);+ for (let y = 0; y < n; y++) {+ re[y * n + x] = r[y];+ im[y * n + x] = c[y];+ }+ }+}++const hann = (() => {+ const w = new Float64Array(TILE);+ for (let i = 0; i < TILE; i++) w[i] = 0.5 - 0.5 * Math.cos((2 * Math.PI * i) / (TILE - 1));+ return w;+})();++/** The sub-pixel shift of tile b relative to tile a (content at a's x sits at b's x − dx), and the peak's strength. */+export function phaseShift(a: Float64Array, b: Float64Array, n = TILE): { dx: number; dy: number; peak: number } {+ const mean = (t: Float64Array) => t.reduce((s, v) => s + v, 0) / t.length;+ const ma = mean(a);+ const mb = mean(b);+ const ar = new Float64Array(n * n);+ const ai = new Float64Array(n * n);+ const br = new Float64Array(n * n);+ const bi = new Float64Array(n * n);+ for (let y = 0; y < n; y++)+ for (let x = 0; x < n; x++) {+ const w = (n === TILE ? hann[y] * hann[x] : 1);+ ar[y * n + x] = (a[y * n + x] - ma) * w;+ br[y * n + x] = (b[y * n + x] - mb) * w;+ }+ fft2(ar, ai, n, false);+ fft2(br, bi, n, false);+ // R = A · conj(B), normalised.+ for (let i = 0; i < n * n; i++) {+ const re = ar[i] * br[i] + ai[i] * bi[i];+ const im = ai[i] * br[i] - ar[i] * bi[i];+ const mag = Math.hypot(re, im) + 1e-6;+ ar[i] = re / mag;+ ai[i] = im / mag;+ }+ fft2(ar, ai, n, true);+ let best = 0;+ for (let i = 1; i < n * n; i++) if (ar[i] > ar[best]) best = i;+ const py = Math.floor(best / n);+ const px = best % n;+ const at = (y: number, x: number) => ar[((y + n) % n) * n + ((x + n) % n)];+ const sub = (c0: number, cm: number, cp: number) => {+ const d = cm - 2 * c0 + cp;+ return Math.abs(d) < 1e-9 ? 0 : (0.5 * (cm - cp)) / d;+ };+ let dy = py + sub(at(py, px), at(py - 1, px), at(py + 1, px));+ let dx = px + sub(at(py, px), at(py, px - 1), at(py, px + 1));+ if (dy > n / 2) dy -= n;+ if (dx > n / 2) dx -= n;+ return { dx, dy, peak: ar[best] };+}++/** Robust line fit v = s·p + t: least squares, then refit without the outliers (up to three times). */+export function fitAxis(p: number[], v: number[]): { s: number; t: number } {+ let keep = p.map(() => true);+ let s = 1;+ let t = 0;+ for (let round = 0; round < 3; round++) {+ const idx = p.map((_, i) => i).filter((i) => keep[i]);+ const n = idx.length;+ const mp = idx.reduce((a, i) => a + p[i], 0) / n;+ const mv = idx.reduce((a, i) => a + v[i], 0) / n;+ let num = 0;+ let den = 0;+ for (const i of idx) {+ num += (p[i] - mp) * (v[i] - mv);+ den += (p[i] - mp) ** 2;+ }+ s = den > 1e-9 ? num / den : 1;+ t = mv - s * mp;+ const res = p.map((pi, i) => Math.abs(v[i] - (s * pi + t)));+ const kept = idx.map((i) => res[i]).sort((a, b) => a - b);+ const thr = Math.max(1, 2.5 * kept[Math.floor(kept.length / 2)]);+ const next = res.map((r) => r <= thr);+ if (next.filter(Boolean).length < 3 || next.every((k, i) => k === keep[i])) break;+ keep = next;+ }+ return { s, t };+}++export interface AlignResult {+ fit: AlignFit;+ /** Tiles that agreed (for the owner's diagnostics). */+ tiles: number;+}++/**+ * The fit that puts the relit picture over the photo, from two WORK × WORK grey maps (0..1). Null when too few tiles+ * have a clear match (a featureless picture): the blend then uses the pictures as they are.+ */+export function alignFit(photoGray: Float32Array, relitGray: Float32Array, size = WORK): AlignResult | null {+ const O = edgeMap(photoGray, size, size);+ const R = edgeMap(relitGray, size, size);+ const step = TILE / 2;+ const pts: [number, number, number, number][] = [];+ const a = new Float64Array(TILE * TILE);+ const b = new Float64Array(TILE * TILE);+ for (let y0 = 0; y0 + TILE <= size; y0 += step) {+ for (let x0 = 0; x0 + TILE <= size; x0 += step) {+ let s = 0;+ let s2 = 0;+ for (let y = 0; y < TILE; y++)+ for (let x = 0; x < TILE; x++) {+ const va = O[(y0 + y) * size + x0 + x];+ a[y * TILE + x] = va;+ b[y * TILE + x] = R[(y0 + y) * size + x0 + x];+ s += va;+ s2 += va * va;+ }+ const n = TILE * TILE;+ const std = Math.sqrt(Math.max(0, s2 / n - (s / n) ** 2));+ if (std < 0.3) continue;+ const { dx, dy, peak } = phaseShift(a, b);+ if (Math.abs(dx) < MAX_SHIFT && Math.abs(dy) < MAX_SHIFT && peak > MIN_PEAK) pts.push([x0 + TILE / 2, y0 + TILE / 2, dx, dy]);+ }+ }+ if (pts.length < 4) return null;+ // Content at photo (x, y) sits at relit (x − dx, y − dy): relit_x = sx·x + tx.+ const fx = fitAxis(+ pts.map((q) => q[0]),+ pts.map((q) => q[0] - q[2]),+ );+ const fy = fitAxis(+ pts.map((q) => q[1]),+ pts.map((q) => q[1] - q[3]),+ );+ // Pixel centres: u = (x + 0.5) / size.+ const toUv = (f: { s: number; t: number }) => ({ s: f.s, t: (f.t + 0.5 - 0.5 * f.s) / size });+ const ux = toUv(fx);+ const uy = toUv(fy);+ return { fit: { sx: ux.s, tx: ux.t, sy: uy.s, ty: uy.t }, tiles: pts.length };+}++/** The relit pixel position (in work pixels) a fit maps photo pixel x to: for tests and diagnostics. */+export function mapPx(fit: AlignFit, axis: "x" | "y", px: number, size = WORK): number {+ const s = axis === "x" ? fit.sx : fit.sy;+ const t = axis === "x" ? fit.tx : fit.ty;+ return (s * ((px + 0.5) / size) + t) * size - 0.5;+}diff --git a/src/lib/relight/blend.ts b/src/lib/relight/blend.tsnew file mode 100644index 00000000..c635a39b--- /dev/null+++ b/src/lib/relight/blend.ts@@ -0,0 +1,101 @@+/**+ * The Intensity blend on the CPU: the reference for the shader's result mode (tests) and the path for a browser without+ * WebGL. All maths in linear light, RGBA in and out (alpha kept from the original).+ *+ * - Plain mix: out = mix(O, R, t).+ * - Light transfer: ratio = blur(R) / blur(O) per channel (clamped 0..8), out = O · mix(1, ratio, t): the original's+ * full detail stays and only the light changes.+ */+import { srgbToLinear } from "./lights";++const LUT = (() => {+ const t = new Float32Array(256);+ for (let i = 0; i < 256; i++) t[i] = srgbToLinear(i);+ return t;+})();++export function linearToSrgb8(v: number): number {+ const c = Math.max(0, v);+ const s = c <= 0.0031308 ? c * 12.92 : 1.055 * c ** (1 / 2.4) - 0.055;+ return Math.max(0, Math.min(255, Math.round(s * 255)));+}++/** Linear RGB planes of an RGBA buffer. */+function linear(px: ArrayLike<number>, n: number): Float32Array {+ const out = new Float32Array(n * 3);+ for (let i = 0; i < n; i++) {+ out[i * 3] = LUT[px[i * 4]];+ out[i * 3 + 1] = LUT[px[i * 4 + 1]];+ out[i * 3 + 2] = LUT[px[i * 4 + 2]];+ }+ return out;+}++/** A box blur of radius r along one axis of a 3-channel image (running sum, edges clamped). */+function boxAxis(src: Float32Array, w: number, h: number, r: number, horizontal: boolean): Float32Array {+ const out = new Float32Array(src.length);+ const len = horizontal ? w : h;+ const lines = horizontal ? h : w;+ const idx = (line: number, k: number) => (horizontal ? line * w + k : k * w + line) * 3;+ const win = 2 * r + 1;+ for (let line = 0; line < lines; line++) {+ for (let c = 0; c < 3; c++) {+ let sum = 0;+ for (let k = -r; k <= r; k++) sum += src[idx(line, Math.min(len - 1, Math.max(0, k))) + c];+ for (let k = 0; k < len; k++) {+ out[idx(line, k) + c] = sum / win;+ sum += src[idx(line, Math.min(len - 1, k + r + 1)) + c] - src[idx(line, Math.max(0, k - r)) + c];+ }+ }+ }+ return out;+}++/** About a Gaussian of σ (three box passes per axis). */+export function blurLinear(src: Float32Array, w: number, h: number, sigma: number): Float32Array {+ const r = Math.max(0, Math.round(Math.sqrt((12 * sigma * sigma) / 3 + 1) / 2 - 0.5));+ if (!r) return src.slice();+ let a = src;+ for (let i = 0; i < 3; i++) a = boxAxis(boxAxis(a, w, h, r, true), w, h, r, false);+ return a;+}++export type Rgba = Uint8ClampedArray | Uint8Array;++/** Plain mix in linear light. t = 0 returns the original exactly; t = 1 the relit picture. */+export function blendPlain(o: Rgba, r: Rgba, t: number): Uint8ClampedArray<ArrayBuffer> {+ const n = o.length / 4;+ const out = new Uint8ClampedArray(o.length);+ const k = Math.min(1, Math.max(0, t));+ for (let i = 0; i < n; i++) {+ for (let c = 0; c < 3; c++) {+ const j = i * 4 + c;+ out[j] = k === 0 ? o[j] : k === 1 ? r[j] : linearToSrgb8(LUT[o[j]] * (1 - k) + LUT[r[j]] * k);+ }+ out[i * 4 + 3] = o[i * 4 + 3];+ }+ return out;+}++/** Light transfer: the original's detail with the relit picture's light. σ in pixels (about 1.2 % of the short side). */+export function blendTransfer(o: Rgba, r: Rgba, w: number, h: number, t: number, sigma = 0.012 * Math.min(w, h)): Uint8ClampedArray<ArrayBuffer> {+ const n = w * h;+ const k = Math.min(1, Math.max(0, t));+ const out = new Uint8ClampedArray(o.length);+ if (k === 0) {+ out.set(o);+ return out;+ }+ const O = linear(o, n);+ const bo = blurLinear(O, w, h, sigma);+ const br = blurLinear(linear(r, n), w, h, sigma);+ for (let i = 0; i < n; i++) {+ for (let c = 0; c < 3; c++) {+ const j = i * 3 + c;+ const ratio = Math.min(8, Math.max(0, br[j] / Math.max(bo[j], 0.004)));+ out[i * 4 + c] = linearToSrgb8(O[j] * (1 + (ratio - 1) * k));+ }+ out[i * 4 + 3] = o[i * 4 + 3];+ }+ return out;+}diff --git a/src/lib/relight/demo.ts b/src/lib/relight/demo.tsnew file mode 100644index 00000000..09a0cdec--- /dev/null+++ b/src/lib/relight/demo.ts@@ -0,0 +1,34 @@+/**+ * The photo the Relight tool opens on, with its relit result shipped as a static file: Intensity, the looks and the+ * preview work at once for everyone, guests too, with nothing to upload or run. A demo with a scene read ships its+ * depth map and cut-out too (the preview is then depth-true); without them it uses the flat preview.+ */+import type { LookId } from "./lights";++export interface RelightDemo {+ id: string;+ /** What the photo shows, for its alt text. */+ alt: string;+ photo: string;+ relit: string;+ /** The look the relit picture was made with: the tool opens on it, so the result shows. */+ look: LookId;+ width: number;+ height: number;+ depth?: string;+ matte?: string;+}++export const RELIGHT_DEMOS: readonly RelightDemo[] = [+ {+ id: "cliffs",+ alt: "A model in a teal knit on a clifftop by the sea",+ photo: "/previews/presets/ba/1280/app-relight-before.jpg",+ relit: "/previews/presets/ba/1280/app-relight-after.jpg",+ look: "golden-hour",+ width: 1280,+ height: 960,+ },+];++export const DEFAULT_DEMO = RELIGHT_DEMOS[0];diff --git a/src/lib/relight/engine.ts b/src/lib/relight/engine.tsnew file mode 100644index 00000000..e8e34fa6--- /dev/null+++ b/src/lib/relight/engine.ts@@ -0,0 +1,84 @@+/**+ * How the Relight tool runs: the hidden models, the settings measured runs set, and the requests it sends. Pure.+ *+ * Generate lighting is an ordinary run (feature "relight") on a hidden Qwen-Image 2.1 model with a+ * few-step speed add-on, so the Library, Retry, Reuse, account GPUs and the guest rules work as for any app. The scene+ * read (depth and subject cut-out, once per photo) is a helper step the Library hides. A blend kept from the browser is+ * recorded as a local result.+ */+import type { GenerationRequest } from "../catalog/types";+import { MAX_LIGHTS, promptFor, type Light, type LookId, type RelightExtra, type SoftnessWording } from "./lights";++export const RELIGHT_PRESET = "app-relight";+/** Its own feature, not the app preset: a preset run would put the app's old words in front of the lights' own. */+export const RELIGHT_FEATURE = "relight";+/** Generate lighting: Qwen-Image 2.1 + the 6-step speed LoRA, the photo plus the words. */+export const RELIGHT_MODEL = "oss-qwen-image-21-relight";+/** The scene read: depth (near = bright) and the subject's matte. */+export const RELIGHT_SCENE_MODEL = "oss-relight-scene";+/** Its runs are steps: the Library leaves them out (HELPER_SUFFIX). */+export const RELIGHT_SCENE_FEATURE = "relight-scene-step";+/** A blend rendered in the browser and kept. */+export const RELIGHT_BLEND_MODEL = "local-relight";+export const RELIGHT_BLEND_FEATURE = "relight";++export type BlendMode = "mix" | "transfer";++/**+ * The settings measured runs confirm or change (scripts/eval/cases/relight.json). Visitors never see them; the owner's status line names the+ * engine variant.+ */+export const RELIGHT_SETTINGS = {+ /** The engine variant (the workflow's speed LoRA): Viggle 6-step r256. */+ variant: "viggle-6",+ /** Send the light-guide picture as image 2. Off until measured runs show it helps the light land where placed. */+ guide: false,+ /** How the prompt says softness (per light when the lights differ, else once). */+ softness: "auto" as SoftnessWording,+ /** The default blend: light transfer keeps the original's detail and changes only the light. */+ blend: "transfer" as BlendMode,+ /** The Intensity the result opens at. */+ intensity: 0.6,+ /** Ambient light in the preview's lights-only estimate (linear). */+ ambient: 0.04,+} as const;++export const INTENSITY_CHIPS = [0.35, 0.6, 1] as const;++/** The longest side a photo is sent at (the model renders at ~1 MP and the blend keeps the original's detail). */+export const RELIGHT_MAX_SIDE = 1536;++export interface RelightRun {+ photo: string;+ guide?: string | null;+ lights: Light[];+ look?: LookId;+ promptOverride?: string | null;+ seed: number;+}++/** The run for Generate lighting. */+export function relightRequest(r: RelightRun): GenerationRequest {+ const lights = r.lights.slice(0, MAX_LIGHTS);+ const guide = RELIGHT_SETTINGS.guide && !!r.guide;+ const extra: RelightExtra = { lights, ...(r.look && { look: r.look }), seed: r.seed, variant: RELIGHT_SETTINGS.variant, guide, ...(r.promptOverride?.trim() && { typed: true }) };+ return {+ feature: RELIGHT_FEATURE,+ modelId: RELIGHT_MODEL,+ op: "edit",+ prompt: promptFor(lights, r.promptOverride, RELIGHT_SETTINGS.softness),+ inputs: { images: guide && r.guide ? [r.photo, r.guide] : [r.photo] },+ params: { seed: r.seed, numOutputs: 1, extra: { relight: extra } },+ };+}++/** The scene read of one photo. */+export function sceneRequest(photo: string): GenerationRequest {+ return {+ feature: RELIGHT_SCENE_FEATURE,+ modelId: RELIGHT_SCENE_MODEL,+ op: "bg-remove",+ prompt: "",+ inputs: { images: [photo] },+ };+}diff --git a/src/lib/relight/guide.ts b/src/lib/relight/guide.tsnew file mode 100644index 00000000..425b2d45--- /dev/null+++ b/src/lib/relight/guide.ts@@ -0,0 +1,69 @@+/**+ * The light-guide picture: the rig drawn over the darkened photo (each light a glow in its colour at its spot, a+ * behind light a coloured rim on the subject's edge). Sent as image 2 only when measured runs show it helps the model+ * place the light (RELIGHT_SETTINGS.guide). Pure and deterministic: the same rig and photo give the same pixels.+ */+import { hexToRgb, MAX_LIGHTS, srgbToLinear, strengthValueOf, type Light } from "./lights";+import { linearToSrgb8, type Rgba } from "./blend";+import { packLight } from "./shader";++/** The longest side of the guide. */+export const GUIDE_SIDE = 1024;+const DARKEN = 0.25;++/**+ * Draw the guide over `photo` (RGBA, w × h, already at the guide's size). `matte` (one value per pixel, 0..255) puts+ * behind lights on the subject's edge; without it they draw as a ring round their spot.+ */+export function drawGuide(photo: Rgba, w: number, h: number, lights: readonly Light[], matte?: ArrayLike<number> | null): Uint8ClampedArray<ArrayBuffer> {+ const out = new Uint8ClampedArray(w * h * 4);+ const aspect = w / h;+ const packed = lights.slice(0, MAX_LIGHTS).map((l) => ({ l, p: packLight(l, aspect, 0.5), lin: hexToRgb(l.color).map(srgbToLinear), power: Math.min(1.2, strengthValueOf(l) * 1.2) }));+ const edgeAt = (x: number, y: number) => {+ if (!matte) return 0;+ const at = (xx: number, yy: number) => matte[Math.min(h - 1, Math.max(0, yy)) * w + Math.min(w - 1, Math.max(0, xx))] / 255;+ const gx = at(x + 2, y) - at(x - 2, y);+ const gy = at(x, y + 2) - at(x, y - 2);+ return Math.min(1, Math.hypot(gx, gy) * 2.5);+ };+ for (let y = 0; y < h; y++) {+ for (let x = 0; x < w; x++) {+ const i = (y * w + x) * 4;+ const px = ((x + 0.5) / w) * aspect;+ const py = (y + 0.5) / h;+ let r = srgbToLinear(photo[i]) * DARKEN;+ let g = srgbToLinear(photo[i + 1]) * DARKEN;+ let b = srgbToLinear(photo[i + 2]) * DARKEN;+ const edge = matte ? edgeAt(x, y) : 0;+ for (const { l, p, lin, power } of packed) {+ const dx = px - p.pos[0];+ const dy = py - p.pos[1];+ const d2 = dx * dx + dy * dy;+ const radius = p.params[1];+ let k: number;+ if (l.behind) {+ const fall = Math.exp(-d2 / (radius * radius * 2.5));+ k = matte ? edge * fall * 1.6 : Math.exp(-((Math.sqrt(d2) - radius * 0.5) ** 2) / 0.002) * 0.8;+ } else {+ k = Math.exp(-d2 / (radius * radius * 0.5));+ }+ k *= power;+ // Screen in linear light: bright where the light is, never past white.+ r = 1 - (1 - r) * (1 - Math.min(1, lin[0] * k));+ g = 1 - (1 - g) * (1 - Math.min(1, lin[1] * k));+ b = 1 - (1 - b) * (1 - Math.min(1, lin[2] * k));+ }+ out[i] = linearToSrgb8(r);+ out[i + 1] = linearToSrgb8(g);+ out[i + 2] = linearToSrgb8(b);+ out[i + 3] = 255;+ }+ }+ return out;+}++/** The guide's size for a photo: the long side GUIDE_SIDE (never larger than the photo). */+export function guideSize(w: number, h: number): { width: number; height: number } {+ const s = Math.min(1, GUIDE_SIDE / Math.max(w, h));+ return { width: Math.max(1, Math.round(w * s)), height: Math.max(1, Math.round(h * s)) };+}diff --git a/src/lib/relight/lights.ts b/src/lib/relight/lights.tsnew file mode 100644index 00000000..3838e952--- /dev/null+++ b/src/lib/relight/lights.ts@@ -0,0 +1,420 @@+/**+ * Relight with placed lights (the Relight app's own tool, src/components/relight): the lights, their colours and+ * bands, the ready-made looks, and the words the model gets. Pure: the page, the server and the tests share it.+ *+ * A light sits where it was tapped (x 0 left … 1 right, y 0 bottom … 1 top). Its height band follows y; distance,+ * softness and strength are preset chips (a desktop slider can set strength finely). The prompt names only what is+ * wanted: the lights, the darkness they light, and what stays the same.+ */++export type Height = "low" | "face" | "high";+export type Distance = "close" | "mid" | "far";+export type Softness = "hard" | "soft" | "diffuse";+export type Strength = "low" | "medium" | "high";+export type Side = "left" | "front" | "right";++export interface Light {+ id: string;+ /** sRGB hex, #rrggbb. */+ color: string;+ /** 0 left … 1 right. */+ x: number;+ /** 0 bottom … 1 top (where the marker sits on the photo). */+ y: number;+ height: Height;+ distance: Distance;+ softness: Softness;+ strength: Strength;+ /** 0..1, set only by the desktop slider; otherwise the strength chip decides. */+ strengthValue?: number;+ /** Behind the subject: it rims the outline. */+ behind?: boolean;+}++export const MAX_LIGHTS = 3;++export const HEIGHTS: readonly Height[] = ["low", "face", "high"];+export const DISTANCES: readonly Distance[] = ["close", "mid", "far"];+export const SOFTNESSES: readonly Softness[] = ["hard", "soft", "diffuse"];+export const STRENGTHS: readonly Strength[] = ["low", "medium", "high"];++export const HEIGHT_LABELS: Record<Height, string> = { low: "Low", face: "Face", high: "High" };+export const DISTANCE_LABELS: Record<Distance, string> = { close: "Close", mid: "Mid", far: "Far" };+export const SOFTNESS_LABELS: Record<Softness, string> = { hard: "Hard", soft: "Soft", diffuse: "Diffuse" };+export const STRENGTH_LABELS: Record<Strength, string> = { low: "Low", medium: "Medium", high: "High" };++/** Where a band's marker sits when its chip moves it (0 bottom … 1 top). */+export const BAND_CENTER: Record<Height, number> = { low: 0.18, face: 0.55, high: 0.84 };++const clamp01 = (v: number) => (Number.isFinite(v) ? Math.min(1, Math.max(0, v)) : 0.5);++/** The height band of a spot: the top third is High, the bottom third Low, the rest Face. */+export function heightFromY(y: number): Height {+ return y > 0.66 ? "high" : y < 0.33 ? "low" : "face";+}++/** The marker's y for a band chip: kept when it is inside the band already, else the band's centre. */+export function yForHeight(y: number, h: Height): number {+ return heightFromY(y) === h ? y : BAND_CENTER[h];+}++/** The side a light comes from, in words' thirds. */+export function sideOf(x: number): Side {+ return x < 0.35 ? "left" : x > 0.65 ? "right" : "front";+}++/** The strength as a number (0..1): the slider's value, else the chip's. */+export function strengthValueOf(l: Pick<Light, "strength" | "strengthValue">): number {+ if (typeof l.strengthValue === "number" && Number.isFinite(l.strengthValue)) return clamp01(l.strengthValue);+ return l.strength === "low" ? 0.3 : l.strength === "high" ? 0.95 : 0.62;+}++/** The chip a slider value falls in. */+export function strengthFromValue(v: number): Strength {+ return v < 0.4 ? "low" : v > 0.78 ? "high" : "medium";+}++// ---------------------------------------------------------------------------+// Colours++export type ColorChipId = "warm" | "cool" | "teal" | "magenta" | "sunset" | "neon-blue" | "white";++export interface ColorChip {+ id: ColorChipId;+ label: string;+ hex: string;+ /** What the prompt calls it. */+ words: string;+}++export const COLOR_CHIPS: readonly ColorChip[] = [+ { id: "warm", label: "Warm", hex: "#ffb450", words: "warm amber" },+ { id: "cool", label: "Cool", hex: "#cfe0ff", words: "cool moonlight blue" },+ { id: "teal", label: "Teal", hex: "#1ec8be", words: "teal" },+ { id: "magenta", label: "Magenta", hex: "#f028dc", words: "vivid neon magenta" },+ { id: "sunset", label: "Sunset", hex: "#ff8a2a", words: "sunset orange" },+ { id: "neon-blue", label: "Neon blue", hex: "#2860ff", words: "electric neon blue" },+ { id: "white", label: "White", hex: "#ffffff", words: "clean white" },+];++/** More names a custom colour can land on (the 14 of linoyts' Qwen-Image 2.1 Relight Space). */+const MORE_NAMES: readonly { hex: string; words: string }[] = [+ { hex: "#ff2828", words: "red" },+ { hex: "#ff8c1e", words: "orange" },+ { hex: "#ffe632", words: "yellow" },+ { hex: "#5ae628", words: "green" },+ { hex: "#28dcff", words: "cyan" },+ { hex: "#285aff", words: "blue" },+ { hex: "#963cff", words: "purple" },+ { hex: "#ff6eb4", words: "pink" },+ { hex: "#d7e6ff", words: "cool white" },+ { hex: "#ffebcd", words: "warm white" },+];++const ALL_NAMES = [...COLOR_CHIPS.map((c) => ({ hex: c.hex, words: c.words })), ...MORE_NAMES];++export function normalizeHex(hex: string): string | null {+ const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());+ if (!m) return null;+ const h = m[1].length === 3 ? [...m[1]].map((c) => c + c).join("") : m[1];+ return `#${h.toLowerCase()}`;+}++export function hexToRgb(hex: string): [number, number, number] {+ const h = normalizeHex(hex) ?? "#ffffff";+ return [parseInt(h.slice(1, 3), 16), parseInt(h.slice(3, 5), 16), parseInt(h.slice(5, 7), 16)];+}++/** sRGB 0..255 → linear 0..1. */+export function srgbToLinear(c: number): number {+ const v = c / 255;+ return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;+}++/** CIE Lab (D65) of an sRGB hex. */+export function hexToLab(hex: string): [number, number, number] {+ const [r, g, b] = hexToRgb(hex).map(srgbToLinear);+ const x = (0.4124 * r + 0.3576 * g + 0.1805 * b) / 0.95047;+ const y = 0.2126 * r + 0.7152 * g + 0.0722 * b;+ const z = (0.0193 * r + 0.1192 * g + 0.9505 * b) / 1.08883;+ const f = (t: number) => (t > 216 / 24389 ? Math.cbrt(t) : (24389 / 27 * t + 16) / 116);+ const [fx, fy, fz] = [f(x), f(y), f(z)];+ return [116 * fy - 16, 500 * (fx - fy), 200 * (fy - fz)];+}++/** The chip a colour is exactly, if any. */+export function chipOf(hex: string): ColorChip | undefined {+ const h = normalizeHex(hex);+ return COLOR_CHIPS.find((c) => c.hex === h);+}++/** A colour's words: its chip's, else the nearest name (distance in Lab, not RGB). */+export function colorWords(hex: string): string {+ const chip = chipOf(hex);+ if (chip) return chip.words;+ const [l, a, b] = hexToLab(hex);+ let best = ALL_NAMES[0];+ let bestD = Infinity;+ for (const n of ALL_NAMES) {+ const [l2, a2, b2] = hexToLab(n.hex);+ const d = (l - l2) ** 2 + (a - a2) ** 2 + (b - b2) ** 2;+ if (d < bestD) {+ bestD = d;+ best = n;+ }+ }+ return best.words;+}++// ---------------------------------------------------------------------------+// Looks: one tap places a full rig++export type LookId = "golden-hour" | "neon-night" | "studio-rim" | "candlelight" | "studio-softbox" | "dramatic" | "overcast" | "silhouette" | "window";++type LightSpec = Omit<Light, "id" | "y"> & { y?: number };++export interface Look {+ id: LookId;+ label: string;+ lights: LightSpec[];+ /** The old app's option label it replaces (Reuse of an old run picks this look). */+ legacy?: string;+}++const L = (color: string, x: number, height: Height, distance: Distance, softness: Softness, strength: Strength, behind?: boolean): LightSpec => ({+ color,+ x,+ height,+ distance,+ softness,+ strength,+ ...(behind && { behind: true }),+});++/** The four named looks come first on every screen; the other five keep the old app's choices. */+export const LOOKS: readonly Look[] = [+ { id: "golden-hour", label: "Golden hour", legacy: "Golden hour", lights: [L("#ff8a2a", 0.12, "face", "far", "soft", "high"), L("#ffd9a0", 0.85, "face", "far", "diffuse", "low")] },+ { id: "neon-night", label: "Neon night", legacy: "Neon night", lights: [L("#f028dc", 0.08, "face", "close", "hard", "high"), L("#2860ff", 0.92, "face", "close", "hard", "high")] },+ {+ id: "studio-rim",+ label: "Studio rim",+ lights: [L("#ffffff", 0.3, "high", "mid", "soft", "medium"), L("#cfe0ff", 0.85, "high", "close", "hard", "high", true), L("#cfe0ff", 0.15, "high", "close", "hard", "medium", true)],+ },+ { id: "candlelight", label: "Candlelight", legacy: "Candlelight", lights: [L("#ffa040", 0.42, "low", "close", "soft", "high")] },+ { id: "studio-softbox", label: "Studio softbox", legacy: "Studio softbox", lights: [L("#ffffff", 0.5, "high", "mid", "diffuse", "high")] },+ { id: "dramatic", label: "Dramatic", legacy: "Dramatic", lights: [L("#ffffff", 0.12, "high", "close", "hard", "high")] },+ { id: "overcast", label: "Overcast", legacy: "Overcast", lights: [L("#dfe8ff", 0.5, "high", "far", "diffuse", "medium")] },+ { id: "silhouette", label: "Silhouette", legacy: "Silhouette", lights: [L("#ffe2b8", 0.5, "face", "far", "hard", "high", true)] },+ { id: "window", label: "Window", legacy: "Window", lights: [L("#e6efff", 0.08, "face", "mid", "soft", "high")] },+];++export const FEATURED_LOOKS: readonly LookId[] = ["golden-hour", "neon-night", "studio-rim", "candlelight"];++export function getLook(id: string | undefined | null): Look | undefined {+ return LOOKS.find((l) => l.id === id);+}++/** The look an old run's "Lighting" option picked (Reuse of a run from before the tool). */+export function lookFromLegacy(label: string | undefined | null): Look | undefined {+ if (!label) return undefined;+ const t = label.trim().toLowerCase();+ return LOOKS.find((l) => l.legacy?.toLowerCase() === t || l.label.toLowerCase() === t);+}++/** A look's lights, ready to place (ids l1…, y at the band's centre). */+export function lightsOfLook(look: Look): Light[] {+ return look.lights.slice(0, MAX_LIGHTS).map((s, i) => ({ ...s, id: `l${i + 1}`, y: s.y ?? BAND_CENTER[s.height] }));+}++/** Whether `lights` are still exactly what `look` placed. */+export function isLook(lights: readonly Light[], look: Look): boolean {+ const want = lightsOfLook(look);+ if (want.length !== lights.length) return false;+ return want.every((w, i) => {+ const l = lights[i];+ return (+ l.color === w.color &&+ Math.abs(l.x - w.x) < 1e-6 &&+ Math.abs(l.y - w.y) < 1e-6 &&+ l.height === w.height &&+ l.distance === w.distance &&+ l.softness === w.softness &&+ l.strength === w.strength &&+ l.strengthValue === undefined &&+ !!l.behind === !!w.behind+ );+ });+}++// ---------------------------------------------------------------------------+// Placing lights++/** Where "Add light" puts light 1, 2 and 3 when nobody taps the photo. */+const DEFAULT_SPOTS: readonly { x: number; height: Height; color: string }[] = [+ { x: 0.2, height: "face", color: "#ff8a2a" },+ { x: 0.8, height: "face", color: "#2860ff" },+ { x: 0.5, height: "high", color: "#f028dc" },+];++function nextId(lights: readonly Light[]): string {+ for (let i = 1; ; i++) if (!lights.some((l) => l.id === `l${i}`)) return `l${i}`;+}++/** A new light where the photo was tapped (null at MAX_LIGHTS). Its band follows the tap; its colour the next default. */+export function lightAt(lights: readonly Light[], x: number, y: number): Light | null {+ if (lights.length >= MAX_LIGHTS) return null;+ const spot = DEFAULT_SPOTS.find((s) => !lights.some((l) => l.color === s.color)) ?? DEFAULT_SPOTS[lights.length % DEFAULT_SPOTS.length];+ const cx = clamp01(x);+ const cy = clamp01(y);+ return { id: nextId(lights), color: spot.color, x: cx, y: cy, height: heightFromY(cy), distance: "mid", softness: "soft", strength: "high" };+}++/** "Add light" without a tap: the next default spot. */+export function defaultLight(lights: readonly Light[]): Light | null {+ if (lights.length >= MAX_LIGHTS) return null;+ const spot = DEFAULT_SPOTS.find((s) => !lights.some((l) => Math.abs(l.x - s.x) < 0.05 && l.height === s.height)) ?? DEFAULT_SPOTS[lights.length];+ const l = lightAt(lights, spot.x, BAND_CENTER[spot.height]);+ return l && { ...l, color: lights.some((o) => o.color === spot.color) ? l.color : spot.color };+}++/** Move a light (tap or drag): its band follows y. */+export function moveLight(l: Light, x: number, y: number): Light {+ const cy = clamp01(y);+ return { ...l, x: clamp01(x), y: cy, height: heightFromY(cy) };+}++/** A light from anything stored (a run's params, a link): only known values, clamped; null when it isn't one. */+export function sanitizeLight(v: unknown, fallbackId: string): Light | null {+ if (!v || typeof v !== "object") return null;+ const o = v as Record<string, unknown>;+ const color = typeof o.color === "string" ? normalizeHex(o.color) : null;+ if (!color || typeof o.x !== "number" || typeof o.y !== "number") return null;+ const pick = <T extends string>(val: unknown, all: readonly T[], d: T): T => (all.includes(val as T) ? (val as T) : d);+ const y = clamp01(o.y);+ return {+ id: typeof o.id === "string" && /^[\w-]{1,16}$/.test(o.id) ? o.id : fallbackId,+ color,+ x: clamp01(o.x),+ y,+ height: pick(o.height, HEIGHTS, heightFromY(y)),+ distance: pick(o.distance, DISTANCES, "mid"),+ softness: pick(o.softness, SOFTNESSES, "soft"),+ strength: pick(o.strength, STRENGTHS, "high"),+ ...(typeof o.strengthValue === "number" && Number.isFinite(o.strengthValue) && { strengthValue: clamp01(o.strengthValue) }),+ ...(o.behind === true && { behind: true }),+ };+}++export function sanitizeLights(v: unknown): Light[] {+ if (!Array.isArray(v)) return [];+ const out: Light[] = [];+ for (const [i, x] of v.entries()) {+ const l = sanitizeLight(x, `l${i + 1}`);+ if (l && !out.some((o) => o.id === l.id)) out.push(l);+ if (out.length >= MAX_LIGHTS) break;+ }+ return out;+}++// ---------------------------------------------------------------------------+// Words++const STRENGTH_WORD: Record<Strength, string> = { low: "gentle", medium: "", high: "strong" };+const SOFT_WORD: Record<Softness, string> = { hard: "hard, crisp", soft: "soft", diffuse: "broad, diffused" };+const HEIGHT_WORDS: Record<Height, string> = { low: "below", face: "at face height", high: "high above" };+const DISTANCE_WORDS: Record<Distance, string> = { close: "close to the subject", mid: "at a medium distance", far: "far away" };+const SIDE_WORDS: Record<Side, string> = { left: "the left", right: "the right", front: "the front" };+const SOFTNESS_CLAUSE: Record<Softness, string> = {+ hard: "hard, crisp light and sharp, defined shadows",+ soft: "soft light and smooth shadow edges",+ diffuse: "soft, diffused light and gentle shadow falloff",+};+const RANK: Record<Softness, number> = { hard: 0, soft: 1, diffuse: 2 };++export const KEEP_WORDS =+ "Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same; only the lighting and the colour of the light falling on the scene change.";++/**+ * How softness is said: "auto" names each light's own softness when they differ and one shared clause when they+ * agree; "shared" says the softest light's clause once for all.+ */+export type SoftnessWording = "auto" | "shared";++/** One light in words: "a strong soft sunset orange light coming from the left, at face height, far away". */+export function lightWords(l: Light, withSoftness: boolean): string {+ const strength = STRENGTH_WORD[strengthFromValue(strengthValueOf(l))];+ const soft = withSoftness ? SOFT_WORD[l.softness] : "";+ const head = ["a", strength, soft, colorWords(l.color), "light"].filter(Boolean).join(" ");+ const where = l.behind+ ? `behind the subject, rimming the ${sideOf(l.x) === "front" ? "top" : sideOf(l.x)} edge of the silhouette`+ : `coming from ${SIDE_WORDS[sideOf(l.x)]}`;+ return `${head} ${where}, ${HEIGHT_WORDS[l.height]}, ${DISTANCE_WORDS[l.distance]}`;+}++function joinLights(parts: string[]): string {+ if (parts.length <= 1) return parts[0] ?? "";+ return `${parts.slice(0, -1).join("; ")}; and ${parts[parts.length - 1]}`;+}++/** The prompt written from the lights. Empty with no light. */+export function relightPrompt(lights: readonly Light[], wording: SoftnessWording = "auto"): string {+ const ls = lights.slice(0, MAX_LIGHTS);+ if (!ls.length) return "";+ const same = ls.every((l) => l.softness === ls[0].softness);+ const shared = wording === "shared" || same;+ const clauseSoftness = ls.reduce((a, l) => (RANK[l.softness] > RANK[a] ? l.softness : a), ls[0].softness);+ const parts = ls.map((l) => lightWords(l, !shared));+ const clause = shared ? `, with ${SOFTNESS_CLAUSE[clauseSoftness]}` : "";+ return `Relight the photo with ${joinLights(parts)}. The scene is in darkness, lit only by these lights${clause}. ${KEEP_WORDS}`;+}++/** The words that go to the model: the typed prompt, word for word, when there is one. */+export function promptFor(lights: readonly Light[], override?: string | null, wording: SoftnessWording = "auto"): string {+ const typed = override?.trim();+ return typed ? typed : relightPrompt(lights, wording);+}++// ---------------------------------------------------------------------------+// Seeds and keys++/** A stable 31-bit seed from the photo, so moving one light changes only that light. */+export function seedFor(photoKey: string): number {+ let h = 0x811c9dc5;+ for (let i = 0; i < photoKey.length; i++) {+ h ^= photoKey.charCodeAt(i);+ h = Math.imul(h, 0x01000193);+ }+ return (h >>> 0) % 2147483647;+}++/** What a result is cached by: the words, the engine variant, the seed and the guide. */+export function resultKey(o: { prompt: string; variant: string; seed: number; guide?: boolean }): string {+ return `${o.variant}|${o.seed}|${o.guide ? 1 : 0}|${o.prompt}`;+}++/** What a run stores in params.extra.relight (Reuse and Retry put the rig back). */+export interface RelightExtra {+ lights: Light[];+ look?: LookId;+ seed: number;+ variant: string;+ guide: boolean;+ /** The words were typed, not written from the lights. */+ typed?: boolean;+}++export function relightExtraOf(extra: unknown): RelightExtra | null {+ const r = (extra as { relight?: unknown } | undefined)?.relight;+ if (!r || typeof r !== "object") return null;+ const o = r as Record<string, unknown>;+ const lights = sanitizeLights(o.lights);+ if (!lights.length) return null;+ return {+ lights,+ ...(getLook(o.look as string) && { look: o.look as LookId }),+ seed: typeof o.seed === "number" && Number.isFinite(o.seed) ? Math.abs(Math.trunc(o.seed)) % 2147483647 : 0,+ variant: typeof o.variant === "string" ? o.variant.slice(0, 32) : "",+ guide: o.guide === true,+ ...(o.typed === true && { typed: true }),+ };+}diff --git a/src/lib/relight/shader.ts b/src/lib/relight/shader.tsnew file mode 100644index 00000000..4ac666dc--- /dev/null+++ b/src/lib/relight/shader.ts@@ -0,0 +1,291 @@+/**+ * The Relight tool's instant preview and Intensity blend: one WebGL1 program (as Color grading's), redrawn once per+ * change, never in a loop. Pure: the GLSL and the uniforms it takes; src/components/relight/relight-renderer.ts draws.+ *+ * Before Generate (mode 0) it paints the placed lights onto the photo in linear light: a lights-only estimate+ * (the photo's own texture times ambient plus each light's falloff, wrapped diffuse and rim) mixed with the photo by+ * Intensity. With a scene read, surfaces face where the depth map says and "behind" lights rim the cut-out's edge;+ * without one, a soft guess from the photo's shading. After Generate (mode 1) it blends the original with the relit+ * picture, lined up by the alignment fit: a plain mix, or light transfer (the original's detail, the new light).+ */+import { hexToRgb, MAX_LIGHTS, srgbToLinear, strengthValueOf, type Distance, type Light, type Softness } from "./lights";+import type { BlendMode } from "./engine";++export const VERTEX = `+attribute vec2 a_pos;+varying vec2 vUv;+void main() {+ vUv = vec2(a_pos.x * 0.5 + 0.5, 0.5 - a_pos.y * 0.5);+ gl_Position = vec4(a_pos, 0.0, 1.0);+}`;++export const FRAGMENT = `+precision highp float;+varying vec2 vUv;+uniform sampler2D uPhoto;+uniform sampler2D uDepth;+uniform sampler2D uMatte;+uniform sampler2D uRelit;+uniform float uAspect;+uniform vec2 uTexel;+uniform vec2 uDepthTexel;+uniform float uHasScene;+uniform float uSubjectZ;+uniform float uMode;+uniform float uIntensity;+uniform float uAmbient;+uniform float uGlow;+uniform float uOriginal;+uniform float uBlend;+uniform float uBlur;+uniform vec4 uAlign;+uniform int uCount;+uniform vec3 uPos[${MAX_LIGHTS}];+uniform vec3 uColor[${MAX_LIGHTS}];+uniform vec4 uParams[${MAX_LIGHTS}];++const float Z = 0.6;++vec3 toLin(vec3 c) { return mix(c / 12.92, pow((c + 0.055) / 1.055, vec3(2.4)), step(0.04045, c)); }+vec3 toSrgb(vec3 c) { c = max(c, 0.0); return mix(c * 12.92, 1.055 * pow(c, vec3(1.0 / 2.4)) - 0.055, step(0.0031308, c)); }+float luma(vec3 c) { return dot(c, vec3(0.2126, 0.7152, 0.0722)); }+vec3 knee(vec3 c) {+ float k = 0.8;+ vec3 over = max(c - k, 0.0);+ return min(c, vec3(k)) + (1.0 - k) * (1.0 - exp(-over / (1.0 - k)));+}+vec3 photo(vec2 uv) { return toLin(texture2D(uPhoto, uv).rgb); }+vec3 relit(vec2 uv) { return toLin(texture2D(uRelit, vec2(uAlign.x * uv.x + uAlign.y, uAlign.z * uv.y + uAlign.w)).rgb); }+float depthAt(vec2 uv) { return texture2D(uDepth, uv).r; }+float matteAt(vec2 uv) { return texture2D(uMatte, uv).r; }++vec3 blurPhoto(vec2 uv) {+ vec2 r = vec2(uBlur / uAspect, uBlur);+ vec3 s = photo(uv) * 0.25;+ s += (photo(uv + vec2(r.x, 0.0)) + photo(uv - vec2(r.x, 0.0)) + photo(uv + vec2(0.0, r.y)) + photo(uv - vec2(0.0, r.y))) * 0.125;+ s += (photo(uv + r) + photo(uv - r) + photo(uv + vec2(r.x, -r.y)) + photo(uv - vec2(r.x, -r.y))) * 0.0625;+ return s;+}+vec3 blurRelit(vec2 uv) {+ vec2 r = vec2(uBlur / uAspect, uBlur);+ vec3 s = relit(uv) * 0.25;+ s += (relit(uv + vec2(r.x, 0.0)) + relit(uv - vec2(r.x, 0.0)) + relit(uv + vec2(0.0, r.y)) + relit(uv - vec2(0.0, r.y))) * 0.125;+ s += (relit(uv + r) + relit(uv - r) + relit(uv + vec2(r.x, -r.y)) + relit(uv - vec2(r.x, -r.y))) * 0.0625;+ return s;+}++vec3 glow(vec3 base, vec2 p) {+ vec3 o = base;+ for (int i = 0; i < ${MAX_LIGHTS}; i++) {+ if (i >= uCount) break;+ vec2 d = p - uPos[i].xy;+ float h = exp(-dot(d, d) / 0.0036) * 0.55 + exp(-dot(d, d) / 0.04) * 0.18;+ vec3 c = toSrgb(uColor[i]) * h;+ o = 1.0 - (1.0 - o) * (1.0 - clamp(c, 0.0, 1.0));+ }+ return o;+}++void main() {+ vec2 uv = vUv;+ vec3 P = photo(uv);+ if (uOriginal > 0.5) { gl_FragColor = vec4(toSrgb(P), 1.0); return; }+ vec2 p = vec2(uv.x * uAspect, uv.y);+ vec3 outc;+ if (uMode > 0.5) {+ float t = uIntensity;+ if (uBlend > 0.5) {+ vec3 ratio = clamp(blurRelit(uv) / max(blurPhoto(uv), vec3(0.004)), 0.0, 8.0);+ outc = P * mix(vec3(1.0), ratio, t);+ } else {+ outc = mix(P, relit(uv), t);+ }+ } else {+ // The photo's own texture: its colour over its local brightness, so skin and fabric keep their detail.+ vec2 r = vec2(uBlur / uAspect, uBlur) * 1.5;+ float lc = luma(P);+ float l1 = luma(photo(uv + vec2(r.x, 0.0)));+ float l2 = luma(photo(uv - vec2(r.x, 0.0)));+ float l3 = luma(photo(uv + vec2(0.0, r.y)));+ float l4 = luma(photo(uv - vec2(0.0, r.y)));+ float lb = (lc * 2.0 + l1 + l2 + l3 + l4) / 6.0;+ vec3 albedo = P * pow(0.25 / (lb + 0.05), 0.5);+ float d = uHasScene > 0.5 ? depthAt(uv) : 0.5;+ vec3 N;+ if (uHasScene > 0.5) {+ vec2 e = uDepthTexel * 1.5;+ float dx = (depthAt(uv + vec2(e.x, 0.0)) - depthAt(uv - vec2(e.x, 0.0))) * Z / (2.0 * e.x * uAspect);+ float dy = (depthAt(uv + vec2(0.0, e.y)) - depthAt(uv - vec2(0.0, e.y))) * Z / (2.0 * e.y);+ N = normalize(vec3(-dx, -dy, 1.0));+ } else {+ N = normalize(vec3(-(l1 - l2) * 3.0, -(l3 - l4) * 3.0, 1.0));+ }+ N = normalize(mix(N, vec3(0.0, 0.0, 1.0), 0.3));+ float m = uHasScene > 0.5 ? matteAt(uv) : 1.0;+ vec2 em = uDepthTexel * 2.0;+ vec2 gm = vec2(matteAt(uv + vec2(em.x, 0.0)) - matteAt(uv - vec2(em.x, 0.0)), matteAt(uv + vec2(0.0, em.y)) - matteAt(uv - vec2(0.0, em.y)));+ float edge = clamp(length(gm) * 2.5, 0.0, 1.0);+ vec3 S = vec3(p, d * Z);+ vec3 C = vec3(0.0);+ for (int i = 0; i < ${MAX_LIGHTS}; i++) {+ if (i >= uCount) break;+ vec3 Ld = uPos[i] - S;+ float radius = uParams[i].y;+ float fall = exp(-dot(Ld.xy, Ld.xy) / (radius * radius));+ vec3 L = normalize(Ld);+ float w = uParams[i].z;+ float diffuse = clamp((dot(N, L) + w) / (1.0 + w), 0.0, 1.0);+ float k;+ if (uParams[i].w > 0.5) {+ float fallRim = exp(-dot(Ld.xy, Ld.xy) / (radius * radius * 2.5));+ if (uHasScene > 0.5) {+ vec2 outward = length(gm) > 1e-4 ? -normalize(gm) : vec2(0.0);+ float facing = 0.4 + 0.6 * clamp(dot(outward, normalize(Ld.xy + vec2(1e-5))), 0.0, 1.0);+ k = edge * facing * fallRim * 2.2 + pow(1.0 - N.z, 3.0) * fallRim * m;+ } else {+ k = fallRim * 0.35;+ }+ } else {+ // The far wall stays darker than the subject when the light is close: off the subject, falloff counts its depth too.+ float fall3 = exp(-dot(Ld, Ld) / (radius * radius));+ k = mix(fall3, fall, m) * diffuse;+ }+ C += uColor[i] * uParams[i].x * k;+ }+ vec3 lit = albedo * (uAmbient + C);+ outc = mix(P, lit, uIntensity);+ }+ vec3 o = toSrgb(knee(outc));+ if (uGlow > 0.5) o = glow(o, p);+ gl_FragColor = vec4(o, 1.0);+}`;++/** How far each distance band reaches, in picture heights. */+const RADIUS: Record<Distance, number> = { close: 0.28, mid: 0.5, far: 0.95 };+/** Toward the camera from the subject; behind lights sit behind it. */+const Z_OFFSET: Record<Distance, number> = { close: 0.15, mid: 0.4, far: 1.0 };+const SOFT_VALUE: Record<Softness, number> = { hard: 0, soft: 0.5, diffuse: 1 };+const WRAP: Record<Softness, number> = { hard: 0, soft: 0.35, diffuse: 0.7 };+const Z = 0.6;++const clamp = (v: number, lo: number, hi: number) => (Number.isFinite(v) ? Math.min(hi, Math.max(lo, v)) : lo);++export interface SceneInfo {+ /** A depth map and matte are loaded. */+ hasScene: boolean;+ /** The subject's median depth (0 far … 1 near); 0.5 without a scene. */+ subjectDepth: number;+}++/** Where the relit picture's pixels sit: relit uv = (sx·x + tx, sy·y + ty), in uv units. Identity = no shift. */+export interface AlignFit {+ sx: number;+ tx: number;+ sy: number;+ ty: number;+}++export const IDENTITY_FIT: AlignFit = { sx: 1, tx: 0, sy: 1, ty: 0 };++export interface StageState {+ lights: readonly Light[];+ intensity: number;+ /** The width / height of the photo. */+ aspect: number;+ scene: SceneInfo;+ /** 1 when a relit picture is shown. */+ mode: "preview" | "result";+ blend: BlendMode;+ glow: boolean;+ original: boolean;+ align?: AlignFit;+ ambient: number;+ /** The photo's size in pixels (texel sizes). */+ width: number;+ height: number;+ depthWidth?: number;+ depthHeight?: number;+}++export interface Uniforms {+ scalars: Record<string, number>;+ ints: Record<string, number>;+ vec2: Record<string, [number, number]>;+ vec4: Record<string, [number, number, number, number]>;+ arrays: { uPos: number[]; uColor: number[]; uParams: number[] };+}++/** One light's packed values: position (x·aspect, 1−y, z), linear colour × nothing, and power, radius, wrap, behind. */+export function packLight(l: Light, aspect: number, subjectDepth: number) {+ const a = clamp(aspect, 0.1, 10);+ const soft = SOFT_VALUE[l.softness] ?? 0.5;+ const radius = clamp(RADIUS[l.distance] * (0.7 + 0.6 * soft), 0.05, 2);+ const z = clamp(subjectDepth, 0, 1) * Z + (l.behind ? -0.25 : Z_OFFSET[l.distance]);+ const power = clamp(strengthValueOf(l) * 1.5, 0, 2);+ const [r, g, b] = hexToRgb(l.color).map(srgbToLinear);+ return {+ pos: [clamp(l.x, 0, 1) * a, 1 - clamp(l.y, 0, 1), z] as [number, number, number],+ color: [r, g, b] as [number, number, number],+ params: [power, radius, WRAP[l.softness] ?? 0.35, l.behind ? 1 : 0] as [number, number, number, number],+ };+}++/** Every uniform for one draw, clamped; at most MAX_LIGHTS lights are packed. */+export function uniforms(s: StageState): Uniforms {+ const aspect = clamp(s.aspect, 0.1, 10);+ const subject = s.scene.hasScene ? clamp(s.scene.subjectDepth, 0, 1) : 0.5;+ const lights = s.lights.slice(0, MAX_LIGHTS);+ const pos: number[] = [];+ const color: number[] = [];+ const params: number[] = [];+ for (let i = 0; i < MAX_LIGHTS; i++) {+ const l = lights[i];+ const p = l ? packLight(l, aspect, subject) : { pos: [0, 0, 0], color: [0, 0, 0], params: [0, 1, 0, 0] };+ pos.push(...p.pos);+ color.push(...p.color);+ params.push(...p.params);+ }+ const fit = s.align ?? IDENTITY_FIT;+ const short = Math.max(1, Math.min(s.width, s.height));+ return {+ scalars: {+ uAspect: aspect,+ uHasScene: s.scene.hasScene ? 1 : 0,+ uSubjectZ: subject,+ uMode: s.mode === "result" ? 1 : 0,+ uIntensity: clamp(s.intensity, 0, 1),+ uAmbient: clamp(s.ambient, 0, 0.5),+ uGlow: s.glow ? 1 : 0,+ uOriginal: s.original ? 1 : 0,+ uBlend: s.blend === "transfer" ? 1 : 0,+ // σ ≈ 1.2 % of the short side, as a fraction of the height.+ uBlur: clamp((0.012 * short) / Math.max(1, s.height), 0.002, 0.05),+ },+ ints: { uCount: lights.length },+ vec2: {+ uTexel: [1 / Math.max(1, s.width), 1 / Math.max(1, s.height)],+ uDepthTexel: [1 / Math.max(1, s.depthWidth ?? 512), 1 / Math.max(1, s.depthHeight ?? 512)],+ },+ vec4: { uAlign: [clamp(fit.sx, 0.8, 1.25), clamp(fit.tx, -0.25, 0.25), clamp(fit.sy, 0.8, 1.25), clamp(fit.ty, -0.25, 0.25)] },+ arrays: { uPos: pos, uColor: color, uParams: params },+ };+}++/** The subject's median depth from a depth map and its matte (both one value per pixel, 0..255). */+export function subjectDepthOf(depth: ArrayLike<number>, matte: ArrayLike<number> | null): number {+ const n = depth.length;+ const hist = new Uint32Array(256);+ let count = 0;+ for (let i = 0; i < n; i++) {+ if (matte && matte[i] < 153) continue;+ hist[depth[i] & 255]++;+ count++;+ }+ if (!count) return 0.5;+ let acc = 0;+ for (let v = 0; v < 256; v++) {+ acc += hist[v];+ if (acc >= count / 2) return v / 255;+ }+ return 0.5;+}diff --git a/tests/comfy-library-4.test.ts b/tests/comfy-library-4.test.tsindex b3c2e1ef..8b7cf3db 100644--- a/tests/comfy-library-4.test.ts+++ b/tests/comfy-library-4.test.ts@@ -103,6 +103,9 @@ describe("round-4 ComfyUI workflows", () => {"qwen-image-21-t2i","qwen-image-21-edit","qwen-image-21-turbo-edit",+ // Relight's graphs wait for their first GPU run (Viggle's node file isn't on this server).+ "qwen-image-21-relight",+ "relight-scene-read","qwen-image-21-live-edit","qwen-image-21-inpaint","qwen-image-21-outpaint",diff --git a/tests/default-prompts-positive.test.ts b/tests/default-prompts-positive.test.tsindex 3ca60a11..980425e8 100644--- a/tests/default-prompts-positive.test.ts+++ b/tests/default-prompts-positive.test.ts@@ -7,6 +7,7 @@ import { customPack, getPack, SHEET_PROMPT, shotPrompt } from "@/lib/catalog/pacimport { SHEET_FRONT_PROMPT } from "@/lib/catalog/turnaround";import type { Preset } from "@/lib/catalog/types";import { ENHANCE_LOOKS, enhancePrompt, RELIGHT_DIRECTIONS, RELIGHT_LIGHTS, relightPrompt } from "@/lib/layers";+import { LOOKS, lightsOfLook, relightPrompt as lightsPrompt } from "@/lib/relight/lights";// Default prompts name only what is wanted: an unwanted thing, even negated ("no text", "without a cut"), tends to// show up in the picture or the clip.@@ -74,4 +75,12 @@ describe("default prompts name only what is wanted", () => {"Relight <image1>: soft natural window light. Keep every person, face, pose, object, the setting and the framing exactly as in <image1>, same film grain.",);});++ it("the Relight tool's words, written from the placed lights (every look)", () => {+ for (const look of LOOKS) {+ expect(lightsPrompt(lightsOfLook(look)), look.id).not.toMatch(NEGATION);+ expect(lightsPrompt(lightsOfLook(look), "shared"), look.id).not.toMatch(NEGATION);+ }+ expect(lightsPrompt(lightsOfLook(LOOKS[0]))).toMatch(/The scene is in darkness, lit only by these lights/);+ });});diff --git a/tests/e2e/relight.mjs b/tests/e2e/relight.mjsnew file mode 100644index 00000000..d27b24f7--- /dev/null+++ b/tests/e2e/relight.mjs@@ -0,0 +1,200 @@+// Browser check of Relight (the app's own tool: tap to place lights, a live preview, Generate lighting, Intensity).+// Usage: node tests/e2e/relight.mjs [appUrl] [outDir] [--guest guestAppUrl]+// appUrl: the app signed in as the owner, its ComfyUI a stand-in (tests/helpers/fake-comfy-runner.ts --output image).+// --guest: the same build with public sign-up on, seen signed out.+// Checks, on a phone (390 x 844, touch) and a desktop (1440 x 900): the page opens on the demo with its result and no+// sideways scroll; an Intensity chip changes the picture at once; a tap on the photo places a light where it was tapped;+// a colour chip changes the light near it and leaves the far corner alone; a look places its lights; Download gives a+// PNG at the photo's size; on the desktop the arrow keys move the selected light and Delete removes it; Generate+// lighting runs the hidden relight model on the stand-in and the result comes back. With --guest: a guest uses the demo,+// places a light, and Generate asks them to create an account (no error toast). A page error fails the run.+import fs from "node:fs";+import path from "node:path";+import { DESKTOP, PHONE, launch, openRoute } from "./_browser.mjs";++const argv = process.argv.slice(2);+const guestAt = argv.indexOf("--guest");+const guestApp = guestAt >= 0 ? argv[guestAt + 1] : null;+const args = argv.filter((a, i) => !a.startsWith("--") && i !== guestAt + 1);+const app = args[0] ?? "http://127.0.0.1:3330";+const out = args[1] ?? fs.mkdtempSync(path.join(process.env.TMPDIR ?? "/tmp", "fuobe-relight-"));+fs.mkdirSync(out, { recursive: true });++const failures = [];+const check = (ok, what) => {+ console.log(`${ok ? "✓" : "✗"} ${what}`);+ if (!ok) failures.push(what);+};++/** The stage's pixels at fractions (x 0 left … 1 right, y 0 top … 1 bottom) of the canvas. */+const pixels = (page, spots) =>+ page.evaluate((spots) => {+ const c = document.querySelector('[data-testid="relight-stage"] canvas');+ const t = document.createElement("canvas");+ t.width = c.width;+ t.height = c.height;+ const x = t.getContext("2d");+ x.drawImage(c, 0, 0);+ return spots.map(([fx, fy]) => [...x.getImageData(Math.min(c.width - 1, Math.round(fx * c.width)), Math.min(c.height - 1, Math.round(fy * c.height)), 1, 1).data.slice(0, 3)]);+ }, spots);+const diff = (a, b) => Math.max(...a.map((v, i) => Math.abs(v - b[i])));+const markers = (page) =>+ page.$$eval('[data-testid="relight-stage"] [data-light]', (els) => {+ const box = document.querySelector('[data-testid="relight-stage"]').getBoundingClientRect();+ return els.map((e) => {+ const r = e.getBoundingClientRect();+ return { x: (r.left + r.width / 2 - box.left) / box.width, y: (r.top + r.height / 2 - box.top) / box.height, color: getComputedStyle(e.firstElementChild).backgroundColor };+ });+ });+const settle = (page) => page.waitForTimeout(250);++async function stageBox(page) {+ const s = page.locator('[data-testid="relight-stage"]');+ await s.scrollIntoViewIfNeeded();+ return s.boundingBox();+}+async function tapAt(page, device, fx, fy) {+ const b = await stageBox(page);+ const x = b.x + fx * b.width;+ const y = b.y + fy * b.height;+ if (device.hasTouch) await page.touchscreen.tap(x, y);+ else await page.mouse.click(x, y);+ await settle(page);+}++async function ownerRun(browser, name, device) {+ const ctx = await browser.newContext({ ...device, acceptDownloads: true });+ const page = await ctx.newPage();+ page.on("pageerror", (e) => check(false, `${name}: no page error (${String(e.message).slice(0, 160)})`));+ const runs = [];+ page.on("request", (r) => {+ if (r.method() === "POST" && new URL(r.url()).pathname === "/api/generations") runs.push(JSON.parse(r.postData() ?? "{}"));+ });+ await openRoute(page, `${app}/apps/app-relight`);+ await page.locator('[data-testid="relight-stage"] canvas').waitFor();+ await page.waitForTimeout(1500);+ const over = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);+ check(over <= 0, `${name}: no horizontal scroll (${over}px)`);+ check(await page.getByText("Light your photo like a set.").isVisible(), `${name}: the hero line`);+ check(await page.getByRole("button", { name: /Lit with these lights/ }).isVisible(), `${name}: the demo opens with its result`);+ const text = await page.locator("main, body").first().innerText();+ const named = /Viggle|Qwen|LoRA|\bseed\b|6-step/i.exec(text.replace(/viggle-6/g, ""));+ check(!named, `${name}: no model, add-on or step names outside the owner's line${named ? ` (…${text.slice(Math.max(0, named.index - 60), named.index + 40)}…)` : ""}`);+ await page.screenshot({ path: path.join(out, `${name}-demo.png`), fullPage: false });++ // Intensity: instant.+ const spots = [+ [0.3, 0.4],+ [0.7, 0.6],+ [0.5, 0.2],+ ];+ const before = await pixels(page, spots);+ await page.getByRole("radiogroup", { name: "Intensity" }).getByRole("radio", { name: "100 %" }).click();+ await settle(page);+ const after = await pixels(page, spots);+ check(spots.some((_, i) => diff(before[i], after[i]) > 4), `${name}: Intensity 100 % changes the picture at once`);+ await page.getByRole("radiogroup", { name: "Intensity" }).getByRole("radio", { name: "60 %" }).click();++ // Download: a PNG at the photo's size.+ const [download] = await Promise.all([page.waitForEvent("download"), page.getByRole("button", { name: "Download", exact: true }).click()]);+ const file = path.join(out, `${name}-download.png`);+ await download.saveAs(file);+ const png = fs.readFileSync(file);+ check(png.subarray(1, 4).toString() === "PNG" && png.readUInt32BE(16) === 1280 && png.readUInt32BE(20) === 960, `${name}: Download gives a 1280 x 960 PNG`);++ // A look places its lights.+ await page.getByRole("radiogroup", { name: "Looks" }).getByRole("radio", { name: "Neon night" }).click();+ await settle(page);+ const neon = await markers(page);+ check(neon.length === 2 && neon[0].color === "rgb(240, 40, 220)" && neon[1].color === "rgb(40, 96, 255)", `${name}: Neon night places magenta left and blue right`);+ check(neon[0].x < 0.35 && neon[1].x > 0.65, `${name}: its lights sit on their sides`);++ // A tap on an empty spot adds a light there.+ await tapAt(page, device, 0.5, 0.15);+ const three = await markers(page);+ const added = three[2];+ check(three.length === 3 && Math.abs(added.x - 0.5) < 0.02 && Math.abs(added.y - 0.15) < 0.02, `${name}: a tap places a light where tapped (${added ? `${added.x.toFixed(3)}, ${added.y.toFixed(3)}` : "none"})`);+ check(await page.getByTestId("lights-changed").isVisible(), `${name}: "Lights changed" shows`);+ await page.screenshot({ path: path.join(out, `${name}-three-lights.png`) });++ // A colour chip changes the light near it and leaves the far corner alone.+ const near = [[0.5, 0.18]];+ const far = [[0.02, 0.98]];+ const n0 = await pixels(page, [...near, ...far]);+ await page.getByRole("radiogroup", { name: "Colour" }).getByRole("radio", { name: "Teal" }).click();+ await settle(page);+ const n1 = await pixels(page, [...near, ...far]);+ check(diff(n0[0], n1[0]) > 6, `${name}: Teal changes the picture near the light (${diff(n0[0], n1[0])})`);+ check(diff(n0[1], n1[1]) <= 3, `${name}: the far corner stays the same (${diff(n0[1], n1[1])})`);++ if (!device.hasTouch) {+ // Desktop extras: the arrow keys move the selected light, Delete removes it.+ await page.locator('[data-testid="relight-stage"]').focus();+ const m0 = (await markers(page))[2];+ await page.keyboard.press("ArrowRight");+ await settle(page);+ const m1 = (await markers(page))[2];+ check(m1.x > m0.x + 0.01, `${name}: ArrowRight moves the selected light`);+ await page.keyboard.press("Delete");+ await settle(page);+ check((await markers(page)).length === 2, `${name}: Delete removes it`);+ } else {+ await page.getByRole("button", { name: "Remove light", exact: true }).click();+ await settle(page);+ check((await markers(page)).length === 2, `${name}: Remove light removes it`);+ }++ // Generate lighting on the stand-in ComfyUI.+ await page.getByRole("radiogroup", { name: "Looks" }).getByRole("radio", { name: "Candlelight" }).click();+ await settle(page);+ const generate = page.getByRole("button", { name: /Generate lighting|Generate again/ }).last();+ await generate.click();+ await page.getByRole("button", { name: /Lit with these lights/ }).waitFor({ timeout: 60_000 }).catch(() => {});+ const lit = runs.find((r) => r.modelId === "oss-qwen-image-21-relight");+ check(!!lit && /warm amber light/.test(lit.prompt) && lit.inputs?.images?.[0]?.startsWith("/api/files/"), `${name}: Generate runs the relight model with the photo and the words`);+ check(await page.getByRole("button", { name: /Lit with these lights/ }).isVisible(), `${name}: the result comes back`);+ check(await page.getByRole("button", { name: "Keep", exact: true }).isVisible(), `${name}: Keep is offered to the owner`);+ await page.screenshot({ path: path.join(out, `${name}-generated.png`), fullPage: true });+ await ctx.close();+}++async function guestRun(browser, name, device) {+ const ctx = await browser.newContext({ ...device });+ const page = await ctx.newPage();+ page.on("pageerror", (e) => check(false, `${name}: no page error (${String(e.message).slice(0, 160)})`));+ await openRoute(page, `${guestApp}/apps/app-relight`);+ await page.locator('[data-testid="relight-stage"] canvas').waitFor();+ await page.waitForTimeout(1500);+ check(await page.getByRole("button", { name: /Lit with these lights/ }).isVisible(), `${name}: a guest sees the demo's result`);+ const before = await pixels(page, [[0.4, 0.4]]);+ await page.getByRole("radiogroup", { name: "Intensity" }).getByRole("radio", { name: "35 %" }).click();+ await settle(page);+ check(diff(before[0], (await pixels(page, [[0.4, 0.4]]))[0]) > 2, `${name}: Intensity works for a guest`);+ await tapAt(page, device, 0.5, 0.12);+ check((await markers(page)).length === 3, `${name}: a guest places a light`);+ await page.getByRole("button", { name: /Generate again|Generate lighting/ }).last().click();+ const prompt = page.getByText("Create a free account to run this");+ await prompt.waitFor({ timeout: 10_000 }).catch(() => {});+ check(await prompt.isVisible(), `${name}: Generate asks a guest to create an account`);+ check((await page.locator("[data-sonner-toast][data-type='error']").count()) === 0, `${name}: no error toast`);+ check(await page.getByText("Create a free account to light your own photos.").isVisible(), `${name}: the line under Generate says why`);+ await page.screenshot({ path: path.join(out, `${name}-guest.png`) });+ await ctx.close();+}++const browser = await launch();+try {+ await ownerRun(browser, "phone", PHONE);+ await ownerRun(browser, "desktop", DESKTOP);+ if (guestApp) {+ await guestRun(browser, "guest-phone", PHONE);+ await guestRun(browser, "guest-desktop", DESKTOP);+ }+} finally {+ await browser.close();+}+console.log(`\nScreenshots in ${out}`);+if (failures.length) {+ console.log(`${failures.length} check(s) failed`);+ process.exit(1);+}diff --git a/tests/gpu-requirements.test.ts b/tests/gpu-requirements.test.tsindex 06adf1b3..7ba0741f 100644--- a/tests/gpu-requirements.test.ts+++ b/tests/gpu-requirements.test.ts@@ -14,7 +14,7 @@ const read = (f: string) => fs.readFileSync(path.join(LIBRARY, f), "utf8");const text = read("requirements.json");const index = JSON.parse(text) as RequirementIndex;const manifest = JSON.parse(read("manifest.json")) as Manifest;-type PackPin = { repo: string; commit: string; registry: { id: string; version: string } | null; subdir: string | null; folders: string[]; isolated: boolean };+type PackPin = { repo: string; commit: string; registry: { id: string; version: string } | null; subdir: string | null; file?: string; folders: string[]; isolated: boolean };const packs = JSON.parse(read("packs.json")) as Record<string, PackPin>;const pins = JSON.parse(read("model-pins.json")) as Record<string, { revision: string; sizeBytes: number; sha256?: string }>;const script = (f: string) => fs.readFileSync(path.join(process.cwd(), "scripts/comfy", f), "utf8");@@ -174,7 +174,11 @@ describe("packs.json: the single source of pack pins", () => {expect(Object.keys(repos).sort()).toEqual(Object.keys(packs).sort());for (const [name, url] of Object.entries(repos)) {const tree = /^(https:\/\/github\.com\/[^/]+\/[^/]+)\/tree\/([0-9a-f]{40})(?:\/(.+))?$/.exec(url);- if (tree) {+ // One node file in a Hugging Face model repo (viggle_turbo): the repo, the commit and the file.+ const hfFile = /^(https:\/\/huggingface\.co\/[^/]+\/[^/]+)\/resolve\/([0-9a-f]{40})\/(.+\.py)$/.exec(url);+ if (hfFile) {+ expect({ repo: packs[name].repo, commit: packs[name].commit, file: packs[name].file }, name).toEqual({ repo: hfFile[1], commit: hfFile[2], file: hfFile[3] });+ } else if (tree) {expect({ repo: packs[name].repo, commit: packs[name].commit, subdir: packs[name].subdir }, name).toEqual({ repo: tree[1], commit: tree[2], subdir: tree[3] ?? null });} else {expect(packs[name].repo, name).toBe(url);diff --git a/tests/library-pure.test.ts b/tests/library-pure.test.tsindex 676ea97a..c2b8a9b4 100644--- a/tests/library-pure.test.ts+++ b/tests/library-pure.test.ts@@ -70,6 +70,7 @@ describe("outputActions", () => {"bar:download","bar:favorite","menu:edit",+ "menu:relight","menu:live-edit","menu:upscale","menu:reference",diff --git a/tests/relight.test.ts b/tests/relight.test.tsnew file mode 100644index 00000000..dd67750f--- /dev/null+++ b/tests/relight.test.ts@@ -0,0 +1,503 @@+import fs from "node:fs";+import path from "node:path";+import { createElement } from "react";+import { renderToStaticMarkup } from "react-dom/server";+import { describe, expect, it } from "vitest";+import { LightPanel, LooksRow } from "@/components/relight/relight-panel";+import { APPS, getModel, getPreset } from "@/lib/catalog";+import type { Generation } from "@/lib/catalog/types";+import { commandsFor } from "@/lib/gpu/commands";+import { emptyInventory } from "@/lib/gpu/gather";+import { parseIndex } from "@/lib/gpu/requirements";+import type { RequirementIndex } from "@/lib/gpu/types";+import { outputActions } from "@/lib/output-actions";+import { alignFit, mapPx, WORK } from "@/lib/relight/align";+import { blendPlain, blendTransfer } from "@/lib/relight/blend";+import { DEFAULT_DEMO, RELIGHT_DEMOS } from "@/lib/relight/demo";+import { RELIGHT_MODEL, RELIGHT_SCENE_FEATURE, RELIGHT_SCENE_MODEL, RELIGHT_SETTINGS, relightRequest, sceneRequest } from "@/lib/relight/engine";+import { drawGuide } from "@/lib/relight/guide";+import {+ BAND_CENTER,+ COLOR_CHIPS,+ colorWords,+ defaultLight,+ DISTANCES,+ FEATURED_LOOKS,+ getLook,+ heightFromY,+ HEIGHTS,+ isLook,+ lightAt,+ lightsOfLook,+ LOOKS,+ lookFromLegacy,+ MAX_LIGHTS,+ moveLight,+ promptFor,+ relightExtraOf,+ relightPrompt,+ sanitizeLights,+ seedFor,+ sideOf,+ SOFTNESSES,+ srgbToLinear,+ STRENGTHS,+ yForHeight,+ type Light,+} from "@/lib/relight/lights";+import { FRAGMENT, packLight, subjectDepthOf, uniforms, type StageState } from "@/lib/relight/shader";+import { isHelperFeature } from "@/lib/library";++const NEGATION = /\b(no|not|never|nothing|none|without|don't|do not|doesn't|avoid|remove|removed)\b/i;+const ROOT = path.join(__dirname, "..");++const light = (o: Partial<Light> = {}): Light => ({ id: "l1", color: "#ff8a2a", x: 0.2, y: 0.55, height: "face", distance: "mid", softness: "soft", strength: "high", ...o });++describe("the words written from the lights", () => {+ it("name only what is wanted, for every look and every chip", () => {+ for (const look of LOOKS) expect(relightPrompt(lightsOfLook(look)), look.id).not.toMatch(NEGATION);+ for (const color of COLOR_CHIPS)+ for (const h of HEIGHTS)+ for (const d of DISTANCES)+ for (const s of SOFTNESSES)+ for (const st of STRENGTHS)+ for (const behind of [false, true])+ for (const x of [0.1, 0.5, 0.9]) {+ const p = relightPrompt([light({ color: color.hex, height: h, distance: d, softness: s, strength: st, behind, x })]);+ expect(p).not.toMatch(NEGATION);+ }+ });++ it("say the darkness the lights work in, and what stays the same", () => {+ const p = relightPrompt([light()]);+ expect(p).toMatch(/^Relight the photo with a strong sunset orange light coming from the left, at face height, at a medium distance\. The scene is in darkness, lit only by these lights, with soft light/);+ expect(p).toContain("Keep the person's identity, face, expression, pose, hair, clothing and the background exactly the same");+ });++ it("join one to three lights, and never more", () => {+ const three = [light(), light({ id: "l2", x: 0.9, color: "#2860ff" }), light({ id: "l3", x: 0.5, height: "high", color: "#f028dc" })];+ expect(relightPrompt(three)).toMatch(/sunset orange light coming from the left[^;]*; a strong electric neon blue light coming from the right[^;]*; and a strong vivid neon magenta light coming from the front, high above/);+ expect(relightPrompt([...three, light({ id: "l4", color: "#ffffff" })])).not.toContain("clean white");+ expect(relightPrompt([])).toBe("");+ });++ it("say softness once when the lights agree, per light when they differ, or the softest once when asked", () => {+ const same = relightPrompt([light({ softness: "hard" }), light({ id: "l2", softness: "hard", x: 0.9 })]);+ expect(same).toContain("with hard, crisp light and sharp, defined shadows");+ expect(same).not.toContain("strong hard, crisp");+ const mixed = relightPrompt([light({ softness: "hard" }), light({ id: "l2", softness: "diffuse", x: 0.9 })]);+ expect(mixed).toContain("a strong hard, crisp sunset orange light");+ expect(mixed).toContain("a strong broad, diffused sunset orange light");+ expect(relightPrompt([light({ softness: "hard" }), light({ id: "l2", softness: "diffuse", x: 0.9 })], "shared")).toContain("with soft, diffused light and gentle shadow falloff");+ });++ it("put a behind light on the subject's edge", () => {+ expect(relightPrompt([light({ behind: true, x: 0.85 })])).toContain("behind the subject, rimming the right edge of the silhouette");+ expect(relightPrompt([light({ behind: true, x: 0.5 })])).toContain("rimming the top edge");+ });++ it("use typed words word for word, and back to auto when they are cleared", () => {+ expect(promptFor([light()], " Make it moody ")).toBe("Make it moody");+ expect(promptFor([light()], " ")).toBe(relightPrompt([light()]));+ });+});++describe("colours", () => {+ it("say each chip's own words", () => {+ expect(COLOR_CHIPS.map((c) => c.label)).toEqual(["Warm", "Cool", "Teal", "Magenta", "Sunset", "Neon blue", "White"]);+ for (const c of COLOR_CHIPS) expect(colorWords(c.hex)).toBe(c.words);+ expect(colorWords("#FF8A2A")).toBe("sunset orange");+ });++ it("name a custom colour after the nearest name in Lab", () => {+ expect(colorWords("#ff2a2a")).toBe("red");+ expect(colorWords("#20c0b8")).toBe("teal");+ expect(colorWords("#9a40ff")).toBe("purple");+ expect(colorWords("#f6f6f6")).toBe("clean white");+ });+});++describe("placing lights", () => {+ it("sets the height band from where the photo was tapped", () => {+ expect(heightFromY(0.9)).toBe("high");+ expect(heightFromY(0.5)).toBe("face");+ expect(heightFromY(0.1)).toBe("low");+ expect(yForHeight(0.5, "face")).toBe(0.5);+ expect(yForHeight(0.5, "high")).toBe(BAND_CENTER.high);+ expect(sideOf(0.2)).toBe("left");+ expect(sideOf(0.5)).toBe("front");+ expect(sideOf(0.8)).toBe("right");+ });++ it("adds a light where tapped, up to three", () => {+ let ls: Light[] = [];+ for (const [x, y] of [+ [0.1, 0.9],+ [0.8, 0.2],+ [0.5, 0.5],+ ]) {+ const l = lightAt(ls, x, y)!;+ expect(l).toMatchObject({ x, y });+ ls = [...ls, l];+ }+ expect(ls.map((l) => l.height)).toEqual(["high", "low", "face"]);+ expect(new Set(ls.map((l) => l.id)).size).toBe(3);+ expect(new Set(ls.map((l) => l.color)).size).toBe(3);+ expect(lightAt(ls, 0.3, 0.3)).toBeNull();+ expect(defaultLight(ls)).toBeNull();+ expect(MAX_LIGHTS).toBe(3);+ });++ it("puts Add light at the default spots when nobody taps", () => {+ const a = defaultLight([])!;+ const b = defaultLight([a])!;+ const c = defaultLight([a, b])!;+ expect([a.x, b.x, c.x]).toEqual([0.2, 0.8, 0.5]);+ expect([a.height, b.height, c.height]).toEqual(["face", "face", "high"]);+ });++ it("moves a light and keeps it on the photo", () => {+ expect(moveLight(light(), 1.4, -0.2)).toMatchObject({ x: 1, y: 0, height: "low" });+ });++ it("reads only real lights back from a stored run", () => {+ const ls = sanitizeLights([{ color: "#FFF", x: 2, y: 0.5, distance: "huge", behind: "yes" }, { color: "nope", x: 0, y: 0 }, 5]);+ expect(ls).toEqual([{ id: "l1", color: "#ffffff", x: 1, y: 0.5, height: "face", distance: "mid", softness: "soft", strength: "high" }]);+ expect(relightExtraOf({ relight: { lights: [], seed: 1 } })).toBeNull();+ expect(relightExtraOf({ relight: { lights: [light()], seed: 12.7, variant: "viggle-6", guide: true } })).toMatchObject({ seed: 12, variant: "viggle-6", guide: true });+ });+});++describe("looks", () => {+ it("put the four named looks first, then the old app's five", () => {+ expect(FEATURED_LOOKS).toEqual(["golden-hour", "neon-night", "studio-rim", "candlelight"]);+ expect(LOOKS.map((l) => l.label)).toEqual(["Golden hour", "Neon night", "Studio rim", "Candlelight", "Studio softbox", "Dramatic", "Overcast", "Silhouette", "Window"]);+ });++ it("each place a valid rig that reads as that look", () => {+ for (const look of LOOKS) {+ const ls = lightsOfLook(look);+ expect(ls.length).toBeGreaterThan(0);+ expect(ls.length).toBeLessThanOrEqual(MAX_LIGHTS);+ expect(sanitizeLights(ls)).toEqual(ls);+ expect(isLook(ls, look)).toBe(true);+ expect(isLook(ls.map((l, i) => (i ? l : { ...l, x: l.x + 0.01 })), look)).toBe(false);+ }+ expect(lightsOfLook(getLook("neon-night")!).map((l) => [l.color, sideOf(l.x)])).toEqual([+ ["#f028dc", "left"],+ ["#2860ff", "right"],+ ]);+ });++ it("cover every lighting the old Relight app offered, so its runs reopen on a look", () => {+ const old = getPreset("app-relight")!.options!.find((o) => o.key === "light")!;+ for (const c of old.choices) expect(lookFromLegacy(c.label), c.label).toBeDefined();+ });+});++describe("the preview shader's values", () => {+ const state = (o: Partial<StageState> = {}): StageState => ({+ lights: [light()],+ intensity: 0.6,+ aspect: 4 / 3,+ scene: { hasScene: false, subjectDepth: 0.5 },+ mode: "preview",+ blend: "transfer",+ glow: true,+ original: false,+ ambient: 0.04,+ width: 1280,+ height: 960,+ ...o,+ });++ it("are clamped", () => {+ const u = uniforms(state({ intensity: 3, ambient: -1, aspect: 99, align: { sx: 3, tx: 9, sy: 0, ty: -9 } }));+ expect(u.scalars.uIntensity).toBe(1);+ expect(u.scalars.uAmbient).toBe(0);+ expect(u.scalars.uAspect).toBe(10);+ expect(u.vec4.uAlign).toEqual([1.25, 0.25, 0.8, -0.25]);+ expect(uniforms(state({ intensity: Number.NaN })).scalars.uIntensity).toBe(0);+ });++ it("pack at most three lights and pass the behind flag", () => {+ const four = [light(), light({ id: "l2" }), light({ id: "l3", behind: true }), light({ id: "l4" })];+ const u = uniforms(state({ lights: four }));+ expect(u.ints.uCount).toBe(3);+ expect(u.arrays.uPos).toHaveLength(9);+ expect(u.arrays.uParams.filter((_, i) => i % 4 === 3)).toEqual([0, 0, 1]);+ expect(FRAGMENT).toContain("uniform vec3 uPos[3]");+ });++ it("put the light where it sits on the photo, with a reach that follows distance and softness", () => {+ const p = packLight(light({ x: 0.25, y: 0.75 }), 2, 0.5);+ expect(p.pos[0]).toBeCloseTo(0.5);+ expect(p.pos[1]).toBeCloseTo(0.25);+ const close = packLight(light({ distance: "close", softness: "hard" }), 1, 0.5).params[1];+ const far = packLight(light({ distance: "far", softness: "diffuse" }), 1, 0.5).params[1];+ expect(far).toBeGreaterThan(close * 3);+ expect(packLight(light({ behind: true }), 1, 0.5).pos[2]).toBeLessThan(packLight(light(), 1, 0.5).pos[2]);+ });++ it("find the subject's depth from the depth map and its matte", () => {+ const depth = [10, 10, 200, 210, 220, 10];+ const matte = [0, 0, 255, 255, 255, 0];+ expect(subjectDepthOf(depth, matte)).toBeCloseTo(210 / 255);+ expect(subjectDepthOf(depth, [0, 0, 0, 0, 0, 0])).toBe(0.5);+ });+});++/** A textured picture (smoothed noise), for the alignment tests. */+function texture(size: number, seed = 7): Float32Array {+ let s = seed;+ const rnd = () => ((s = (s * 1664525 + 1013904223) >>> 0) / 2 ** 32);+ const raw = new Float32Array(size * size).map(rnd);+ const out = new Float32Array(size * size);+ for (let y = 0; y < size; y++)+ for (let x = 0; x < size; x++) {+ let a = 0;+ let n = 0;+ for (let dy = -2; dy <= 2; dy++)+ for (let dx = -2; dx <= 2; dx++) {+ const yy = Math.min(size - 1, Math.max(0, y + dy));+ const xx = Math.min(size - 1, Math.max(0, x + dx));+ a += raw[yy * size + xx];+ n++;+ }+ out[y * size + x] = a / n;+ }+ return out;+}++/** b(x, y) = a(sx·x + tx, sy·y + ty), bilinear, with a different brightness (the light changed). */+function warp(a: Float32Array, size: number, f: { sx: number; tx: number; sy: number; ty: number }): Float32Array {+ const out = new Float32Array(size * size);+ const at = (x: number, y: number) => a[Math.min(size - 1, Math.max(0, y)) * size + Math.min(size - 1, Math.max(0, x))];+ for (let y = 0; y < size; y++)+ for (let x = 0; x < size; x++) {+ const u = f.sx * x + f.tx;+ const v = f.sy * y + f.ty;+ const x0 = Math.floor(u);+ const y0 = Math.floor(v);+ const fx = u - x0;+ const fy = v - y0;+ const val = at(x0, y0) * (1 - fx) * (1 - fy) + at(x0 + 1, y0) * fx * (1 - fy) + at(x0, y0 + 1) * (1 - fx) * fy + at(x0 + 1, y0 + 1) * fx * fy;+ out[y * size + x] = val * 0.7 + 0.1;+ }+ return out;+}++describe("lining the relit picture up with the photo", () => {+ const photo = texture(WORK);++ it("recovers shifts of 3, 12 and 30 px and a 1 % scale within half a pixel", () => {+ for (const [sx, tx, sy, ty] of [+ [1, 3, 1, -3],+ [1, -12, 1, 12],+ [1, 30, 1, -30],+ [1.01, -2.5, 0.99, 2.6],+ ]) {+ // The relit picture shows photo content at photo(x) = relit(x'), where x = sx·x' + tx: content at photo x sits at+ // relit (x − tx) / sx.+ const relit = warp(photo, WORK, { sx, tx, sy, ty });+ const got = alignFit(photo, relit)!;+ expect(got, `${sx} ${tx}`).not.toBeNull();+ for (const px of [64, 256, 448]) {+ expect(Math.abs(mapPx(got.fit, "x", px) - (px - tx) / sx), `x ${tx} at ${px}`).toBeLessThan(0.5);+ expect(Math.abs(mapPx(got.fit, "y", px) - (px - ty) / sy), `y ${ty} at ${px}`).toBeLessThan(0.5);+ }+ }+ });++ it("gives up on a featureless picture (the blend then uses the pictures as they are)", () => {+ const flat = new Float32Array(WORK * WORK).fill(0.5);+ expect(alignFit(flat, flat)).toBeNull();+ });+});++describe("the Intensity blend", () => {+ const W = 32;+ const H = 32;+ const pic = (f: (x: number, y: number) => [number, number, number]) => {+ const a = new Uint8ClampedArray(W * H * 4);+ for (let y = 0; y < H; y++)+ for (let x = 0; x < W; x++) {+ const [r, g, b] = f(x, y);+ a.set([r, g, b, 255], (y * W + x) * 4);+ }+ return a;+ };+ // The original has fine detail (a checker); the relit picture is the same scene, smoother and lit warm from the left.+ const O = pic((x, y) => ((x + y) % 2 ? [150, 120, 100] : [110, 90, 70]));+ const R = pic((x) => [Math.max(30, 220 - x * 5), Math.max(20, 150 - x * 4), 40]);++ it("returns the original at 0 and, plain, the relit picture at 100 %", () => {+ expect([...blendPlain(O, R, 0)]).toEqual([...O]);+ expect([...blendTransfer(O, R, W, H, 0)]).toEqual([...O]);+ expect([...blendPlain(O, R, 1)]).toEqual([...R]);+ });++ it("keeps the original's detail in light transfer", () => {+ const out = blendTransfer(O, R, W, H, 1, 2);+ // Detail relative to its surroundings, in linear light: what the eye reads as texture whatever the light level.+ const hp = (a: ArrayLike<number>) => {+ const lin = (i: number) => srgbToLinear(a[i * 4 + 1]);+ const v: number[] = [];+ for (let y = 1; y < H - 1; y++) for (let x = 1; x < W - 1; x++) v.push(lin(y * W + x) / ((lin(y * W + x - 1) + lin(y * W + x + 1)) / 2) - 1);+ return v;+ };+ const a = hp(O);+ const b = hp(out);+ const ma = a.reduce((s, x) => s + x, 0) / a.length;+ const mb = b.reduce((s, x) => s + x, 0) / b.length;+ let num = 0;+ let da = 0;+ let db = 0;+ for (let i = 0; i < a.length; i++) {+ num += (a[i] - ma) * (b[i] - mb);+ da += (a[i] - ma) ** 2;+ db += (b[i] - mb) ** 2;+ }+ expect(num / Math.sqrt(da * db)).toBeGreaterThanOrEqual(0.98);+ // And the light moved: the left side is brighter than the right.+ expect(out[(16 * W + 2) * 4]).toBeGreaterThan(out[(16 * W + 29) * 4]);+ });+});++describe("the light-guide picture", () => {+ it("is the same pixels for the same rig and photo, and shows each light in its colour", () => {+ const W = 64;+ const H = 48;+ const photo = new Uint8ClampedArray(W * H * 4).fill(128);+ const rig = lightsOfLook(getLook("neon-night")!);+ const a = drawGuide(photo, W, H, rig);+ const b = drawGuide(photo, W, H, rig);+ expect(Buffer.from(a).equals(Buffer.from(b))).toBe(true);+ const at = (x: number, y: number) => [...a.slice((y * W + x) * 4, (y * W + x) * 4 + 3)];+ const left = at(4, 22);+ const right = at(60, 22);+ expect(left[0]).toBeGreaterThan(left[1]); // magenta+ expect(right[2]).toBeGreaterThan(right[0]); // blue+ expect(at(32, 2)[0]).toBeLessThan(128); // darkened where no light reaches+ });+});++describe("the runs", () => {+ it("Generate lighting runs the hidden Qwen-Image 2.1 relight model with the photo, the words and a seed from the photo", () => {+ const lights = lightsOfLook(getLook("neon-night")!);+ const req = relightRequest({ photo: "/api/files/uploads/me.jpg", guide: "/api/files/uploads/g.png", lights, look: "neon-night", seed: seedFor("/api/files/uploads/me.jpg") });+ expect(req).toMatchObject({ feature: "relight", modelId: RELIGHT_MODEL, op: "edit", inputs: { images: ["/api/files/uploads/me.jpg"] } });+ expect(req.prompt).toBe(relightPrompt(lights));+ // No preset id: a preset run would put the old app's words in front of the lights' own (planGeneration).+ expect(req.presetId).toBeUndefined();+ expect(sceneRequest("/api/files/x.png").presetId).toBeUndefined();+ expect(req.params?.seed).toBe(seedFor("/api/files/uploads/me.jpg"));+ expect(relightExtraOf(req.params?.extra)).toMatchObject({ lights, look: "neon-night", variant: RELIGHT_SETTINGS.variant, guide: false });+ expect(seedFor("a")).toBe(seedFor("a"));+ expect(seedFor("a")).not.toBe(seedFor("b"));+ });++ it("the scene read is a helper step the Library leaves out", () => {+ expect(sceneRequest("/api/files/x.png")).toMatchObject({ modelId: RELIGHT_SCENE_MODEL, inputs: { images: ["/api/files/x.png"] } });+ expect(isHelperFeature(RELIGHT_SCENE_FEATURE)).toBe(true);+ });++ it("the models are hidden and run their workflows", () => {+ expect(getModel(RELIGHT_MODEL)).toMatchObject({ hidden: true, routes: [expect.objectContaining({ op: "edit", provider: "comfyui", endpoint: "qwen-image-21-relight" })] });+ expect(getModel(RELIGHT_SCENE_MODEL)).toMatchObject({ hidden: true, routes: [expect.objectContaining({ provider: "comfyui", endpoint: "relight-scene-read" })] });+ expect(getModel("local-relight")?.routes).toEqual([{ op: "relight", provider: "local", endpoint: "webgl" }]);+ });++ it("the workflows are in the library, with Viggle's loader at 1.0 and its 6-step schedule", () => {+ const manifest = JSON.parse(fs.readFileSync(path.join(ROOT, "workflows/comfyui/manifest.json"), "utf8")) as { workflows: { id: string; bindings: Record<string, unknown>; outputs: { role?: string }[]; customNodes: { name: string }[] }[] };+ const wf = manifest.workflows.find((w) => w.id === "qwen-image-21-relight")!;+ expect(Object.keys(wf.bindings)).toEqual(expect.arrayContaining(["image", "image2", "prompt", "seed"]));+ expect(wf.customNodes.map((c) => c.name)).toEqual(["viggle_turbo"]);+ const graph = JSON.parse(fs.readFileSync(path.join(ROOT, "workflows/comfyui/qwen-image-21-relight.json"), "utf8")) as Record<string, { class_type: string; inputs: Record<string, unknown> }>;+ const lora = Object.values(graph).find((n) => n.class_type === "ViggleTurboLora")!;+ expect(lora.inputs).toMatchObject({ lora_name: "Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors", strength: 1 });+ expect(Object.values(graph).find((n) => n.class_type === "ViggleTurboSigmas")?.inputs.nodes).toBe("1.0, 0.9375, 0.875, 0.75, 0.5, 0.25");+ expect(Object.values(graph).some((n) => n.class_type === "CFGGuider")).toBe(false);+ const scene = manifest.workflows.find((w) => w.id === "relight-scene-read")!;+ expect(scene.outputs.map((o) => o.role)).toEqual(["depth", "matte"]);+ });++ it("the requirement index installs Viggle's node file by downloading it at its pinned revision", () => {+ const idx: RequirementIndex = parseIndex(JSON.parse(fs.readFileSync(path.join(ROOT, "workflows/comfyui/requirements.json"), "utf8")));+ expect(idx.workflows["qwen-image-21-relight"].packs).toEqual({ viggle_turbo: ["ViggleTurboLora", "ViggleTurboSigmas"] });+ expect(idx.workflows["qwen-image-21-relight"].files).toContain("loras/Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors");+ expect(idx.packs.viggle_turbo).toMatchObject({ file: "comfyui/viggle_turbo.py", commit: "009a44a895ef85f7e643c80fdca9543795248867" });+ const c = commandsFor([{ kind: "pack-install", pack: "viggle_turbo" }], { inv: emptyInventory("server", 1), idx });+ expect(c.bash).toContain(+ 'curl -L -C - --fail -o "$COMFY/custom_nodes/viggle_turbo/__init__.py" "https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/009a44a895ef85f7e643c80fdca9543795248867/comfyui/viggle_turbo.py"',+ );+ expect(c.bash).not.toContain("git clone");+ });+});++describe("where Relight lives", () => {+ it("keeps the app's id, its composer routes and words, and renders its own tool", () => {+ const app = APPS.find((a) => a.id === "app-relight")!;+ expect(app).toMatchObject({ tool: "relight", name: "Relight", open: { modelId: "oss-qwen-relight", op: "edit" } });+ expect(app.options?.map((o) => o.key)).toEqual(["light", "dir"]);+ const page = fs.readFileSync(path.join(ROOT, "src/app/(studio)/apps/[id]/page.tsx"), "utf8");+ expect(page).toMatch(/preset\.tool === "relight"\) return <RelightTool/);+ });++ it("opens on a demo with its result shipped", () => {+ expect(RELIGHT_DEMOS.length).toBeGreaterThan(0);+ for (const d of RELIGHT_DEMOS) {+ for (const f of [d.photo, d.relit, d.depth, d.matte].filter(Boolean) as string[]) expect(fs.existsSync(path.join(ROOT, "public", f)), f).toBe(true);+ expect(getLook(d.look)).toBeDefined();+ }+ expect(DEFAULT_DEMO.look).toBe("golden-hour");+ });++ it("is a Relight link on image results, after Edit", () => {+ const g = { id: "gen_1", feature: "image", op: "t2i", kind: "image", outputs: [{ url: "/api/files/o/a.png", kind: "image" }], request: {}, favorite: false } as unknown as Generation;+ const acts = outputActions(g, 0);+ const i = acts.findIndex((a) => a.id === "relight");+ expect(acts[i]).toEqual({ id: "relight", label: "Relight", placement: "menu", href: "/apps/app-relight?image=%2Fapi%2Ffiles%2Fo%2Fa.png&gen=gen_1" });+ expect(i).toBe(acts.findIndex((a) => a.id === "edit") + 1);+ expect(acts[i + 1].id).toBe("live-edit");+ });++ it("the local result route takes a Relight blend and nothing else new", () => {+ const route = fs.readFileSync(path.join(ROOT, "src/app/api/generations/local/route.ts"), "utf8");+ expect(route).toContain('op: z.enum(["grade", "relight"])');+ });+});++describe("the panel", () => {+ it("shows the looks and the selected light's chips with 44 px phone targets", () => {+ const looks = renderToStaticMarkup(createElement(LooksRow, { look: "neon-night", onLook: () => {} }));+ expect(looks.indexOf("Golden hour")).toBeLessThan(looks.indexOf("Studio softbox"));+ expect(looks).toMatch(/aria-checked="true"[^>]*>.*Neon night/);+ const panel = renderToStaticMarkup(+ createElement(LightPanel, { lights: lightsOfLook(getLook("neon-night")!), selected: "l1", onSelect: () => {}, onChange: () => {}, onRemove: () => {}, onAdd: () => {}, fine: false }),+ );+ for (const label of ["Colour", "Height", "Distance", "Softness", "Strength", "Behind the subject", "Remove light", "Add light", "Custom"]) expect(panel).toContain(label);+ expect(panel).toContain("h-11");+ expect(panel).not.toMatch(/Viggle|Qwen|LoRA|seed|steps/i);+ });+});++describe("Workflows → Copy install commands for Relight", () => {+ it("download Viggle's node file as a package, never clone the model repo", async () => {+ const { hfNodeFile, nodeInstall } = await import("@/lib/comfy-install");+ const url = "https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/009a44a895ef85f7e643c80fdca9543795248867/comfyui/viggle_turbo.py";+ expect(hfNodeFile(url)).toEqual({ repo: "https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo", ref: "009a44a895ef85f7e643c80fdca9543795248867", file: "comfyui/viggle_turbo.py" });+ expect(nodeInstall({ name: "viggle_turbo", repo: url })).toBe(`mkdir -p "$COMFYUI/custom_nodes/viggle_turbo" && wget -c -O "$COMFYUI/custom_nodes/viggle_turbo/__init__.py" "${url}"`);+ expect(hfNodeFile("https://huggingface.co/Viggle/x/resolve/main/a.py")).toBeUndefined();+ });+});++describe("Relight from Edit", () => {+ it("is a next step under a picture made in Edit, in place of Edit", async () => {+ const { nextSteps } = await import("@/lib/output-actions");+ const g = (feature: string) => ({ id: "gen_2", feature, op: "edit", kind: "image", status: "succeeded", outputs: [{ url: "/api/files/o/b.png", kind: "image" }], request: {}, favorite: false }) as unknown as Generation;+ expect(nextSteps(g("edit"), 0).map((a) => a.id)).toEqual(["animate", "relight", "upscale"]);+ expect(nextSteps(g("edit"), 0)[1].href).toBe("/apps/app-relight?image=%2Fapi%2Ffiles%2Fo%2Fb.png&gen=gen_2");+ expect(nextSteps(g("image"), 0).map((a) => a.id)).toEqual(["animate", "upscale", "edit"]);+ });+});diff --git a/workflows/comfyui/manifest.json b/workflows/comfyui/manifest.jsonindex 699aa47a..4c75b9c7 100644--- a/workflows/comfyui/manifest.json+++ b/workflows/comfyui/manifest.json@@ -10910,6 +10910,150 @@"validated": false,"notes": "The Qwen-Image 2.1 turbo image-edit workflow, as the site's fast preview edits run it: turbo int8 model, the fixed 8-step ManualSigmas schedule, KSamplerSelect euler, CFGGuider cfg 1, RandomNoise, SamplerCustomAdvanced on the encoder's latent; references as qwen-image-21-edit (2048 lanczos, resolution 0, up to 4, optional ones dropped). No steps binding: the sigmas are the schedule. Removed: the prompt enhancer branch (Qwen3.5 9B PE model, off in the workflow), the custom-size switch, compare and notes. In a blind test it matched 25 steps (21 vs 22 of 48 outfit edits) and was weaker only on hard camera turns and product rotations (use qwen-image-21-edit there)."},+ {+ "id": "qwen-image-21-relight",+ "title": "Relight with placed lights: Qwen-Image 2.1 + Viggle 6-step speed LoRA, the photo plus words written from the lights (viggle_turbo)",+ "capability": "edit",+ "file": "qwen-image-21-relight.json",+ "source": "hand-built (scripts/comfy/hand-built/qwen-image-21-relight.json)",+ "bindings": {+ "prompt": [+ {+ "node": "30",+ "input": "prompt"+ }+ ],+ "image": [+ {+ "node": "10",+ "input": "image"+ }+ ],+ "image2": [+ {+ "node": "11",+ "input": "image"+ }+ ],+ "seed": [+ {+ "node": "70",+ "input": "noise_seed"+ }+ ],+ "filenamePrefix": [+ {+ "node": "90",+ "input": "filename_prefix"+ }+ ]+ },+ "outputs": [+ {+ "node": "90",+ "kind": "image"+ }+ ],+ "defaults": {},+ "limits": {+ "maxWidth": 2048,+ "maxHeight": 2048+ },+ "models": [+ {+ "file": "qwen_image_2.1_int8_convrot.safetensors",+ "folder": "diffusion_models",+ "url": "https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/diffusion_models/qwen_image_2.1_int8_convrot.safetensors",+ "sizeGb": 7.26+ },+ {+ "file": "qwen3vl_8b_int8_convrot.safetensors",+ "folder": "text_encoders",+ "url": "https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/text_encoders/qwen3vl_8b_int8_convrot.safetensors",+ "sizeGb": 9.35+ },+ {+ "file": "qwen_image_2.1_vae_bf16.safetensors",+ "folder": "vae",+ "url": "https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/vae/qwen_image_2.1_vae_bf16.safetensors",+ "sizeGb": 0.68+ },+ {+ "file": "Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors",+ "folder": "loras",+ "url": "https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/009a44a895ef85f7e643c80fdca9543795248867/Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors",+ "sizeGb": 1.36+ }+ ],+ "customNodes": [+ {+ "name": "viggle_turbo",+ "repo": "https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/009a44a895ef85f7e643c80fdca9543795248867/comfyui/viggle_turbo.py"+ }+ ],+ "vramGb": 24,+ "license": "Qwen Research License Agreement (Qwen-Image 2.1 and Viggle's turbo LoRA, a derivative): NON-COMMERCIAL, research and evaluation only; the viggle_turbo node file ships in the same model repo under the same terms",+ "validated": false,+ "notes": "Built from Viggle's ComfyUI edit workflow (Viggle/Qwen-Image-2.1-viggle-turbo, comfyui/) with one reference: the int8 Qwen-Image 2.1 model, the v0.2.1 6-step LoRA (r256) on ViggleTurboLora at 1.0 (applied unmerged; it reads lora_alpha / r from the file's metadata), QwenImage21Cache auto, TextEncodeQwenImage21 at resolution 1024 (about 1 MP, sides on the 32 grid), positive only, BasicGuider (no CFG), euler, ViggleTurboSigmas \"1.0, 0.9375, 0.875, 0.75, 0.5, 0.25\" (the raw nodes, shifted for the latent's size), RandomNoise, SamplerCustomAdvanced, VAEDecode. The words come from the placed lights (\"Relight the photo with a strong sunset orange light coming from the left, at face height, far away. The scene is in darkness, lit only by these lights …\"), so the result is lit only by them and the page blends it with the original (Intensity). Image 2 is an optional light-guide picture (the rig drawn over the darkened photo), dropped when not given. The seed comes from the photo, so moving one light changes only that light. A Pruna 8-step v0.1 LoRA in its place must also load through ViggleTurboLora at 1.0: its x2 strength is only in the metadata, so LoraLoaderModelOnly at 1.0 gives half."+ },+ {+ "id": "relight-scene-read",+ "title": "Relight scene read: depth (Depth Anything 3 mono large) and the subject's matte (BiRefNet) of one photo (core)",+ "capability": "bg-remove",+ "file": "relight-scene-read.json",+ "source": "hand-built (scripts/comfy/hand-built/relight-scene-read.json)",+ "bindings": {+ "image": [+ {+ "node": "1",+ "input": "image"+ }+ ],+ "filenamePrefix": [+ {+ "node": "5",+ "input": "filename_prefix"+ },+ {+ "node": "9",+ "input": "filename_prefix"+ }+ ]+ },+ "outputs": [+ {+ "node": "5",+ "kind": "image",+ "role": "depth"+ },+ {+ "node": "9",+ "kind": "image",+ "role": "matte"+ }+ ],+ "defaults": {},+ "limits": {},+ "models": [+ {+ "file": "depth_anything_3_mono_large.safetensors",+ "folder": "geometry_estimation",+ "url": "https://huggingface.co/Comfy-Org/Depth-Anything-3/resolve/main/geometry_estimation/depth_anything_3_mono_large.safetensors",+ "sizeGb": 1.34+ },+ {+ "file": "birefnet.safetensors",+ "folder": "background_removal",+ "url": "https://huggingface.co/Comfy-Org/BiRefNet/resolve/main/background_removal/birefnet.safetensors",+ "sizeGb": 0.44+ }+ ],+ "customNodes": [],+ "vramGb": 6,+ "license": "Depth Anything 3 mono large: Apache-2.0 (model card) · BiRefNet: MIT",+ "validated": false,+ "notes": "One photo in, two grey PNGs out, for the Relight page's depth-true preview: DA3Inference (mono, 504, lower-bound resize) and DA3Render depth with v2_style normalisation (near = bright), and the core background-removal nodes (birefnet.safetensors) with the mask saved as a picture (white = subject). Runs once per photo; its runs are helper steps the Library leaves out."+ },{"id": "qwen-image-21-live-edit","title": "Qwen-Image 2.1 Live Edit (2-step DMD2 LoRA, as you type)",diff --git a/workflows/comfyui/model-pins.json b/workflows/comfyui/model-pins.jsonindex 336e0505..1f4eb874 100644--- a/workflows/comfyui/model-pins.json+++ b/workflows/comfyui/model-pins.json@@ -822,6 +822,16 @@"sizeBytes": 576148442,"sha256": "ed0d0c3d43b599e326845d0ec70f3cf77be9a55e2d97627ac3b34d2830763cc8"},+ "https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/009a44a895ef85f7e643c80fdca9543795248867/Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r128.safetensors": {+ "revision": "009a44a895ef85f7e643c80fdca9543795248867",+ "sizeBytes": 679604800,+ "sha256": "bafb91d0047df3f9b8a5a850b0c967f051164314d8aad778dfa34d9c24ec345b"+ },+ "https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/009a44a895ef85f7e643c80fdca9543795248867/Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors": {+ "revision": "009a44a895ef85f7e643c80fdca9543795248867",+ "sizeBytes": 1359147904,+ "sha256": "2a0148f5c73abbed5f97da5ea356e439318aadb281d01fce4af39cdf43728803"+ },"https://huggingface.co/akatz-ai/MiniMax-H3-Character-Swap-LoRA/resolve/a665bb7e3bb9804e487d2925f67744f554c8ad49/h3_character_swap_pro4500_1000.safetensors": {"revision": "a665bb7e3bb9804e487d2925f67744f554c8ad49","sizeBytes": 155110320,diff --git a/workflows/comfyui/packs.json b/workflows/comfyui/packs.jsonindex eb69e7e8..63a0b058 100644--- a/workflows/comfyui/packs.json+++ b/workflows/comfyui/packs.json@@ -269,5 +269,15 @@"isolated": false,"subdir": null,"folders": []+ },+ "viggle_turbo": {+ "repo": "https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo",+ "commit": "009a44a895ef85f7e643c80fdca9543795248867",+ "registry": null,+ "requirementsTxt": false,+ "isolated": false,+ "subdir": null,+ "file": "comfyui/viggle_turbo.py",+ "folders": []}}diff --git a/workflows/comfyui/qwen-image-21-relight.json b/workflows/comfyui/qwen-image-21-relight.jsonnew file mode 100644index 00000000..3e556e44--- /dev/null+++ b/workflows/comfyui/qwen-image-21-relight.json@@ -0,0 +1,221 @@+{+ "1": {+ "class_type": "UNETLoader",+ "inputs": {+ "unet_name": "qwen_image_2.1_int8_convrot.safetensors",+ "weight_dtype": "default"+ },+ "_meta": {+ "title": "Load Diffusion Model"+ }+ },+ "2": {+ "class_type": "CLIPLoader",+ "inputs": {+ "clip_name": "qwen3vl_8b_int8_convrot.safetensors",+ "type": "qwen_image",+ "device": "default"+ },+ "_meta": {+ "title": "Load CLIP (Qwen3-VL 8B)"+ }+ },+ "3": {+ "class_type": "VAELoader",+ "inputs": {+ "vae_name": "qwen_image_2.1_vae_bf16.safetensors"+ },+ "_meta": {+ "title": "Load VAE"+ }+ },+ "4": {+ "class_type": "ViggleTurboLora",+ "inputs": {+ "model": [+ "1",+ 0+ ],+ "lora_name": "Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors",+ "strength": 1+ },+ "_meta": {+ "title": "Speed LoRA (Viggle 6-step, unmerged, reads alpha from metadata)"+ }+ },+ "10": {+ "class_type": "LoadImage",+ "inputs": {+ "image": "image_1.png"+ },+ "_meta": {+ "title": "Photo (image 1)"+ }+ },+ "11": {+ "class_type": "LoadImage",+ "inputs": {+ "image": "image_2.png"+ },+ "_meta": {+ "title": "Light guide (image 2, optional)"+ }+ },+ "30": {+ "class_type": "TextEncodeQwenImage21",+ "inputs": {+ "prompt": "",+ "negative_prompt": "",+ "resolution": 1024,+ "clip": [+ "2",+ 0+ ],+ "vae": [+ "3",+ 0+ ],+ "images.image_1": [+ "10",+ 0+ ],+ "images.image_2": [+ "11",+ 0+ ]+ },+ "_meta": {+ "title": "Text Encode Qwen Image 2.1 (~1 MP)"+ }+ },+ "31": {+ "class_type": "QwenImage21Cache",+ "inputs": {+ "device": "auto",+ "dtype": "default",+ "model": [+ "4",+ 0+ ]+ },+ "_meta": {+ "title": "Qwen Image 2.1 Cache"+ }+ },+ "32": {+ "class_type": "SamplerCustomAdvanced",+ "inputs": {+ "noise": [+ "70",+ 0+ ],+ "guider": [+ "71",+ 0+ ],+ "sampler": [+ "72",+ 0+ ],+ "sigmas": [+ "73",+ 0+ ],+ "latent_image": [+ "30",+ 2+ ]+ },+ "_meta": {+ "title": "Sampler"+ }+ },+ "33": {+ "class_type": "VAEDecode",+ "inputs": {+ "samples": [+ "32",+ 0+ ],+ "vae": [+ "3",+ 0+ ]+ },+ "_meta": {+ "title": "VAE Decode"+ }+ },+ "34": {+ "class_type": "SplitImageWithAlpha",+ "inputs": {+ "image": [+ "33",+ 0+ ]+ },+ "_meta": {+ "title": "Drop the alpha"+ }+ },+ "70": {+ "class_type": "RandomNoise",+ "inputs": {+ "noise_seed": 0+ },+ "_meta": {+ "title": "Seed"+ }+ },+ "71": {+ "class_type": "BasicGuider",+ "inputs": {+ "model": [+ "31",+ 0+ ],+ "conditioning": [+ "30",+ 0+ ]+ },+ "_meta": {+ "title": "Basic Guider (no CFG)"+ }+ },+ "72": {+ "class_type": "KSamplerSelect",+ "inputs": {+ "sampler_name": "euler"+ },+ "_meta": {+ "title": "euler"+ }+ },+ "73": {+ "class_type": "ViggleTurboSigmas",+ "inputs": {+ "latent": [+ "30",+ 2+ ],+ "nodes": "1.0, 0.9375, 0.875, 0.75, 0.5, 0.25"+ },+ "_meta": {+ "title": "Viggle 6-step sigmas"+ }+ },+ "90": {+ "class_type": "SaveImage",+ "inputs": {+ "filename_prefix": "fuobe/qwen-image-21-relight",+ "images": [+ "34",+ 0+ ]+ },+ "_meta": {+ "title": "Save relit"+ }+ }+}diff --git a/workflows/comfyui/relight-scene-read.json b/workflows/comfyui/relight-scene-read.jsonnew file mode 100644index 00000000..7b8eb0bf--- /dev/null+++ b/workflows/comfyui/relight-scene-read.json@@ -0,0 +1,110 @@+{+ "1": {+ "class_type": "LoadImage",+ "inputs": {+ "image": "input.png"+ },+ "_meta": {+ "title": "Photo"+ }+ },+ "2": {+ "class_type": "LoadDA3Model",+ "inputs": {+ "model_name": "depth_anything_3_mono_large.safetensors",+ "weight_dtype": "default"+ },+ "_meta": {}+ },+ "3": {+ "class_type": "DA3Inference",+ "inputs": {+ "da3_model": [+ "2",+ 0+ ],+ "image": [+ "1",+ 0+ ],+ "resolution": 504,+ "resize_method": "lower_bound_resize",+ "mode": "mono"+ },+ "_meta": {}+ },+ "4": {+ "class_type": "DA3Render",+ "inputs": {+ "da3_geometry": [+ "3",+ 0+ ],+ "output": "depth",+ "output.normalization": "v2_style",+ "output.apply_sky_clip": false+ },+ "_meta": {+ "title": "Depth (near = bright)"+ }+ },+ "5": {+ "class_type": "SaveImage",+ "inputs": {+ "images": [+ "4",+ 0+ ],+ "filename_prefix": "fuobe/relight-scene-read"+ },+ "_meta": {+ "title": "Save depth"+ }+ },+ "6": {+ "class_type": "LoadBackgroundRemovalModel",+ "inputs": {+ "bg_removal_name": "birefnet.safetensors"+ },+ "_meta": {}+ },+ "7": {+ "class_type": "RemoveBackground",+ "inputs": {+ "bg_removal_model": [+ "6",+ 0+ ],+ "image": [+ "1",+ 0+ ]+ },+ "_meta": {}+ },+ "8": {+ "class_type": "MaskToImage",+ "inputs": {+ "mask": [+ "7",+ 0+ ]+ },+ "_meta": {+ "title": "Matte"+ }+ },+ "9": {+ "class_type": "SaveImage",+ "inputs": {+ "images": [+ "8",+ 0+ ],+ "filename_prefix": "fuobe/relight-scene-read"+ },+ "_meta": {+ "title": "Save matte"+ }+ }+}diff --git a/workflows/comfyui/requirements.json b/workflows/comfyui/requirements.jsonindex 3f4fabe6..f874bc66 100644--- a/workflows/comfyui/requirements.json+++ b/workflows/comfyui/requirements.json@@ -1,9 +1,9 @@{"v": 1,- "hash": "f9d6acee2ef2040ed3e1e8f850466127b8dd8ea6026930254d32c057389dcf9a",+ "hash": "e4f0d7ad3f2a2e6ec2f81356d7e961ed2a052a68df22cd4d0e064a4d1d04b573","comfyui": {"min":"0.42.0","testedCommit":"5841c187"},"folders": ["audio_encoders","background_removal","checkpoints","clip_vision","dbs","diffusion_models","facerestore_models","foley","frame_interpolation","geometry_estimation","insightface","latent_upscale_models","loras","mmaudio","model_patches","optical_flow","reuse","text_encoders","thinksound","upscale_models","vae"],- "sentinels": ["AILab_Qwen3ASRSubtitle","AUSBOSS_NODES_CropForInpaint","AUSBOSS_NODES_ImageCropRotatePad","AUSBOSS_NODES_StitchInpaint","Add Subtitles To Frames","Apply Whisper","CFGOverride","ClothesSegment","ComfyMathExpression","CropFuobeLive","DBSLoader","DBSSeparate","DownloadAndLoadWav2VecModel","DualModelGuider","FL_ChatterboxDialogTTS","FL_ChatterboxMultilingualTTS","FL_ChatterboxVC","GetImageRangeFromBatch","GetImageSizeAndCount","GrowMaskWithBlur","H3AdaLNLoRAFix","H3CharacterSwapAssemble","H3CharacterSwapController","H3CharacterSwapExpandMask","H3CharacterSwapModels","H3CharacterSwapPrepareVideo","H3CharacterSwapRecoverMasks","H3CharacterSwapSelectSubject","H3CharacterSwapSettings","H3CharacterSwapShot","H3CharacterSwapWindowPlan","H3RelayAppendWindow","H3RelayApplyEditMask","H3RelayApplyHistory","H3RelayExpandMask","H3RelayFinishWindows","H3RelayPrepareSource","H3RelayRecoverMasks","H3RelayReviewWindows","H3RelaySamplingMemory","H3RelaySelectMask","H3RelayTextMemory","H3RelayWindowInputs","H3RelayWindowPlan","H3SLAAttention","HunyuanDependenciesLoader","HunyuanFoleySampler","HunyuanModelLoader","INTConstant","Ideogram4Scheduler","ImageBatchExtendWithOverlap","ImageGridtoBatch","ImageResizeKJv2","IndexTTS2Simple","Krea2EditGroundedEncode","Krea2EditModelPatch","Krea2OstrisEditModelPatch","LTXAVTextEncoderLoader","LTXAddVideoICLoRAGuide","LTXICLoRALoaderModelOnly","LTXVAddGuide","LTXVAudioVAEDecode","LTXVAudioVAELoader","LTXVConcatAVLatent","LTXVConditioning","LTXVCropGuides","LTXVDualCFGGuider","LTXVEmptyLatentAudio","LTXVImgToVideoInplace","LTXVLatentUpsampler","LTXVPreprocess","LTXVScheduler","LTXVSeparateAVLatent","LTXVTiledFusionSampler","LatentSyncNode","LoadBackgroundRemovalModel","LoadImageFuobeLive","LoadVideoDepthAnythingModel","MMAudioFeatureUtilsLoader","MMAudioModelLoader","MMAudioSampler","MelBandRoFormerModelLoader","MelBandRoFormerSampler","MiniMaxH3TurboLoRA","MiniMaxH3TurboSampler","MultiTalkModelLoader","MultiTalkWav2VecEmbeds","OpenH3RegenFastVAEDecode","OpenH3RegenFinish","OpenH3RegenLora","OpenH3RegenPrepareDraft","OpenH3RegenRefineLatent","OpenH3RegenSigmas","OpenH3RegenUpscale","OpenH3SaveRefinedLatent","PasteBackFuobeLive","Qwen21EncodeFuobeLive","Qwen21ReferenceFuobeLive","QwenImage21Cache","REUSEEnhance","REUSELoader","RIFE VFI","RMBG","ReActorFaceSwap","RemoveBackground","SAM3_Detect","SAM3_TrackToMask","SAM3_VideoTrack","SaveImageFuobeLive","SeedVR2Conditioning","SeedVR2PostProcessing","SeedVR2Preprocess","TS_ImageToSVGStringColor_Vtracer","TS_SVGStringToSVGBytesIO","TextEncodeFibo2","TextEncodeKrea2OstrisEdit","TextEncodeQwenImage21","ThinkSoundFeatureUtilsLoader","ThinkSoundModelLoader","ThinkSoundSampler","Trellis2Conditioning","Trellis2ShapeStage","Trellis2TextureStage","Trellis2UpsampleStage","VHS_BatchManager","VHS_LoadAudioUpload","VHS_LoadVideo","VHS_SelectEveryNthImage","VHS_VideoCombine","VHS_VideoInfo","VHS_VideoInfoLoaded","VideoDepthAnythingOutput","VideoDepthAnythingProcess","VideoLengthAdjuster","WanVideoBlockSwap","WanVideoClipVisionEncode","WanVideoDecode","WanVideoEncode","WanVideoImageToVideoMultiTalk","WanVideoLoraSelect","WanVideoModelLoader","WanVideoPassImagesFromSamples","WanVideoSampler","WanVideoTextEncodeCached","WanVideoVAELoader"],+ "sentinels": ["AILab_Qwen3ASRSubtitle","AUSBOSS_NODES_CropForInpaint","AUSBOSS_NODES_ImageCropRotatePad","AUSBOSS_NODES_StitchInpaint","Add Subtitles To Frames","Apply Whisper","CFGOverride","ClothesSegment","ComfyMathExpression","CropFuobeLive","DBSLoader","DBSSeparate","DownloadAndLoadWav2VecModel","DualModelGuider","FL_ChatterboxDialogTTS","FL_ChatterboxMultilingualTTS","FL_ChatterboxVC","GetImageRangeFromBatch","GetImageSizeAndCount","GrowMaskWithBlur","H3AdaLNLoRAFix","H3CharacterSwapAssemble","H3CharacterSwapController","H3CharacterSwapExpandMask","H3CharacterSwapModels","H3CharacterSwapPrepareVideo","H3CharacterSwapRecoverMasks","H3CharacterSwapSelectSubject","H3CharacterSwapSettings","H3CharacterSwapShot","H3CharacterSwapWindowPlan","H3RelayAppendWindow","H3RelayApplyEditMask","H3RelayApplyHistory","H3RelayExpandMask","H3RelayFinishWindows","H3RelayPrepareSource","H3RelayRecoverMasks","H3RelayReviewWindows","H3RelaySamplingMemory","H3RelaySelectMask","H3RelayTextMemory","H3RelayWindowInputs","H3RelayWindowPlan","H3SLAAttention","HunyuanDependenciesLoader","HunyuanFoleySampler","HunyuanModelLoader","INTConstant","Ideogram4Scheduler","ImageBatchExtendWithOverlap","ImageGridtoBatch","ImageResizeKJv2","IndexTTS2Simple","Krea2EditGroundedEncode","Krea2EditModelPatch","Krea2OstrisEditModelPatch","LTXAVTextEncoderLoader","LTXAddVideoICLoRAGuide","LTXICLoRALoaderModelOnly","LTXVAddGuide","LTXVAudioVAEDecode","LTXVAudioVAELoader","LTXVConcatAVLatent","LTXVConditioning","LTXVCropGuides","LTXVDualCFGGuider","LTXVEmptyLatentAudio","LTXVImgToVideoInplace","LTXVLatentUpsampler","LTXVPreprocess","LTXVScheduler","LTXVSeparateAVLatent","LTXVTiledFusionSampler","LatentSyncNode","LoadBackgroundRemovalModel","LoadImageFuobeLive","LoadVideoDepthAnythingModel","MMAudioFeatureUtilsLoader","MMAudioModelLoader","MMAudioSampler","MelBandRoFormerModelLoader","MelBandRoFormerSampler","MiniMaxH3TurboLoRA","MiniMaxH3TurboSampler","MultiTalkModelLoader","MultiTalkWav2VecEmbeds","OpenH3RegenFastVAEDecode","OpenH3RegenFinish","OpenH3RegenLora","OpenH3RegenPrepareDraft","OpenH3RegenRefineLatent","OpenH3RegenSigmas","OpenH3RegenUpscale","OpenH3SaveRefinedLatent","PasteBackFuobeLive","Qwen21EncodeFuobeLive","Qwen21ReferenceFuobeLive","QwenImage21Cache","REUSEEnhance","REUSELoader","RIFE VFI","RMBG","ReActorFaceSwap","RemoveBackground","SAM3_Detect","SAM3_TrackToMask","SAM3_VideoTrack","SaveImageFuobeLive","SeedVR2Conditioning","SeedVR2PostProcessing","SeedVR2Preprocess","TS_ImageToSVGStringColor_Vtracer","TS_SVGStringToSVGBytesIO","TextEncodeFibo2","TextEncodeKrea2OstrisEdit","TextEncodeQwenImage21","ThinkSoundFeatureUtilsLoader","ThinkSoundModelLoader","ThinkSoundSampler","Trellis2Conditioning","Trellis2ShapeStage","Trellis2TextureStage","Trellis2UpsampleStage","VHS_BatchManager","VHS_LoadAudioUpload","VHS_LoadVideo","VHS_SelectEveryNthImage","VHS_VideoCombine","VHS_VideoInfo","VHS_VideoInfoLoaded","VideoDepthAnythingOutput","VideoDepthAnythingProcess","VideoLengthAdjuster","ViggleTurboLora","ViggleTurboSigmas","WanVideoBlockSwap","WanVideoClipVisionEncode","WanVideoDecode","WanVideoEncode","WanVideoImageToVideoMultiTalk","WanVideoLoraSelect","WanVideoModelLoader","WanVideoPassImagesFromSamples","WanVideoSampler","WanVideoTextEncodeCached","WanVideoVAELoader"],"packs": {"ComfyUI-DBS": {"repo":"https://github.com/hiroki-abe-58/ComfyUI-DBS","commit":"f656e53434b5485c148a2866fbd6ddc6b6152ed6","registry":{"id":"dbs-soundtrack-separation","version":""},"classes":["DBSLoader","DBSSeparate"],"folders":["dbs"],"isolated":false,"requirementsTxt":true,"install":"manual"},"ComfyUI-Frame-Interpolation": {"repo":"https://github.com/Fannovel16/ComfyUI-Frame-Interpolation","commit":"26545cc2dd95bc3d27f056016300673bdeee78f5","registry":{"id":"comfyui-frame-interpolation","version":""},"classes":["RIFE VFI"],"folders":[],"isolated":false,"requirementsTxt":false,"install":"manual"},@@ -34,7 +34,8 @@"fuobe-live": {"repo":"https://github.com/workingprototype/Fuobe","commit":"","bundled":"fuobe_live.py","classes":["CropFuobeLive","LoadImageFuobeLive","PasteBackFuobeLive","Qwen21EncodeFuobeLive","Qwen21ReferenceFuobeLive","SaveImageFuobeLive"],"folders":[],"isolated":false,"requirementsTxt":false,"install":"manual"},"h3-relay": {"repo":"https://github.com/akatz-ai/h3-relay","commit":"e2a7665b6eb8ea37a88c0de2c9c6b69a8f7c9220","registry":{"id":"h3-relay","version":""},"classes":["H3RelayAppendWindow","H3RelayApplyEditMask","H3RelayApplyHistory","H3RelayExpandMask","H3RelayFinishWindows","H3RelayPrepareSource","H3RelayRecoverMasks","H3RelayReviewWindows","H3RelaySamplingMemory","H3RelaySelectMask","H3RelayTextMemory","H3RelayWindowInputs","H3RelayWindowPlan"],"folders":[],"isolated":false,"requirementsTxt":false,"install":"manual"},"h3_character_swap": {"repo":"https://github.com/akatz-labs/h3-character-swap-tool","commit":"0670e4fdf95adf2262caa4b81afed2a9c4ae4b7b","classes":["H3CharacterSwapAssemble","H3CharacterSwapController","H3CharacterSwapExpandMask","H3CharacterSwapModels","H3CharacterSwapPrepareVideo","H3CharacterSwapRecoverMasks","H3CharacterSwapSelectSubject","H3CharacterSwapSettings","H3CharacterSwapShot","H3CharacterSwapWindowPlan"],"folders":[],"isolated":false,"subdir":"worker_nodes/h3_character_swap","requirementsTxt":true,"install":"manual"},- "plaguekind-nodes": {"repo":"https://github.com/PlagueKind/ComfyUI-PlagueKind-Nodes","commit":"d58d006a4ea32c25c06499f2ff104f0852a045a6","registry":{"id":"plaguekind-nodes","version":""},"classes":["H3AdaLNLoRAFix","H3SLAAttention"],"folders":[],"isolated":false,"requirementsTxt":false,"install":"manual"}+ "plaguekind-nodes": {"repo":"https://github.com/PlagueKind/ComfyUI-PlagueKind-Nodes","commit":"d58d006a4ea32c25c06499f2ff104f0852a045a6","registry":{"id":"plaguekind-nodes","version":""},"classes":["H3AdaLNLoRAFix","H3SLAAttention"],"folders":[],"isolated":false,"requirementsTxt":false,"install":"manual"},+ "viggle_turbo": {"repo":"https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo","commit":"009a44a895ef85f7e643c80fdca9543795248867","classes":["ViggleTurboLora","ViggleTurboSigmas"],"folders":[],"isolated":false,"file":"comfyui/viggle_turbo.py","requirementsTxt":false,"install":"manual"}},"files": {"audio_encoders/wav2vec2-chinese-base_fp16.safetensors": {"folder":"audio_encoders","file":"wav2vec2-chinese-base_fp16.safetensors","url":"https://huggingface.co/Kijai/wav2vec2_safetensors/resolve/main/wav2vec2-chinese-base_fp16.safetensors","pinnedUrl":"https://huggingface.co/Kijai/wav2vec2_safetensors/resolve/87847d3bc53702afda44078249e7c33e867827c4/wav2vec2-chinese-base_fp16.safetensors","sizeBytes":190115368,"gated":false,"presence":"loader","loaders":[["AudioEncoderLoader","audio_encoder_name"]]},@@ -139,6 +140,7 @@"loras/H3-Person-Remover-V1.safetensors": {"folder":"loras","file":"H3-Person-Remover-V1.safetensors","url":"https://huggingface.co/akatz-ai/MiniMax-H3-Person-Remover-LoRA/resolve/fe136b3dc93aea993b9f194d48ea9859fdc2de14/H3-Person-Remover-V1.safetensors","pinnedUrl":"https://huggingface.co/akatz-ai/MiniMax-H3-Person-Remover-LoRA/resolve/fe136b3dc93aea993b9f194d48ea9859fdc2de14/H3-Person-Remover-V1.safetensors","sizeBytes":155110584,"gated":false,"presence":"loader","loaders":[["LoraLoaderModelOnly","lora_name"]]},"loras/Krea2-realism-V2.safetensors": {"folder":"loras","file":"Krea2-realism-V2.safetensors","url":"https://huggingface.co/RudySen/Krea2-realism-V2/resolve/main/Krea2-realism-V2.safetensors","pinnedUrl":"https://huggingface.co/RudySen/Krea2-realism-V2/resolve/ad6f07e426303e7087d215362dbc057b0073dca3/Krea2-realism-V2.safetensors","sizeBytes":1562410344,"gated":false,"presence":"loader","loaders":[["LoraLoaderModelOnly","lora_name"]]},"loras/Qwen-Image-2.1-DMD2-2steps.safetensors": {"folder":"loras","file":"Qwen-Image-2.1-DMD2-2steps.safetensors","url":"https://huggingface.co/linoyts/Qwen-Image-2.1-DMD2-2steps/resolve/5bae28369ecea3232405c17a53c04d35d15796b8/pytorch_lora_weights.safetensors","pinnedUrl":"https://huggingface.co/linoyts/Qwen-Image-2.1-DMD2-2steps/resolve/5bae28369ecea3232405c17a53c04d35d15796b8/pytorch_lora_weights.safetensors","sizeBytes":67144520,"gated":false,"presence":"loader","loaders":[["LoraLoaderModelOnly","lora_name"]]},+ "loras/Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors": {"folder":"loras","file":"Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors","url":"https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/009a44a895ef85f7e643c80fdca9543795248867/Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors","pinnedUrl":"https://huggingface.co/Viggle/Qwen-Image-2.1-viggle-turbo/resolve/009a44a895ef85f7e643c80fdca9543795248867/Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors","sizeBytes":1359147904,"gated":false,"presence":"list"},"loras/Qwen-Image-2512-Lightning-4steps-V1.0-fp32.safetensors": {"folder":"loras","file":"Qwen-Image-2512-Lightning-4steps-V1.0-fp32.safetensors","url":"https://huggingface.co/lightx2v/Qwen-Image-2512-Lightning/resolve/main/Qwen-Image-2512-Lightning-4steps-V1.0-fp32.safetensors","pinnedUrl":"https://huggingface.co/lightx2v/Qwen-Image-2512-Lightning/resolve/4609161e308ce82018a42c2a0c9b107e865bb751/Qwen-Image-2512-Lightning-4steps-V1.0-fp32.safetensors","sizeBytes":1698951104,"gated":false,"presence":"loader","loaders":[["LoraLoaderModelOnly","lora_name"]]},"loras/Qwen-Image-Edit-2509-Light-Migration.safetensors": {"folder":"loras","file":"Qwen-Image-Edit-2509-Light-Migration.safetensors","url":"https://huggingface.co/Comfy-Org/Qwen-Image-Edit_ComfyUI/resolve/main/split_files/loras/Qwen-Image-Edit-2509-Light-Migration.safetensors","pinnedUrl":"https://huggingface.co/Comfy-Org/Qwen-Image-Edit_ComfyUI/resolve/f68ace85e60b4a02a323e394253731947657b7d2/split_files/loras/Qwen-Image-Edit-2509-Light-Migration.safetensors","sizeBytes":236117032,"gated":false,"presence":"loader","loaders":[["LoraLoaderModelOnly","lora_name"]]},"loras/Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors": {"folder":"loras","file":"Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors","url":"https://huggingface.co/lightx2v/Qwen-Image-Lightning/resolve/main/Qwen-Image-Edit-2509/Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors","pinnedUrl":"https://huggingface.co/lightx2v/Qwen-Image-Lightning/resolve/d468c534b360e0754c6bf9e38ed49e1e09cd2e2a/Qwen-Image-Edit-2509/Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors","sizeBytes":849608296,"gated":false,"presence":"loader","loaders":[["LoraLoaderModelOnly","lora_name"]]},@@ -321,6 +323,7 @@"qwen-image-21-inpaint": {"core":["CLIPLoader","GrowMask","KSampler","LoadImage","LoadImageMask","QwenImage21Cache","SaveImage","SetLatentNoiseMask","SplitImageWithAlpha","StringFormat","TextEncodeQwenImage21","UNETLoader","VAEDecode","VAEEncode","VAELoader"],"packs":{"ausboss-nodes":["AUSBOSS_NODES_CropForInpaint","AUSBOSS_NODES_StitchInpaint"]},"files":["diffusion_models/qwen_image_2.1_int8_convrot.safetensors","text_encoders/qwen3vl_8b_int8_convrot.safetensors","vae/qwen_image_2.1_vae_bf16.safetensors"],"optional":[],"vramGb":20,"isolated":false,"firstRun":[]},"qwen-image-21-live-edit": {"core":["BasicGuider","CLIPLoader","KSamplerSelect","LoraLoaderModelOnly","ManualSigmas","RandomNoise","SamplerCustomAdvanced","SplitImageWithAlpha","UNETLoader","VAEDecode","VAELoader"],"packs":{"fuobe-live":["CropFuobeLive","LoadImageFuobeLive","PasteBackFuobeLive","Qwen21EncodeFuobeLive","Qwen21ReferenceFuobeLive","SaveImageFuobeLive"]},"files":["diffusion_models/qwen_image_2.1_int8_convrot.safetensors","loras/Qwen-Image-2.1-DMD2-2steps.safetensors","text_encoders/qwen3vl_8b_int8_convrot.safetensors","vae/qwen_image_2.1_vae_bf16.safetensors"],"optional":[],"vramGb":20,"isolated":false,"firstRun":[]},"qwen-image-21-outpaint": {"core":["CLIPLoader","GetImageSize","ImageCompositeMasked","ImageScale","InvertMask","KSampler","LoraLoaderModelOnly","QwenImage21Cache","RegexReplace","SaveImage","SplitImageWithAlpha","StringConcatenate","TextEncodeQwenImage21","TextGenerate","UNETLoader","VAEDecode","VAELoader"],"packs":{"ausboss-nodes":["AUSBOSS_NODES_CropForInpaint","AUSBOSS_NODES_ImageCropRotatePad","AUSBOSS_NODES_StitchInpaint"]},"files":["diffusion_models/qwen_image_2.1_int8_convrot.safetensors","loras/qwen-image-2.1-outpaint-v2.safetensors","text_encoders/qwen3vl_8b_int8_convrot.safetensors","vae/qwen_image_2.1_vae_bf16.safetensors"],"optional":[],"vramGb":20,"isolated":false,"firstRun":[]},+ "qwen-image-21-relight": {"core":["BasicGuider","CLIPLoader","KSamplerSelect","LoadImage","QwenImage21Cache","RandomNoise","SamplerCustomAdvanced","SaveImage","SplitImageWithAlpha","TextEncodeQwenImage21","UNETLoader","VAEDecode","VAELoader"],"packs":{"viggle_turbo":["ViggleTurboLora","ViggleTurboSigmas"]},"files":["diffusion_models/qwen_image_2.1_int8_convrot.safetensors","loras/Qwen-Image-2.1-viggle-turbo-v0.2.1-6step-lora-r256.safetensors","text_encoders/qwen3vl_8b_int8_convrot.safetensors","vae/qwen_image_2.1_vae_bf16.safetensors"],"optional":[],"vramGb":24,"isolated":false,"firstRun":[]},"qwen-image-21-t2i": {"core":["CLIPLoader","EmptyLatentImage","KSampler","SaveImage","SplitImageWithAlpha","TextEncodeQwenImage21","UNETLoader","VAEDecode","VAELoader"],"packs":{},"files":["diffusion_models/qwen_image_2.1_int8_convrot.safetensors","text_encoders/qwen3vl_8b_int8_convrot.safetensors","vae/qwen_image_2.1_vae_bf16.safetensors"],"optional":[],"vramGb":20,"isolated":false,"firstRun":[]},"qwen-image-21-turbo-edit": {"core":["CFGGuider","CLIPLoader","ImageScaleToMaxDimension","KSamplerSelect","LoadImage","ManualSigmas","QwenImage21Cache","RandomNoise","SamplerCustomAdvanced","SaveImage","SplitImageWithAlpha","TextEncodeQwenImage21","UNETLoader","VAEDecode","VAELoader"],"packs":{},"files":["diffusion_models/qwen_image_2.1_turbo_int8_convrot.safetensors","text_encoders/qwen3vl_8b_int8_convrot.safetensors","vae/qwen_image_2.1_vae_bf16.safetensors"],"optional":[],"vramGb":20,"isolated":false,"firstRun":[]},"qwen-image-2512-t2i": {"core":["CLIPLoader","CLIPTextEncode","EmptySD3LatentImage","KSampler","ModelSamplingAuraFlow","PrimitiveFloat","PrimitiveInt","SaveImage","UNETLoader","VAEDecode","VAELoader"],"packs":{},"files":["diffusion_models/qwen_image_2512_fp8_e4m3fn.safetensors","text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors","vae/qwen_image_vae.safetensors"],"optional":[],"vramGb":24,"isolated":false,"firstRun":[],"validated":true},@@ -332,6 +335,7 @@"reference-brief-gemma4": {"core":["CLIPLoader","SaveText","TextGenerate"],"packs":{"ComfyUI-VideoHelperSuite":["VHS_LoadVideo"]},"files":["text_encoders/gemma4_e4b_it_fp8_scaled.safetensors"],"optional":[],"vramGb":12,"isolated":false,"firstRun":[],"validated":true},"relight-qwen-edit-2509": {"core":["CFGNorm","CLIPLoader","FluxKontextImageScale","KSampler","LoadImage","LoraLoaderModelOnly","ModelSamplingAuraFlow","PrimitiveFloat","PrimitiveInt","SaveImageAdvanced","StringConcatenate","TextEncodeQwenImageEditPlus","UNETLoader","VAEDecode","VAEEncode","VAELoader"],"packs":{},"files":["diffusion_models/qwen_image_edit_2509_fp8_e4m3fn.safetensors","loras/Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors","loras/Qwen-Image-Edit-2509-Relight.safetensors","text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors","vae/qwen_image_vae.safetensors"],"optional":[],"vramGb":24,"isolated":false,"firstRun":[],"validated":true},"relight-qwen-edit-2509-reference": {"core":["CFGNorm","CLIPLoader","FluxKontextImageScale","KSampler","LoadImage","LoraLoaderModelOnly","ModelSamplingAuraFlow","PrimitiveFloat","PrimitiveInt","SaveImageAdvanced","StringConcatenate","TextEncodeQwenImageEditPlus","UNETLoader","VAEDecode","VAEEncode","VAELoader"],"packs":{},"files":["diffusion_models/qwen_image_edit_2509_fp8_e4m3fn.safetensors","loras/Qwen-Image-Edit-2509-Light-Migration.safetensors","loras/Qwen-Image-Edit-2509-Lightning-4steps-V1.0-bf16.safetensors","text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors","vae/qwen_image_vae.safetensors"],"optional":[],"vramGb":24,"isolated":false,"firstRun":[],"validated":true},+ "relight-scene-read": {"core":["DA3Inference","DA3Render","LoadBackgroundRemovalModel","LoadDA3Model","LoadImage","MaskToImage","RemoveBackground","SaveImage"],"packs":{},"files":["background_removal/birefnet.safetensors","geometry_estimation/depth_anything_3_mono_large.safetensors"],"optional":[],"vramGb":6,"isolated":false,"firstRun":[]},"scene-mesh-moge": {"core":["ComfyMathExpression","ComfySwitchNode","GetImageSize","LoadImage","LoadMoGeModel","MoGeInference","MoGePointMapToMesh","MoGeRender","ResizeImagesByLongerEdge","SaveGLB","SaveImage"],"packs":{},"files":["geometry_estimation/moge_2_vitl_normal_fp16.safetensors"],"optional":[],"vramGb":4,"isolated":false,"firstRun":[],"validated":true},"sdxl-t2i": {"core":["CLIPTextEncode","CheckpointLoaderSimple","EmptyLatentImage","KSampler","SaveImage","VAEDecode"],"packs":{},"files":["checkpoints/sd_xl_base_1.0.safetensors"],"optional":[],"vramGb":8,"isolated":false,"firstRun":[],"validated":true},"selftest-image": {"core":["ImageInvert","LoadImage","SaveImage"],"packs":{},"files":[],"optional":[],"vramGb":0,"isolated":false,"firstRun":[],"validated":true},