Skip to content

fix: avoid duplicate ambient lights - #26

Merged
kolkov merged 1 commit into
gogpu:mainfrom
besmpl:agent/fix-ambient-light-duplication
Aug 11, 2026
Merged

fix: avoid duplicate ambient lights#26
kolkov merged 1 commit into
gogpu:mainfrom
besmpl:agent/fix-ambient-light-duplication

Conversation

@besmpl

@besmpl besmpl commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • remove the second direct-child ambient-light collection pass
  • collect every light type through the existing visible scene traversal
  • prevent direct ambient nodes from occupying two frame-uniform slots
  • make ambient lights obey the same nested visibility rules as other lights

Why

buildFrameUniforms already finds AmbientLight through lightFromNode during TraverseVisible. It then scanned direct children again with collectAmbientLights, so a normal scene containing one ambient and one directional light reported three lights and applied the ambient contribution twice. The second scan also included hidden ambient nodes.

Verification

  • baseline regression: one ambient plus one directional produced LightCount == 3
  • baseline regression: hidden direct ambient nodes were still collected
  • direct ambient and directional sources are now counted once each
  • visible nested ambient sources remain supported
  • hidden nodes and hidden subtrees are skipped
  • max-light truncation remains unchanged
  • go test ./...
  • go test -race ./...
  • go build ./...
  • go vet ./...
  • gofmt and git diff --check

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@besmpl
besmpl marked this pull request as ready for review August 10, 2026 17:38
@besmpl
besmpl requested a review from kolkov as a code owner August 10, 2026 17:38
@besmpl
besmpl force-pushed the agent/fix-ambient-light-duplication branch from 6e46d9b to 6c1316d Compare August 10, 2026 20:29

@kolkov kolkov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code reviewed: correct fix — removes redundant collectAmbientLights, traversal already handles ambient via lightWithUniform interface. 3 tests cover dedup, nested groups, hidden nodes. LGTM.

@kolkov
kolkov merged commit 96225bf into gogpu:main Aug 11, 2026
10 checks passed
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