Shadows disappear with increased camera distance

I was playing with a pseudo-isometric camera style (low camera Field of View) with a larger camera distance to give it a 2.5D feeling but still maintain some perspective.

Anyhow, I’m not sure if this is a bug or if I need to change the way my lighting is being handled in the scene. When the camera distance (being driven by the SpringArm in the Blueprint) exceeds about 6500+ units all of the cast shadows seem to completely disappear or are not being rendered or registered. However, by just lowering the camera distance back down below 6000 units, they pop right back in. This can be seen in real-time while playing the game demo.

6a595181cf22a7ff4bd3db63f5b06587dc9c145f.jpeg

4ebb9c2a10a854238fc2e8795ab699f6c9681757.jpeg

Would love to hear any suggestions on how to make this work without having to have a closer camera distance.

Thanks!

EDIT - RESOLVED

Some gathered notes that help me solved this problem (thanks everyone!):

When using Stationary or Movable Lights on a movable mesh (not static) the shadow visibility of that movable mesh is dependent upon the size of the mesh and its distance from the camera.

Command Line Values to Tweak:

r.Shadow.FadeResolution - controls how big the light has to be on the screen before it starts to fade out.
- Default Value: 64
- Can lower this value to keep shadows from fading out at further distances

r.Shadow.MinResolution - controls how big the light has to be on the screen before it finishes fading out, at which point it no longer has cost.
- Default Value: 32
- Lower values seem to increase shadow visibility.

r.Shadow.TexelsPerPixel - Causes a higher resolution to be assigned and then it should fade out less aggressively
- Default Value: 1.27324
- Can increase this value to improve shadow rendering visibility & quality

r.Shadow.RadiusThreshold
- Default Value: 0.03
- A lower value of 0.02 or 0.01 greatly increases shadow visibility at far camera distances (seems to have the most impact of all the console commands).

Useful Link: https://docs.unrealengine.com/latest/INT/Engine/Rendering/Scalability/ScalabilityReference/index.html

10 Likes

Just increase the max cascaded shadow distance on your directional light :wink: If I am right…the max supportet value on a movable light should be 20000 units…however you will sacrifice cascade resolution as well so its a trade off.

5 Likes

Appreciate the reply.

I’ve tinkered with all of the cascaded shadow settings for the light (with the light set to both Movable and Stationary), and the results are always the same. Any shadows being cast from my movable character object (the ball) completely cease to be displayed once the camera distance passes 6900.

3 Likes

Then its probably tied to some ini size setting. That means the ball gets so small compared to what you see on screen over distance that even if the shadows would cover it, the ball just doesnt cast one anymore because its too small on screen. I would ask Epic if there is some ini tweak to tweak the object size to screen ratio for small stuff so it can still cast shadows. (if I remeber correctly we had that issue with the stationary light once in the office as well, one of our coders did something and after that it worked xD)

Hmm, yeah hoping to get some official word on this as to whether or not it’s just a limitation of camera distance or if there’s a setting that can be adjusted.

If that’s a stationary directional light, the movable object is using per-object shadows and they get faded out when small. The console variables controlling it are

r.Shadow.FadeResolution - controls how big the light has to be on the screen before it starts to fade out.
r.Shadow.MinResolution - controls how big the light has to be on the screen before it finishes fading out, at which point it no longer has cost.

You can setup these console overrides for your game to whatever you want.

1 Like

Thanks ,

I wasn’t aware of all the shadow controls in the console commands.

In one scene where the camera isn’t too far those values do help bring some shadow visibility back. However, in my main project where the camera is a bit further (7000+ units on the SpringArm), no combination of values for those two variables seems to restore shadow visibility.

Obviously, for now, we are bringing the camera in closer and pumping the camera’s FOV back up, but I would really like to know if this is an engine limitation or if I’m just not approaching the problem properly (lighting isn’t my strongest suit!).

Even when both of those settings are 1? Another one you can use is r.Shadow.TexelsPerPixel, to cause a higher resolution to be assigned and then it should fade out less aggressively.

1 Like

Yeah, even at a value of 1. Could you, if you get some time, try opening something like the Rolling Blueprint project template and increasing the springarm distance on the ball blueprint to something really high, like 7000?

I’ve tinkered with the extreme values of pretty much everything I can think of at this point.

Bumping.

I’ve seen a couple of other AnswerHub and Forum posts with similar issues.

It all seems to be related to size of object and distance of that object from the camera. If the camera distance is great enough the dynamic shadows just won’t display.

I have the same problem. For me, changing r.Shadow.RadiusThreshold=0.03 to 0.01 fix it.

3 Likes

Thanks!

It looks like the RadiusThreshold value change in conjunction with r.Shadow.TexelsPerPixel being set higher OR setting r.Shadow.FadeResolution to a lower value does the trick.

Some gathered notes that help me solved this problem (thanks everyone!):

When using Stationary or Movable Lights on a movable mesh (not static) the shadow visibility of that movable mesh is dependent upon the size of the mesh and its distance from the camera.

Command Line Values to Tweak:

r.Shadow.FadeResolution - controls how big the light has to be on the screen before it starts to fade out.
- Default Value: 64
- Can lower this value to keep shadows from fading out at further distances

r.Shadow.MinResolution - controls how big the light has to be on the screen before it finishes fading out, at which point it no longer has cost.
- Default Value: 32
- Lower values seem to increase shadow visibility.

r.Shadow.TexelsPerPixel - Causes a higher resolution to be assigned and then it should fade out less aggressively
- Default Value: 1.27324
- Can increase this value to improve shadow rendering visibility & quality

r.Shadow.RadiusThreshold
- Default Value: 0.03
- A lower value of 0.02 or 0.01 greatly increases shadow visibility at far camera distances (seems to have the most impact of all the console commands).

Useful Link: https://docs.unrealengine.com/latest/INT/Engine/Rendering/Scalability/ScalabilityReference/index.html

4 Likes

Hi! How to keep these settings for the project?

Hello everyone. Thanks for the advice, problem solved. Compilation is successful, it works in the finished project.

Hi,

I facing the same problem here. Im new to UE4, can someone please guide me on where to change the value that you are are talking about ?

Thanks

@ansonkit

You want to change these settings in DefaultEngine.ini, it should be located at:
your_project_folder/Config

You will want to add the shadow settings under the section:
[/Script/Engine.RendererSettings]

I hope that helps (or if you already figured it out that this helps someone else.)

hate to resurrect this but i am struggling with the same issue.
tried changing defaultengine.ini in project config and the consolevariables.ini in UE4.10 folder but nothing seems to change.

i added:
[/Script/Engine.RendererSettings]
r.Shadow.FadeResolution=16
r.Shadow.MinResolution=16
r.Shadow.TexelsPerPixel=3
r.Shadow.RadiusThreshold=0.01

no dice, any tips?

Far Shadows!

Dear Everyone,

Far Shadows are now in the engine and resolve all these issues!

Rama

1 Like

Is there a solution if you’re using spotlights instead of directional lights? My shadows seem to disappear when the camera is about 6-8k units away from the spotlight.

EDIT: So my problem was that the bounds on the meshes that had clipping/disappearing shadows had to be increased. Select Mesh->Rendering->Bounds Scale.

5 Likes