Skip to content

Add on-canvas relight light shapes with 3D aim - #1865

Merged
CyberTimon merged 2 commits into
CyberTimon:mainfrom
fabian-co:feat/relight-light-shapes
Oct 7, 2026
Merged

CyberTimon merged 2 commits into
CyberTimon:mainfrom
fabian-co:feat/relight-light-shapes

Conversation

@fabian-co

@fabian-co fabian-co commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Description

Makes the relight lights visible and readable directly on the canvas. Until now a light was only drawn while it was selected in placement mode, every light looked like the same dot, and directional lights had no on-canvas representation at all, so angle, elevation, cone and feather could only be judged from the rendered result.

Lights are now always shown while Relight is enabled, each type has its own shape, and the shape is a 3D projection of the same direction vector the engine uses, so it follows every slider.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Performance improvement
  • Code refactoring
  • Documentation update
  • UI/UX improvement
  • Build/CI or Dependency update

Changes Made

  • Always-visible lights: light shapes are drawn whenever Relight is enabled and at least one light exists, not only in placement mode. They are hidden while cropping, masking or AI editing so they do not get in the way of those tools.
  • Per-type shapes (new overlays/RelightLightShape.tsx):
    • Point: the existing dot.
    • Spot: a cone projected from the light, with a tinted base and a dashed inner ring for the feather. Cone opens/closes the cone, falloff changes its length.
    • Directional: a disc with parallel rays (previously nothing was drawn for this type). Its position is cosmetic and can be dragged out of the way.
  • 3D orientation: shapes are built from the same aim vector as relight.rs and projected through the existing UV-to-canvas mapping, so they respect orientation, flips and rotation. The near half of the rim is solid and the far half dashed.
  • Aim handle: spot and directional lights get a small handle at the tip of the aim axis; dragging it sets angle and elevation from the canvas.
  • Elevation range: widened from 0..90 to -180..180 for spot and directional lights, in both the slider and the engine clamp, so a light can be aimed in any direction, including back toward the viewer (e.g. backlight / rim light). Lights facing the viewer are drawn with a more opaque base and a larger, tinted aim handle.

Screenshots/Videos

Testing

  • These changes were tested locally by a human and confirmed to work.
  • I haven't added any automated tests to the code because the codebase currently lacks a test suite.

Test Configuration:

  • OS: Windows 10 Pro
  • Hardware:

Checklist

  • My code follows the project's code style
  • I haven't added unnecessary AI-generated code comments
  • My changes generate no new warnings or errors

Additional Notes

  • Manual testing was done on top of 1cd88e7. The branch has since been rebased onto 923366f (no conflicts); it has not been re-run in the app after the rebase.
  • Dragging the aim handle keeps the light in the hemisphere it already faces, because front and back project to the same 2D point. Crossing over is done with the elevation slider.
  • A spot aimed toward the viewer only lights surfaces when its depth places it behind them.
  • Existing saved lights are unaffected: their elevation values are inside the old 0..90 range.

AI Disclaimer:

Please state the involvement of AI in this PR:

  • This PR is created by an AI agent
  • This PR is mostly AI-generated but edited/merged together by a human
  • This PR was handwritten with AI assistance (spell check, logic suggestions, error resolving)
  • This PR contains only blood, sweat, and coffee (AI-free)
image

I think this shapes from spot and directional light adds a reference when the user modify the parameters, and helps to be more precise.

The code was written by Claude Code, directed and tested by a human.

🤖 Generated with Claude Code

https://claude.ai/code/session_013XE47EHfY64AadHeXep5P3

Show every relight light on the canvas while relight is enabled, draw
spot lights as a projected cone and directional lights as a disc with
parallel rays, and let the aim be dragged from the canvas. Elevation
now spans -180 to 180 degrees so lights can also point back at the
viewer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013XE47EHfY64AadHeXep5P3
@CyberTimon

CyberTimon commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Wow this looks very nice! Congrats! I will take a look at it soon :)

EDIT: Can you remove the code comments please?

@fabian-co

Copy link
Copy Markdown
Contributor Author

Wow this looks very nice! Congrats! I will take a look at it soon :)

EDIT: Can you remove the code comments please?

Nice!! Sure I'll remove now

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019XviCVbqhgEuFVdZGgf8Ui
@fabian-co

Copy link
Copy Markdown
Contributor Author

Wow this looks very nice! Congrats! I will take a look at it soon :)

EDIT: Can you remove the code comments please?

I've already removed the comments.

@CyberTimon

Copy link
Copy Markdown
Owner

LGTM, thanks for the update!

@CyberTimon
CyberTimon marked this pull request as ready for review October 7, 2026 19:21
@CyberTimon
CyberTimon self-requested a review as a code owner October 7, 2026 19:21
@CyberTimon
CyberTimon merged commit 0e58d20 into CyberTimon:main Oct 7, 2026
@fabian-co
fabian-co deleted the feat/relight-light-shapes branch October 7, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants