-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Document how to configure cascaded shadow maps in different situations #7362
Comments
Here's a little playground I was using: https://gist.github.com/rparrett/0b8a2de7443d41941ad6463e2a42c331 I'm not sure if the cascades are following the near plane. edit: they definitely don't |
@rparrett you're right - it currently doesn't follow the near plane, but that shouldn't be too large a change. Just need to fix this bevy/crates/bevy_pbr/src/light.rs Line 378 in c9a53bf
@superdump if it feels more natural, I think it would make sense to allow users to configure the near plane direct in |
I attempted that (I think the other bounds need the near plane added as well), but I think there must be something more to it, because the shadows were not even wiggling when adjusting the near plane in the playground above. At the time I believe this might be due to the "raw bounds" being used here: bevy/crates/bevy_pbr/src/render/light.rs Line 1231 in c9a53bf
But I was in a bit over my head. Additionally, there's a question over what |
shadow_maximum_distance is view z distance from the camera position |
@danchia that sounds reasonable and you’re probably right that that line you referenced plays a significant role in the calculation of the cascade projections. |
Though perhaps if adjusting that near plane, we’d need to adjust the way the cascades are calculated in general. The first cascade far bound needs to be > the near plane, and then subsequent cascades need to have far bounds coming after that that scale in a sensible way across the range. |
In the cascaded shadow maps #7064 PR, there were some situations raised that require or would benefit from different cascade configuration to the default which focuses on a perspective camera at head height.
One example was a top-down or isometric type view where a lot of the scene objects are within a small depth range and distributed across the screen with no objects close to the camera. In this case probably fewer or even just one cascade with a higher shadow map resolution could be a better choice.
I think it would be good to try out such situations, tweak the settings, maybe adjust the projection’s near plane as @robtfm suggested in the PR discussion as that impacts the view frustum and if I remember correctly also the cascade projection bounds.
The text was updated successfully, but these errors were encountered: