Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix disappearing shadows #95

Merged
merged 8 commits into from
Mar 26, 2024
Merged

Fix disappearing shadows #95

merged 8 commits into from
Mar 26, 2024

Conversation

pkomon-tgm
Copy link
Contributor

@pkomon-tgm pkomon-tgm commented Feb 27, 2024

The set of tiles used for calculating the shadow maps was culled with the camera's view frustum. Therefore, shadows cast by objects outside of the view frustum were not visible.

This PR fixes the issue by (per default) including all tiles when calculating the shadow maps. This adds a slight performance penalty, but improves the visual quality.

Culling of the tiles for shadow mapping can be toggled by pressing the V key, although, enabling it only culls the tiles by the camera view frustum and not be the light source view frustum, resulting in the same behaviour as before.

Additionally, you can toggle a debug camera view with F12 and view frustum culling for tiles to draw with C.

This PR serves as a basis for possibly further improving performance and quality by

  • culling the set of tiles used for shadow mapping by the light's view frustum/box
  • refining these tiles based on some (possibly screen-space) metric rather than using the same metric as for tiles to draw

using all tiles for calculating shadow maps fixes problems with shadows, but comes with (minor) performance hit
should do culling with light source's view frustum in future
@pkomon-tgm pkomon-tgm marked this pull request as draft February 27, 2024 13:19
@pkomon-tgm pkomon-tgm marked this pull request as ready for review February 27, 2024 15:08
@adam-ce adam-ce merged commit 57b9713 into AlpineMapsOrg:main Mar 26, 2024
0 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants