Near and far object shadow problems! Please help

Hi everyone. I would like to ask the community for some advice about shadows.

My project is a space combat sim and consists of large open space with a few moving meshes and enemies. I have opted to use distance field shadows unless someone else has any better ideas?

The problem I am having at the moment is shadowing between near and far. My lighting is just one dynamic direction light and some ships have some none shadow casting static lights. The problem I have run into is that the shadows in-side the player ship are just right when i set the shadow cascade distance to a low amount but ships further away have problems :

47a5e24f0f29371692c5dc56c1a7c07d5cd3a95c.jpeg

bigger NPC ships don’t shadow until the player is right in front of it and large ships looks messy as its mostly un-shadowed with a small shadow area when the player is very close.

When I set the shadow cascade distance to high amount, the other NPC ships are fine, but the player ship does not cast shadows properly and there is lots of light bleed on the layer ship

fcd66a57cfba9937a5d1c365a557fc940885f61b.jpeg

I have tried many different combinations and the best result i can get is still not that good : (I will post a video of this soon).

Is there a way i could achieve a much better shadow solution? Could i set up 2 lights, one for the player ship with clean crisp shadows and another for the world?

Thanks for any advice guys and girls :slight_smile:

Hi Swilliams,

Take a look at this Wiki Guide: A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums

Cascaded Shadows do not work that well for very far distances. Adjusting some of the settings in the light source > Cascaded shadow maps tab can help with this though.

If you have the CSM set to a low or high range you can see the shadows fade in different areas. There are three cascades set up by default. When using a lower distance threshold these are spaced in a smaller area to give better shadows. When expanded to the maximum distance the three cascades are now stretched across that area and will not give the very best results. Settings can be tweaked, but may not be be perfect for larger areas at great distances.

Some have started using Distance Field Shadows for longer distances like this, but that is a high end feature that requires DirectX 11 and may not suit your needs depending on your target platform.

Hi Tom, Thanks. I checked out that doc a while back and found it very useful. It also helped to learn more about distance shadows as that is what I am using. After trying a few things I found that making the player ship cast inset shadows does the trick. SO i can now have both the longer range shadows on other ships and a much better shadow on the player ship at the same time.

I have been using distance field shadows for a while as it seems the best solution for my type of game. What are the draw backs? And what if someone tries playing it without DX11 ?

Distance Fields are a high-end feature that require DX11. I’d imagine that it just wouldn’t work if not DX11.