Skip to content

Restrict portal shade interpolation to actual portal-edge vertices#1210

Open
Copilot wants to merge 4 commits into
developfrom
copilot/fix-vertex-lighting-issue
Open

Restrict portal shade interpolation to actual portal-edge vertices#1210
Copilot wants to merge 4 commits into
developfrom
copilot/fix-vertex-lighting-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

Vertices that share world coordinates across adjacent rooms could inherit lighting from the wrong room during shade matching. This showed up as bright/dark seams on non-portal geometry whenever coincident vertices happened to fall inside the portal match region.

  • ### Root cause

    • Portal shade matching used a portal bounding volume check, not a portal-edge check.
    • Any coincident vertex inside that region could be marked as portal-adjacent and have its color blended with the adjoining room.
  • ### Change

    • Introduced a shared PortalShadeMatchHelper used by both room compilers.
    • Replaced the broad bounding-region test with an edge-membership test: only vertices lying on the actual portal perimeter are eligible for shade matching.
    • Applied the same rule to:
      • legacy room compilation
      • TombEngine room compilation
  • ### Test coverage

    • Added focused regression tests for the helper:
      • rejects vertices inside the portal surface but not on the seam
      • accepts vertices on the portal edge
    • Exposed the helper to the test assembly via InternalsVisibleTo.
// Only match shades for vertices that actually lie on the portal edge.
if (!PortalShadeMatchHelper.IsCandidate(p.Vertices, v1.Position))
    continue;

Copilot AI and others added 3 commits April 20, 2026 08:33
Agent-Logs-Url: https://github.com/TombEngine/Tomb-Editor/sessions/b1a5cc85-7551-4a1d-923d-6c0da8a27227

Co-authored-by: Nickelony <20436882+Nickelony@users.noreply.github.com>
Agent-Logs-Url: https://github.com/TombEngine/Tomb-Editor/sessions/b1a5cc85-7551-4a1d-923d-6c0da8a27227

Co-authored-by: Nickelony <20436882+Nickelony@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix lighting issue for overlapping vertices Restrict portal shade interpolation to actual portal-edge vertices Apr 20, 2026
Copilot AI requested a review from Nickelony April 20, 2026 08:39
@Nickelony Nickelony added bug Something isn't working as intended. ready for review The Pull Request is finished and ready for review. labels Apr 20, 2026
@Nickelony Nickelony marked this pull request as ready for review April 20, 2026 17:03
@Nickelony Nickelony added this to the Version 2.1 milestone Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as intended. ready for review The Pull Request is finished and ready for review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TE: vertices sometimes gets lighting from other room, if said vertex shares the same position as a vertex from that other room

2 participants