I'm using default DirectionalLightBundle (with shadows enabled, of course), and i tried using DirectionalLightShadowMap { size: 4096 } but that didn't really help. I tried tinkering with CascadeShadowConfig and some settings do help, but that's mostly random luck. Are there some common sense settings for pretty simple scenes such as mine?
#Low quality shadows from DirectionalLight
1 messages ยท Page 1 of 1 (latest)
ok so when i decrease maximum_distance at some point i don't see any shadows at all
and another observation: shadows for faraway objects seem fine with default settings (distance 1000)
so it's a choice between bad shadows for near objects vs no shadows for far objects ๐ค
You have to adjust CascadeShadowConfig based on your scene but if you have a large range of distances that require shadows (sounds like that's your case) then you will run into this issue. I think there is a fix for this on main (shadow filtering https://github.com/bevyengine/bevy/pull/8006) but I haven't tried it out yet. It will be included with the 0.12 release
should i try to tinker with something else other than max_distance?
i think i understand the problem conceptually btw: i'm making an rts game, there are large distances between objects, but typically you aren't supposed to view one object with camera being at another object. like, all the view is top-down and potential max distance to camera is relatively small
but in my case, i added a flying camera to be able to look around freely, at any angle. that's not really supposed to be happening in the game, and it results in very large viewing distances
it's kinda fun to watch it work after i learned how cascaded shadows work. but ye at some specific distances the aliasing is just really quite bad
like these are great
For a flying cam I just use the default settings except for the maximum_distance and it looks quite good already:
let cascade_shadow_config = CascadeShadowConfigBuilder {
maximum_distance: 200.0,
..default()
}
Anything outside of the maximum distance I hide with fog.
For top-down you may want to look at minimum_distance and first_cascade_far_bound as well
go up, seemingly hitting another cascade. worse, but tolerable quality.
go up a lot more. same cascade, looks very good from this distance
go up a bit further, hit another cascade, and all of a sudden it's a total wreck
i included more in the last pic to show that the further away ones (vs original that i showed) are also not looking good
You can increase the overlap_proportion to make the transition more subtle, but I think that's the expected behavior without shadow filtering
Basically you just have to wait a few weeks (or use main) or try to hide the issue by limiting the max distance
i would mostly attribute it to myself not really knowing how cascaded shadows work. i still don't (fully), but at least some things are understandable ๐
my main learning tool is trying to tinker with something, that's why i like inspector so much. but cascaded shadows are configed through the builder, so it's harder to tinker to figure things out
Ah yeah
But I think it's good timing to learn this now, because with shadow filtering it would have been more difficult to see what is going on under the hood
i assume that with lower max_distance the transition between cascades are also just naturally smoother
with the same amount of cascades
indeed
i'm also kinda surprised that cascaded shadows came to Bevy pretty late
i didn't really know about how they work exactly but now i think they're quite crucial ๐
Yeah rendering stuff is difficult and it's all being done by people working on it in their spare time
But really good progress is being made
i don't fully understand first_cascade_far_bound though. the default is 5%. what does it mean? like, first cascade goes from 0% to 5%, second from 5% to x%, etc? (can't tell which x because it seems it's non-linear but exponential)
*0% to 5% of viewing distance
Afaik it's not a percentage, just distance (unitless). The rest of the cascade bounds get calculated based on your CascadeShadowConfigBuilder settings (which is exponential indeed)
ahh it seems in the same units as distance
i also figured out why shadows looked just particularly aliased. it's because i use camera's fov change for zooming in and out
Ahh good catch
thanks for the help, i'm now even more excited about 3d ๐
Awesome! No problem
idk if it's been mentioned here yet but PCF in bevy 0.12 will also make the shadows smoother