Skip to content

SpotLight + Camera on the same entity causes incorrect culling #19593

Open
@NickTheFox99

Description

@NickTheFox99

Bevy version

v0.16.1
(Cargo.toml stated >=0.16, noticeable in both 0.16.0 and 0.16.1)

Relevant system information

Adapter Info:

`AdapterInfo { name: "NVIDIA GeForce RTX 4060 Laptop GPU", vendor: 4318, device: 10464, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "561.09", backend: Vulkan }`

What you did

I attempted to try to add a SpotLight component (with shadows_enabled: true) to an entity that had a Camera3d component after the Camera was initially spawned. I added the component to the same entity as the camera, not to a child.

What went wrong

I was expecting everything (but the spot light) to remain the same after adding the component.

What actually happened was the objects would disappear when camera rotated correctly, the amount of error where objects would disappear changing when closer or further.

Additional information

Code: https://github.com/NickTheFox99/bill-boards-bevy/tree/985506e56053e864438870a3440341d8ce8aca96
Relevant Files (in src/): lighting.rs, player.rs, cube.rs

Correct / Expected behaviour
Image

Unexpected / Observed behaviour
Image

I'm thinking that somehow the SpotLight may be triggering the Camera culling more actively when placed on the Camera, but I don't know how much of the components work under the hood and I may be wrong.

To work around this, I've added a child entity to the Camera and added the SpotLight to that. I've also noticed that setting the shadows_enabled field on the SpotLight to false fixes the issue.

I've looked, and do not think there are any similar issues noticed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorC-DocsAn addition or correction to our documentationS-Needs-DesignThis issue requires design work to think about how it would best be accomplished

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions