high-res real time shadows

Is there anything I can do to make the real-time shadows of the directional light look sharper/have more resolution?

increase shadow map resolution?
use raytracing?

Combine regular CSM with Distance Field Shadows. This way you can use more of the cascade for close resolution.


ok you mean add this?

turned on ray-tracing but still having issues, for instance the shadow is not projected correctly due to Bias as you can see below there is no shadows (green arrows) at the corner of each building:

None of those settings do anything to raytraced shadows. If changing them changes the shadows, then you’re not using raytraced shadows. You’re using cascaded shadow maps.

There already are a ton of threads covering this, you can just google it, But, heres a little suggestion not a lot of people know, lower shadow bias to 0.3 and increase shadow filter sharpen to 0.2, This looks better, but costs literally nothing to use, and works on any light you put in your scene. You may want to sharpen further if you get mild artifacting though.

Tried both values, unfortunately it didn’t change anything.
I should mention that the camera is faraway from the buildings with a high focal length of 100 (I am going for a semi-orthographic look)
Also note that this happens even when raytraced is turned onz2.jpg

That raytracing toggle does nothing unless your project has raytracing enabled.

see here: Real-Time Ray Tracing | Unreal Engine Documentation

Raytraced distance fields requires you have distance fields enabled, but it will probably produce bad results for this scene. It is intended for far shadows, where cascaded shadow maps become too expensive.

Raytracing is activated in project settings.
So how can I fix the bias issue here? Normally in raytracing you don’t worry about that (only in shadow maps) so I don’t know why my shadows don’t start from the bottom of each building?

Set your directional light’s source angle to 50, what’s it look like?

shadows get super blurry

I managed to make the shadows look sharper, but in terms of bias is still not rendering “complete” shadows because the camera is too far.

No idea what to tell you then. AFAIK with raytraced shadows, it shouldn’t make any difference how far away you are. I am not able to reproduce your problem either.

Literally the only thing I can think of that could be wrong is that your mesh is not actually on the floor.

You have the wrong values for Distance Field Shadow Distance and Dynamic Shadow Distance Movable Light. Both of those shadows are rendered between point A (camera) and point B (set distance from camera). Your DF shadows are set to render between 0 and 20,000 Unreal Units, and your camera is way farther than 20,000 from the buildings and the ground. Set the DF distance to at least 200,000, and the CSM Movable Light distance to the same, simply to see if it renders the shadows. Another thing I notice is the angle of the directional light in reference to the building tops and ground is so sharp that it’s producing short shadows. The shadows are much shorter than the height of the buildings. So, any shadows rendered for the buildings that shadows aren’t at corners or the base of those buildings for…are going to be rather short when they do appear.

Note: When Movable Light Distance (in CSM settings) is set to 0, it disables that shadowing.

The issue could be worse if Shadow Bias is set too low or too high, but it’s likely not affecting it yet visibly due to the shadows not rendering at the particular camera distance in the screenshot. For the other CSM settings, increase the cascade count higher to get sharper, more defined shadowing at distances. Set exponent to distribute the shadows closer to the camera, and transition fraction to 0.01. 0.3 is transitioning between shadow cascades at 30% of the distance for each cascade, so a looong, noticeable transition…especially if the shadows have a rendering problem or artifacts.

1 Like

Hey Presto,
I tried what you recommended as you can see below with not much luck.

In Unity all you have to do is adjust the near clip plane for the camera and that fixes the issues because shadows will have a smaller area to cover in the level so more resolution.
Below is how things are looking from my other camera which is closer to the subject, you can see full shadows.

I see. Did you try setting the exponent to higher than 1 to bring cascades closer to the camera? Somehow I think it won’t work, but could be worth a try. I don’t understand how the shadows are rendering at a closer distance, but are not all rendering in the far distance. Is there a default shadow culling variable set so certain size objects and smaller don’t get their shadows rendered at far distances (past a certain distance away)? Probably not.

tried higher than one with no results.
And I don’t have culling variables.

If you hadn’t changed or set culling variables, there is a default for the ones that are accessed in the console cvars list. Some are disabled though, by default, I’m pretty sure.

What version of the engine are you on? The names of some of your lighting settings are different from what I am seeing in both 4.25.3 and 4.24.3