I’m hoping there is an easy solution to this as it is pretty irritating, I am generating procedural mazes using meshes as actors. But the shadows are not good at all, and as you can see, some objects shadows “pop” off as the camera moves away despite the cascade being much farther in the distance.
I have been googling and searching here for a solution, but I am just going round in circles with what I think must be an easily correctable issue.
As for the scene scale, the square/rectangle (multi-coloured) grids are 1 meter across, I don’t know if that is relevant or not. That would seem to me to be a normal scale.
The light is a directional set to movable.
I had heard some people mention “BoundScale” but I cant find this in the documentation, or where this parameter is on the objects.
If anyone has any insight or a fix for this I would really appreciate it, the shadow distance in general is terrible too, this limitation seems incredibly tight.
If you are using a single mesh and generating different shapes procedurally by scaling them non-uniformly, you might be experiencing a bounds scale issue for sure. Use the images below to toggle the visualizer for the Bounds of your selected objects in the scene, as well as the location on how to change the ‘Bounds Scale’ as well.
I enabled the bounds in view port, and can clearly see that the smaller of the spawned objects have small bounds, even relative to their own size (despite the fact that they are all scaled to 1,1,1 - I am assuming that being on flat planes with no thickness must be limiting the bound size, but that is not an issue.)
When I drag and drop the mesh into the view port, I can see and adjust the boundscale as per your last image. And it had exactly the effect I wanted, and that one small pieces shadow remained visible long past the rest of the meshes. Perfect!
However, I cant see a way of setting the boundscale in the content browser - so it will be applied to the meshes within the blueprints prior to spawning.
What is the best way of achieving this?
Thanks again Andrew, I really appreciate your help.
I am glad to see the bounds scale fixed the issue somewhat. You will want to be careful not to increase the bounds too much, or you will see a drop in performance. The next thing you can do is to increase the number of cascades within the Cascaded Shadow Maps section. This allows you to modify the number of shadow cascades, the shadow resolution, and their relative distances in transition from Static to Dynamic shadows.
For more information about Cascaded Shadow Maps you can take a look at our documentation provided below.
Cascaded Shadow Maps - Dynamic Scene Shadows
Another technique you can try is Ray Traced Distance Field Soft Shadowing. There is an important limitation to this approach that requires you do not aggressively scale things non-uniformly. What I mean by this is, you mention you are scaling all of your objects 1,1,1 and you can get away with perhaps something like 1,2,1, but scaling too far will cause inaccurate shadowing and produce artifacts.
Ray Traced Distance Field Soft Shadows
Personally, I love this technique as it can really improve performance for large outdoor scenes with heavy foliage, but it also works well in other cases. The documentation will show you the process of enabling and using the shadowing technique, but if you are stuck and need some more assistance I will be glad to help.
Sorry to be a pain, but I am still stuck on this. I just need some clarification on how to set the bound scale in the content browser prior to spawning the blueprint with the mesh (since the game is procedural.)?
I did actually ask that in my last reply, but it was hidden after the picture which I can see is pretty misleading, Haha, Sorry about that. Thanks again, and for the details on the shadows, I’l have a read!
Apologies, I must have gotten ahead of myself when explaining the shadowing set up! You will actually want to set the bound scale per component within the blueprint you are spawning itself. This can be done by opening up your Blueprint, clicking on the StaticMeshComponent, and navigating to the ‘Rendering’ section within the ‘Details’ panel (same as in editor viewport).
You can set that property via the Light actor itself using the Min/Max Draw Distance setting. If you are using CSM then you use the Shadow Distance there.