Some Cascaded Shadows Missing

I’ve just migrated a project from 4.13 to 4.14 and got some issues with Cascaded Shadow Maps right away. It looks like some of the them won’t show up when I set any value greater than 3, which will cause a gap artifact. I’ve rebuilt lights a couple of times and it won’t make a difference.

I’ve tested it in a new project (default first person shooter template) and the issue is also present.

4.14:

http://i.imgur.com/0gh5qOK.jpg

4.13:

http://i.imgur.com/tjd4ze5.jpg

Hi Rabellogp,

The information you’ve provided isn’t really enough for me to reproduce without some guess work. When I setup a simple scene I don’t see the issue.

You mention that you can reproduce this in the new First Person Project. Can you detail the steps here to reproduce the issue?

The questions that remain from your images above.

  • The 4.13 screenshot shows “Ray Start Offset”, which would indicate you’ve enabled Distance Fields, but you’ve not included that as part of the description.
  • Obviously, you’re using some static lighting in scene because of the Stationary Directional light, but you’ve not indicated if the Foliage painted here is using static lighting or not (disabled or enabled via the Foliage Tool for that mesh).

Any additional details to reproduce would be helpful here.

Thanks!

Tim

Hello, Tim.

  • Yes, I’m using Ray Traced Distance Field Shadows in this project, but it starts beyond Cascaded Shadow Maps distance (6000 in this case). The issue occurs inside that radius.
  • The trees are dynamic and won’t cast static shadows. There are other static objects in the scene, but the issue affects all of them. I believe that once I activate Cascaded Shadows, all the static baked shadows inside that radius are replaced by dynamic ones, right?

This is how I’m reproducing the issue in the First Person Project. Just place the camera more or less like in the images bellow and use those Cascaded Shadow Maps parameters for the Light Source. I set Dynamic Shadow Distance to include all the scenery from that camera position. Both the static objects (the walls) and the movable ones (the white boxes) are casting dynamic shadows at this moment. Inset Shadows are disabled.

4.13 with 3 cascades:

http://i.imgur.com/FcuNOzh.jpg

4.13 with 5 cascades:

http://i.imgur.com/hjWkAdJ.jpg

4.14 with 3 cascades:

http://i.imgur.com/Jok4zd4.jpg

4.14 with 5 cascades:

http://i.imgur.com/fduDWS6.jpg

It looks like the transition you’re seeing here is between Cascaded Shadow Maps and Distance Field Shadows. I can reproduce this effect in 4.13 as well. In your 4.14 shows it just looks like you don’t have Distance Field Shadows enabled on the Directional Light, for the project, or the engine scalability (Needs to be on HIGH or EPIC to work) since you’re getting no distance field shadowing that I can see.

For whatever reason I cannot get the gap you see with your foliage if I recreate something similar with my test speed tree assets, but I would suspect there is something there that’s just set or carried over when converting the project most likely. Using the visualization modes and disabling/enabling the distance fields can help narrow down these types of things.

With Stationary Directional Lights, you have three levels. The base level is the Static lighting, Dynamic Cascades, and Distance Field Shadows. If you’re using just default settings for a stationary directional light when the Cascades fade out the static shadowing takes over. If you enable Distance Fields then these replace the static lighting for distances. The tradeoff here is you get the fade in between your cascades and distance fields. This is what’s happening in the images you have above from the FirstPerson Template and even still I don’t get it to the degree you get which would indicate that something is likely changed in your project such as the Engine Scalability settings going lower.

That being said, I cannot reproduce the issue you see with the same effect in the FP Template or in a level to try and reproduce the gap you see for your foliage.

link text

I’ve attached a test SpeedTree asset above. Can you download that and recreate in a blank project the same issue you see with your trees and then post a download link here.

For the last FPS project screens, Distance Field Shadows are disabled in both 4.13 and 4.14 tests. And the Cascade radius is greater than the distance from camera to the opposite corner of that room.

Now that you mentioned about the Engine Scalability settings I just noticed there is a new option in 4.14 (that I wasn’t aware of) called “Cinematic” and it is set by default. I’ve changed it to Epic and the issue is gone. It looks that the shadow issue is related to this new Cinematic preset then… I can’t find any documentation about this.

If you can’t reproduce the issue even in the Cinematic mode let me know and I’ll link a project here with the speedtree model and all set.

That mode was added in 4.14 with only a small mention in the release notes.

New: Added a new “Cinematic”
Scalability level to the scalability
system.

  • This level is intended for offline rendering of cinematics only.

I’ll give this a shot tomorrow and see if I see similar results. Since this is meant for cinematics only I would imagine there is something being set that should only really expect this to be good for shots close to the camera vs far distances. I’ll see what I can dig up though.

After looking at this I would expect this to be the result needed. The Scalability settings for Cinematic are set in the BaseScalability.ini file. For Shadows the CVar for r.Shadow.MaxResolution is being increased to 4096 for much higher quality. This is used over a shorter distance.to maintain the higher shadowmap quality for cascades. You can adjust the distance if you want to use higher resolution, but ultimately these are used for cinematics that would be closer to the camera for better quality. Increasing the distance just lowers the quality over the farther shadow distance, though. This setting shouldn’t really be used in real-time play, though. Make sure to keep it at EPIC for the best results or lower depending on your target system.

So really in essence in the way things are scaled, if you use Cinematic (max shadow resolution is 4096) it will cast over a shorter dynamic shadow distance when increasing the cascades. You will simply need to up the dynamic shadow distance to account for this, but at a definite performance cost!

Thanks for clarifying. The shorter distance to compensate the higher shadow resolution makes sense. I just think there is still some sort of issue when the engine calculates the distance it should stop rendering cascaded shadows to start rendering distance field shadows (or static shadows) when there are more than 3 cascades in Cinematic mode. I can indeed push the cascaded shadows distance further by increasing its value, but that will equally push that strange “gap” further too and it will remains there no matter what. Depending on the scene that will definitely be visible, so I don’t think its an expected side effect… Maybe there should be at least some sort of warning clarifying that when the user set more than 3 cascades in Cinematic preset.

Thank you for clarification. I am also wondering about the problem here. I just think there are still some types of problems when the motor calculates the exact distance. I do not know much about 3D or 2D because I’m a specialist in graphic design or superstructure. Like we do a Nha Trang Car but we do not understand the equipment inside, should use the scanner to have a correct photo frame.