Skip to content

Fix: Update the ExtractedView & Frustum when the ExtractedPointLight has changed#24038

Merged
alice-i-cecile merged 4 commits intobevyengine:mainfrom
kfc35:23997_spotlight_fix
Apr 30, 2026
Merged

Fix: Update the ExtractedView & Frustum when the ExtractedPointLight has changed#24038
alice-i-cecile merged 4 commits intobevyengine:mainfrom
kfc35:23997_spotlight_fix

Conversation

@kfc35
Copy link
Copy Markdown
Contributor

@kfc35 kfc35 commented Apr 29, 2026

Objective

Solution

  • For Spot lights (and Point lights since those were also affected), update the ExtractedView and the Frustum if its corresponding ExtractedPointLight has changed.
  • AFAIK this isn’t needed for Directional lights because ExtractedViews aren’t re-used — they’re made anew in prepare_lights

Testing

  • cargo run --example spotlight works as desired.
  • cargo run --example async_channel_pattern works as desired (for PointLight testing)
  • @Zeophlite assist with the example runner (was done before the frusta change though)

@kfc35 kfc35 added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 29, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Apr 29, 2026
@kfc35 kfc35 added this to the 0.19 milestone Apr 29, 2026
.after(early_prepass_build_indirect_parameters)
.before(early_downsample_depth)
.before(per_view_shadow_pass::<LATE_SHADOW_PASS>),
.before(shared_shadow_pass::<LATE_SHADOW_PASS>),
Copy link
Copy Markdown
Contributor Author

@kfc35 kfc35 Apr 29, 2026

Choose a reason for hiding this comment

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

this seemed like an oversight that I spotted so I just added this, it’s unrelated to the fix. I can remove this if desired but it’s small so I felt OK sneaking it in

@kfc35 kfc35 changed the title Fix: Update point_and_spot_light_view_entities when the ExtractedPointLight has changed Fix: Update the ExtractedView when the ExtractedPointLight has changed Apr 29, 2026
@kfc35 kfc35 force-pushed the 23997_spotlight_fix branch from 9fd3609 to e78d3b4 Compare April 29, 2026 22:22
@kfc35
Copy link
Copy Markdown
Contributor Author

kfc35 commented Apr 30, 2026

Thanks @Zeophlite for the assist with the example runner!

I inspected those results and learned that the frusta need to be included in the components to update, so I included those as well in the most recent commit. I also learned that the async_channel_pattern is a great example to observe a transforming PointLight.

Now, the async_channel_pattern example looks as it should from before the “render spot and point lights once” change. The shadows actually stick to the boxes as the lights rotate around and they don’t disappear weirdly. I’ve got more confidence that this is the right fix.

@kfc35 kfc35 changed the title Fix: Update the ExtractedView when the ExtractedPointLight has changed Fix: Update the ExtractedView & assoc. Frusta when the ExtractedPointLight has changed Apr 30, 2026
@kfc35 kfc35 changed the title Fix: Update the ExtractedView & assoc. Frusta when the ExtractedPointLight has changed Fix: Update the ExtractedView & Frustum when the ExtractedPointLight has changed Apr 30, 2026
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 30, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 30, 2026
Merged via the queue into bevyengine:main with commit 638c5dd Apr 30, 2026
40 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in Rendering Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Example spotlight and rect_light render incorrectly

3 participants