# Cast shadow problem

**URL:** <https://forums.unrealengine.com/t/cast-shadow-problem/458838>\
**Category:** Rendering\
**Tags:** shadows-problem, dynamic-shadows, unreal-engine, Lighting, UE4, question, static-shadows\
**Created:** [November 26, 2019, 2:52am UTC](https://forums.unrealengine.com/t/cast-shadow-problem/458838 "2019-11-26T02:52:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vesol](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vesol](https://forums.unrealengine.com/u/Vesol)\
**Post date:** [November 26, 2019, 2:52am UTC](https://forums.unrealengine.com/t/cast-shadow-problem/458838/1 "2019-11-26T02:52:39Z")

</div>

Hello. As you can see in a screenshot 1, light falls on the side of the box, and a line of light appears along the back wall of the box. I tried using contact shadows length, but as soon as the camera looks at objects from a different angle, a line of light appears again (as in 3 screenshots). I want the line of light not appear (as in screenshot 2). How can this be solved? Thanks.

 ![293012-screenshot1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/e/6/ce6041992357854a3520925cab326a22ae85c670.jpeg)

 ![293013-screenshot2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/d/0/2d0d9b22edeb9848ab0e1d9ffb994b1ec8fb8b08.jpeg)

 ![293014-screenshot3.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/a/f/9af8bccd69d2b3fcc10ebe8bbf7d7fde9be66218.jpeg)

---

<div class="post-metadata">

**Author:** ![loganahogan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@loganahogan](https://forums.unrealengine.com/u/loganahogan)\
**Post date:** [November 26, 2019, 4:10am UTC](https://forums.unrealengine.com/t/cast-shadow-problem/458838/2 "2019-11-26T04:10:13Z")

</div>

It’s the “Preview” that you see in the shadows goober. I think changing the object to movable will get rid of it, or if you wish to keep it static, slap that “Build” and then slap “Build lighting only”

---

<div class="post-metadata">

**Author:** ![Vesol](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vesol](https://forums.unrealengine.com/u/Vesol)\
**Post date:** [November 26, 2019, 12:37pm UTC](https://forums.unrealengine.com/t/cast-shadow-problem/458838/3 "2019-11-26T12:37:54Z")

</div>

The object is moving. The construction of light does not affect a moving object. I tried your suggestions but nothing came of it. I have even more questions. The line of light becomes wider as you move the camera. I know that there are cascade shadows settings in directional light. But in local light sources, I did not find this setting. I also noticed that the farther from the light source the wider the line of light becomes. The shadow bias setting also copes with this problem, but artifacts appear at a value of 0.0.!alt text

 ![293025-screenshot-110.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/7/4/e74750b20fe6de2aac3de1f4749a6eb367ef01b7.jpeg)

 ![293026-screenshot-111.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/3/0/930c9dd624e787071f512932c3bf18ba937bb3c4.jpeg)

 ![293027-screenshot-112.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/a/1/aa155c11e79e27f9ac1fc359e452a5d8376e4de3.jpeg)

---

<div class="post-metadata">

**Author:** ![presto423](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@presto423](https://forums.unrealengine.com/u/presto423)\
**Post date:** [November 26, 2019, 4:13pm UTC](https://forums.unrealengine.com/t/cast-shadow-problem/458838/4 "2019-11-26T16:13:03Z")

</div>

Are you talking about the line of light on the top edge of the object? The light is accurately casting onto that edge, so to get rid of it, you’ll need to do something other than move the light or the object. Isn’t there a setting to change light scattering intensity of an object? You could potentially make a really small light importance volume that fits the edge precisely, and change its settings to basically filter out the light casting onto it.

---

<div class="post-metadata">

**Author:** ![Vesol](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vesol](https://forums.unrealengine.com/u/Vesol)\
**Post date:** [November 26, 2019, 4:55pm UTC](https://forums.unrealengine.com/t/cast-shadow-problem/458838/5 "2019-11-26T16:55:27Z")

</div>

I meant another line. Seen in the screenshot. I took a screenshot from a different angle. I also reduced the shadow map resolution for clarity.

 ![293043-untitled1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/6/4/8640a32fc977180245dcae7757e257ed679d977a.jpeg)

 ![293044-untitled2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/7/d/27d76861cf5c8acd78cd5f8fe4ee06f3862d8769.jpeg)

---

<div class="post-metadata">

**Author:** ![presto423](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@presto423](https://forums.unrealengine.com/u/presto423)\
**Post date:** [November 27, 2019, 4:07pm UTC](https://forums.unrealengine.com/t/cast-shadow-problem/458838/6 "2019-11-27T16:07:10Z")

</div>

Here’s something to try:

1. Check that “Generate Mesh  
Distance Fields” is enabled in  
Project Settings - Rendering. If  
it’s not enabled, enable it.
2. Select the point light being used in  
the scene, as seen in the pics, and  
in the Details panel scroll down to  
Distance Field Shadows. Enable it  
if it’s not already got a check in  
it. Don’t change the distance  
setting unless it’s 0. If distance  
is 0, change it to at least 1000.
3. Go up the Details panel to where  
Source Radius and Source Length are  
located. Change the Source Radius  
value steadily from 0, and see what  
happens with the line of light that  
you don’t want, and the shadowing.  
Try not to intersect the scene with  
the Source Radius value (distance  
from the edge of source radius to  
the cart object).

Here’s a link to the Distance Field Soft Shadows page of the docs, which describes briefly how distance field shadows are used with Source Radius to control specular highlights (or the unwanted line of light in this case):

> **[Distance Field Soft Shadows](https://docs.unrealengine.com/4.27/en-US/BuildingWorlds/LightingAndShadows/RayTracedDistanceFieldShadowing/)**
>
> An overview of using Mesh Distance Fields to create dynamic soft area shadowing.

---

<div class="post-metadata">

**Author:** ![presto423](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@presto423](https://forums.unrealengine.com/u/presto423)\
**Post date:** [November 27, 2019, 4:16pm UTC](https://forums.unrealengine.com/t/cast-shadow-problem/458838/7 "2019-11-27T16:16:07Z")

</div>

It could also be the light is bouncing off the ground and casting a shadow of the object from that angle of incidence rather than strictly over the top side of it. I say that because there’s two round protrusions in the shadow inside the cart object (see screenshots 109 and 110) that appear to be the shadows of geometry below on the exterior of the cart (wheel housings or something?).

---

<div class="post-metadata">

**Author:** ![Vesol](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vesol](https://forums.unrealengine.com/u/Vesol)\
**Post date:** [November 27, 2019, 6:30pm UTC](https://forums.unrealengine.com/t/cast-shadow-problem/458838/8 "2019-11-27T18:30:28Z")

</div>

You correctly thought that the problem might be in the “Generate Mesh Distance Fields”. I got a little confused in the names of the settings but was able to find the optimal values. In the screenshot, I highlighted the settings that I changed. What about the reflection from the floor, that was not the problem. Thanks for the help!

 ![293109-untitled.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/6/f/26f370c58f6151771ae09db2a5234304f7941dac.jpeg)

---

<div class="post-metadata">

**Author:** ![presto423](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@presto423](https://forums.unrealengine.com/u/presto423)\
**Post date:** [November 27, 2019, 6:57pm UTC](https://forums.unrealengine.com/t/cast-shadow-problem/458838/9 "2019-11-27T18:57:52Z")

</div>

From what I read, the mesh distance field shadows are also less costly in memory and rendering speed. Interesting that it got rid of the weird protruding shadows inside the object. It may have distorted the corners, or those blocks supporting the cart interior at the base of the object, because it was calculating the occlusion wrong. Kinda like offsetting parts of the entire shadow to incorrect parts of the entire shadow. You’re welcome. I’m a beginner too, and have really become mystified by a number of lighting / shadowing features in Unreal.
