bevyengine / bevyengine/bevy

Shadows broken when using multiple non-overlapping Point Lights

Open
#8,535 1 comment 2 reactions 0 assignees View on GitHub
A-Rendering C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.10.1

## Relevant system information

- OS: macOS Ventura 13.3.1

```ignore
AdapterInfo { name: "Apple M2 Pro", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
```

## What you did

- I'm moving the player (red cube) through 5 point lights that are next to each other but _not overlapping_.
- Using the `W`/ `S` keys to move the player.
- The camera is focused on the player.

Code: https://gist.github.com/nilaysavant/9259341123e4888ff81d326111169d78

## What went wrong

- The shadows stop working after the first **1-2 point lights**.
- The shadows were expected to work normally for all the points lights and not just for the first 1-2 point lights.

## Additional information

- At times does not work for the 2nd point light also. I think it happens when the camera isn't facing this light.
- Also this is a contrived example of this issue I'm facing in another game. In this case I tried toggling the `shadows_enabled` setting during runtime when the player is under the light source and **it starts to work after that**. I'm guessing its something to do with the camera bounds excluding the lights not in view and thus failing to render the shadows.
- Also increasing the `range` value on each `PointLight` such that it covers the spawn point of the player (cube) and camera makes the shadows work normally.

Both of the above aren't viable solutions to this and is a deal breaker for most games that involve a third person player moving through a corridor/tunnel with point lights at regular intervals for example.

Here's a demo video for the above:

https://user-images.githubusercontent.com/47603308/235898015-3e760518-d49a-44e7-be49-8c6abab7a611.mp4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.