bevyengine / bevyengine/bevy

Shadows disabled when second camera is activated

Open
#14,644 1 comment 0 reactions 0 assignees View on GitHub
A-Rendering C-Bug S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version

0.14.0
```ignore
`AdapterInfo { name: "Apple M1 Pro", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }`
```
## What went wrong

Two different scenarios, both of which exhibit the problem:

Scenario 1: Thumbnail generator

I have a main camera which is targeting the window; it's viewing a scene that has a directional light and various models. All of these items are on renderlayer 2.

I spawn a second camera to generate thumbnail images, which targets an Image. This camera also has a directional light and a model. These are all on renderlayer 1.

Whenever the second camera is active, the shadows on the first camera disappear. If I set the second camera is_active to false, then the first camera shadows re-appear. If I delete the directional light for the second camera, the shadows also re-appear.

Scenario 2: Portals

This scenario is similar to the first, except that there's only one render layer: camera 2 is the remote portal camera, but is viewing the same scene, with the same lights, as camera 1.

My portal system only spawns camera 2 when a portal is within the view frustum, and despawns it otherwise.

What I see is that when a portal comes on-screen, the shadows on the main camera disappear.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing both reported scenarios in Bevy 0.14, especially with the Apple M1 Pro and Metal backend: a second active camera with its own directional light, and a portal camera viewing the same scene. Trace the camera and shadow-rendering paths to determine why activating the second camera removes the first camera's shadows. Done means both cameras can remain active without disabling shadows in either view.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.