Repository navigation
Conversation
Adds a Relight panel that lights the photo with up to six point lights placed on the image. Normal and depth maps come from MoGe-2 (small or large ONNX checkpoint, downloaded on first use like the other AI models) and are cached per image. The relight pass runs before lens blur in the preview, export and thumbnail pipelines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dwb4HkWbxjkmwpshwXd2zi
|
@fabian-co looks great! for how long is relighting operation runs on your rtx? |
|
Looks very nice! Have you thought about integrating it behind a toggle in the main adjustments panel, like AI lens blur? |
Thank you! I have a rtx 3060 and take 1 minute or less depend if you use basic o high model to create a normal map, you can switch to both and works good! |
Thank you! Yes initially the effect was integrated in's effects panel, but then I thought that can be better under presets panel, because relight has many options to configure |
+1, great work @fabian-co !, if possible can you please share a video of this new tool :) Regards, |
Sure, my English is a bit basic, but I can give it a try. |
Relight normal map modelsThe Relight normal map is generated with MoGe-2 (Ruicheng Wang / Microsoft), run as an ONNX model. There are two variants, selected by quality and defined in
Both checkpoints take the same inputs and return the same outputs, so they are interchangeable. The large one resolves much finer geometry but is far heavier. Relight.Example.10MB.mp4I hope that with the video I have explained well. |
|
@fabian-co Thanks a lot for creating this showcase :) |
Thanks for the great explanation @fabian-co ! Just some minor UI suggestions from ky side:
Your thoughts on this are more than appreciated. :) Regards, |
|
And one more thing, why not use the latest and more polished MoGe-3 model. Regards, |
|
Hi @fabian-co, Thank you so much for this PR and the great video demo! Your work proved that AI relighting works really well in RapidRAW. I wanted this feature to live inside the existing Effects panel to keep the UI simpler and more streamlined. Making those changes required a very different structure across the UI, canvas, and backend, so I decided to implement it directly on main instead of asking you to rewrite everything. I am sorry for not merging your branch directly after all the work you put into it. Here is a quick overview of what I changed compared to your PR:
Please pull main and try it out when you have time. Since you know this feature so well, I would really love to hear your feedback on how it runs on your machine! Thank you again for your contribution! Timon |
@mmadesignerunknown It's too large :/ |
Sad... Anyways... Thanks for implementing this, if possible, can you please consider these suggestions as I described.
Regards, |
Hi Timon, Thanks for the update! No worries at all about not merging the PR directly—I totally understand needing to fit it properly into the Effects panel and the existing architecture. It makes perfect sense. The additions you made sound awesome, especially the spot lights, shadows, and the model optimization. It looks like a huge step up! I’ll pull main soon, play around with it, and let you know how it runs on my end. Really glad my initial work helped kickstart this feature! Cheers, |
|
Thanks a lot for the response. Looking forward to your testing :) |
I checked religth and it's amazing the new features that you added, now I send a new pr whit improves for spot and directional light you can see in this url #1865 |


Description
Adds a Relight panel: you place up to six point lights on the photo and the image is re-lit from them, using AI-estimated normal and depth maps of the scene.
The maps come from MoGe-2 ONNX checkpoints, downloaded on first use and verified by SHA-256 the same way the other AI models are. They are generated once per image and cached, so moving lights and sliders afterwards is a normal adjustment with live preview.
Opened as a draft until I add screenshots / a short video of the panel.
Type of Change
Changes Made
Backend (
src-tauri)relight.rs(new): the relight pass. Builds per-pixel surface maps (normal, coverage, depth, plus fine detail read from the photo's own texture), snaps them to the image edges with the guided filter already used by lens blur, and shades each pixel with diffuse + specular lighting, distance falloff, ambient level and softness.ai_processing.rs: MoGe-2 loading and inference (run_normal_model), with two checkpoints: small (140 MB, default) and large (1.3 GB, sharper, about 3x slower).ai_commands.rs:generate_relight_mapsandgenerate_relight_normal_previewcommands. Maps are cached on disk per image and quality (capped at 60 files).lib.rs,adjustment_utils.rs,file_management.rs), and its settings are part of the preview cache key (cache_utils.rs).lens_blur.rs: the luma guide and guided-filter helpers are nowpub(crate)so relight can reuse them. No behaviour change for lens blur.Frontend (
src)RelightPanel.tsx(new) and a new entry in the panel switcher: enable switch, light list (add / remove / select), per-light intensity, depth, range and colour (Kelvin presets or custom), global ambient, softness, specular and detail, map quality, and an option to show the normal map over the image.RelightHandle.tsx(new) +ImageCanvas.tsx: each light is a handle on the canvas; drag to move it, scroll to push it closer or farther.adjustments.ts,relightUtils.ts, stores: the new adjustment keys, defaults and geometry helpers. Relight settings are saved in the sidecar like any other adjustment.Screenshots/Videos
To be added before marking this ready for review.
Testing
This PR does add unit tests (21, in
relight.rs,ai_processing.rsandai_commands.rs).Test Configuration:
Checklist
Additional Notes
main:cargo fmt -- --checkandcargo clippy --all-targets -- -D warningspass (without--all-features, since tethering needs libgphoto2, which I don't have on Windows);tscreports no new errors; ESLint and Prettier are clean on the touched files;npm run i18n:checkgives the same output as onmain.Ruicheng/moge-2-*-normal-onnxHugging Face repositories, pinned to a revision. Happy to switch to a mirror underCyberTimon/RapidRAW-Modelsif you prefer to host them there like the other models.AI Disclaimer:
Please state the involvement of AI in this PR:
BEFORE

AFTER
