Skip to content

Ensure RenderLayers is a Component on every ExtractedLight and its ShadowView/ExtractedView#24797

Open
kfc35 wants to merge 1 commit into
bevyengine:mainfrom
kfc35:24792_render_layers_lights
Open

Ensure RenderLayers is a Component on every ExtractedLight and its ShadowView/ExtractedView#24797
kfc35 wants to merge 1 commit into
bevyengine:mainfrom
kfc35:24792_render_layers_lights

Conversation

@kfc35

@kfc35 kfc35 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Objective

Fixes #24792

queue_shadows() currently queues shadows erroneously because the view light entity never has the RenderLayers component correctly attached. This not only affects directional lights as described in the issue, but all the light types.

Solution

  • Ensure all four types of lights (point, spot, directional, rect) have their render layers extracted (or set to the default layer if not specified).
  • Ensure that the filtering in queue_shadows() actually works with render layers by ensuring that the light entity always has render layers specified. (rect light is an exception since it doesn’t have shadows currently)
  • I standardized the way RenderLayers is attached to extracted lights — I figured that, since it’s a component, it should be attached separately (i.e. not set directly to the extracted structure a la ExtractedDirectionalLight. I remove the RenderLayers from that component.).

Note that this issue/fix is separate from the problem described in #23264. This only ensures the light <-> mesh render layer relationship is respected when queueing shadows. This doesn’t fix anything about the light illuminating the wrong meshes and does not touch any shader code.

Testing

@kfc35 kfc35 added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels Jun 28, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Jun 28, 2026
@kfc35 kfc35 added S-Needs-Review Needs reviewer attention (from anyone!) to move forward D-Straightforward Simple bug fixes and API improvements, docs, test and examples and removed D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels Jun 28, 2026
@kfc35 kfc35 added this to the 0.19.1 milestone Jun 28, 2026

@Zeophlite Zeophlite 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.

I think this is a better separation of concerns

@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 Jun 29, 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: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

Directional lights shadows not rendered for non default render layers

3 participants