I wish to report an issue with how VSMs and Distance Field Shadows interact. We’re working on a large scale open world game and wish to utilize distance field shadowing for a major part of our screen. We also want to use VSM’s in the same area and benefit from strengths of both approaches.
The current issue we’re facing, is that following the documentation, we’re using “Dynamic Shadow Distance” property of the directional light, to define the boundary where VSM’s end and where we’d like to rely only on distance fields. The thinking behind this was that we don’t need high detail shadows at the distance, and so we could save some performance.
The problem with this approach is, that Distance Fields Shadows also use this same property, to define “at what distance do we start”. We don’t want Distance Field Shadows to be gone at closer distances, we want them to be visible at any distance. The problem is, that in our case, the distance field shadows are very noticeable and make a major part of the shadowing, adding more detail and depth to the scene than the VSM’s alone do. Unfortunately that cannot be done, since with a single property we either have:
- VSMs at distance 100K AND Distance Field Shadows beyond 100K - no Distance Field Shadows below 100K, undesirable
- VSMs at distance of only 1K AND Distance Field Shadows beyond 1K - VSMs range way too short, undesirable
So with the goal of figuring out how to work this one out, I’ve settled for using “r.Shadow.Virtual.Clipmap.LastLevel”. Even the documentation says, that this indirectly determines the max range of VSM, which is exactly what I want. Following that idea:
- I set “r.Shadow.Virtual.Clipmap.LastLevel” to a lower level, around 15-17, at a range where I want VSMs to end
- I set “Dynamic Shadow Distance” to 0, to have Distance Field Shadows visible at all ranges, even close up
Unfortunately, that’s when I hit the wall with the bug, which I am reporting here. Our scene consists mostly of nanite meshes, but we do have some non-nanite ones. This is a smaller issue however and we could probably even ignore it. The main problem is that many HLODs are nanite-enabled and they loose the shadow, which is very visible and unacceptable. They never cast distance field shadow, at all. Non nanite HLODs are okay.
Please assist with figuring out some approach or alternatives here. Either a place in code where I can split the usage of this property to 2 separate ones, or some bugfix to the killing of Distance Field Shadows due to VSM clipmap setup, which I believe should not happen.
Screens from the provided repro steps, showing what we’re experiencing, as attachements.
[Attachment Removed]