# Improving Virtual Shadow Map Distance/Quality

**URL:** <https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163>\
**Category:** Rendering\
**Tags:** unreal-engine, UE5-0, Lighting, Rendering, question\
**Created:** [August 10, 2022, 2:19am UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163 "2022-08-10T02:19:16Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Apgar426](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/apgar426/32/555912_2.png) [@Apgar426](https://forums.unrealengine.com/u/Apgar426)\
**Post date:** [August 10, 2022, 2:19am UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/1 "2022-08-10T02:19:16Z")

</div>

Hello all. With virtual shadow maps, I’m having trouble getting detailed shadows to stay visible as I move the camera further from mesh geometry. This is just with a single directional light, movable.

 ![vsm_pop](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/6/9/a69c5bd2bee9b8d871dc62247b5ca278625317ab.jpeg)  
As this picture tries to show, moving a slight distance forward towards this mesh results in a much more dark and detailed shadow appearing under the bricks. That’s working as intended, I understand, as part of the clip map system. However, I’m just a little confused as to how close you have to be to have those detailed shadows appear, and how abruptly the shadows just disappear as you get farther away.  
 ![vsm_pop2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/2/b/42b54006424642965aaf6ae900f0eff4a15cdfe4.jpeg)  
Here’s an example of how this is killing me as I create my environments. Simple doorway geometry. Shadows from the sun overhead. As you recede just a hundred feet away or so, the shadows start to break down, tear away from the overhang and then just disappear. Where’s my crisp, dark, fine shadows in the distance as shown in the epic VSM doc?  
 ![vsm_pop3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/9/f/09f2804c7d4c2420345e88aca711e8a6dea125de.jpeg)

I feel I’ve played with every setting I can to no avail. Does anyone else have this issue? Or know any ways to fine tune the LOD/draw distance system for the virtual shadow maps?

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [August 10, 2022, 3:34am UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/2 "2022-08-10T03:34:27Z")

</div>

Hey @Apgar426! So this question get’s asked a bunch, and I’ve got just the thread for you.

> [@Shadows disappear with increased camera distance](https://forums.unrealengine.com/t/shadows-disappear-with-increased-camera-distance/4690):
>
> 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 lower…

Take a look at the top post there, the poster actually compiles a ton of useful console commands as well as other scalability settings and documentation to do just this! Just be wary about the performance hits you could take if you have tons of geometry and everything is rendering shadows from large distances. Hope this helps!

---

<div class="post-metadata">

**Author:** ![Apgar426](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/apgar426/32/555912_2.png) [@Apgar426](https://forums.unrealengine.com/u/Apgar426)\
**Post date:** [August 10, 2022, 9:42pm UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/3 "2022-08-10T21:42:13Z")

</div>

Thank you for the link, but that thread is from 2014, well before the age of virtual shadow maps, which are default for UE5. Those commands have no effect now. I can find scant information on VSM issues and fixes. It’s as if it’s working perfectly for everyone else. Guess nobody needs a properly shadowed window sill. Back to contact shadows it is… 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [August 11, 2022, 1:31am UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/4 "2022-08-11T01:31:28Z")

</div>

Ahhh you’re right, there’s definitely new sets of commands now. I’ll have to take a look and see what I can find engine-side. I’ll add it to my research bucket, since you definitely won’t be the last to ask this and I know little about the new systems commands myself.

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [August 13, 2022, 12:32am UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/5 "2022-08-13T00:32:22Z")

</div>

Alright, so the reason every unreal image has those crisp fancy shadows is that all nanite meshes apparently don’t have their shadows culled naturally like normal meshes. So if you’d try it out for me, test the command `r.Shadow.Virtual.UseFarShadowCulling 0` it might adversely effect your performance if you have tons of normal meshes. This should allow for no culling when using the new VSM system on any mesh.

---

<div class="post-metadata">

**Author:** ![Apgar426](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/apgar426/32/555912_2.png) [@Apgar426](https://forums.unrealengine.com/u/Apgar426)\
**Post date:** [August 13, 2022, 5:20pm UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/6 "2022-08-13T17:20:39Z")

</div>

That is a good guess, thank you for investigating. Unfortunately, that command doesn’t seem to effect any shadows, on nanite or not. These _are_ nanite enabled meshes I’m now working with, they show up in the nanite visualization and everything. Stats show no culling going on. It seems like it might have to do with the clip map, since this is a directional light. here’s a pic. The shadows are starting to disappear even a few feet away, once you hit the green zone. Further back, once you hit orange, even the board overhead loses its shadow. The clip zones can be adjusted a little using some commands, but I can’t seem to get much improvement.

 ![vsm_pop4](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/8/9/489deeb935da3591d014463fb329e77ca3051d4c.jpeg)  
One thing I thought of is that I am not using ray traced shadows (No RTX card). In the documentation here [Hardware Ray Tracing in Unreal Engine | Unreal Engine 5.0 Documentation](https://docs.unrealengine.com/5.0/en-US/hardware-ray-tracing-in-unreal-engine/) if you scroll down to the “ray traced shadows” pic, you can see along the edges of the picture frame for example, the shadows starting to disappear in the non-rtx render. I would really love it if someone with an RTX card could do a little shadow test, like I’ve done, and verify whether shadow distance from small objects is improved significantly with “ray traced shadows” enabled in project settings.

---

<div class="post-metadata">

**Author:** ![Apgar426](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/apgar426/32/555912_2.png) [@Apgar426](https://forums.unrealengine.com/u/Apgar426)\
**Post date:** [August 31, 2022, 11:07pm UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/7 "2022-08-31T23:07:58Z")

</div>

Alright, I went ahead and did it myself. I realized I could run enable ray tracing on my GTX 1660 Super. I turned on ray traced shadows and all my shadow draw distance woes disappeared. Performance is still pretty good surprisingly.

---

<div class="post-metadata">

**Author:** ![Miguel1900](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/miguel1900/32/1010694_2.png) [@Miguel1900](https://forums.unrealengine.com/u/Miguel1900)\
**Post date:** [September 1, 2022, 7:38pm UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/8 "2022-09-01T19:38:58Z")

</div>

Even if that can be a solution (I also love RT shadows), RT is supposedly deprecated and it’s not thought to work well with Nanite so, anyway, a solution for “Lumen shadows” (VSM) should be found.

---

<div class="post-metadata">

**Author:** ![Apgar426](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/apgar426/32/555912_2.png) [@Apgar426](https://forums.unrealengine.com/u/Apgar426)\
**Post date:** [September 1, 2022, 8:35pm UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/9 "2022-09-01T20:35:19Z")

</div>

I think I actually figured it out just now. I was looking at all the console commands starting with “r.shadow.virtual” and I found some not listed in the doc - there’s one called r.Shadow.Virtual.contactShadowLength. Changing that from the default .02 to .01 or less actually fixed the draw distance issues I described originally!

---

<div class="post-metadata">

**Author:** ![Miguel1900](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/miguel1900/32/1010694_2.png) [@Miguel1900](https://forums.unrealengine.com/u/Miguel1900)\
**Post date:** [September 1, 2022, 8:51pm UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/10 "2022-09-01T20:51:23Z")

</div>

Wow, you’re right!

The command is r.Shadow.Virtual.ContactShadowLength but default value is 0.02. You can even reduce it to 0, to gain even a little more distance (still weaker than RT shadows, but quite near regarding distance visibility).

---

<div class="post-metadata">

**Author:** ![Apgar426](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/apgar426/32/555912_2.png) [@Apgar426](https://forums.unrealengine.com/u/Apgar426)\
**Post date:** [September 2, 2022, 12:12am UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/12 "2022-09-02T00:12:35Z")

</div>

Another thing related to the topic - anyone experiencing noise/graininess in VSM shadows (or RT shadows), make sure you turn on Temporal AA or Temporal Super-res AA in the project settings under anti-aliasing.

---

<div class="post-metadata">

**Author:** ![Flakky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/flakky/32/918696_2.png) [@Flakky](https://forums.unrealengine.com/u/Flakky)\
**Post date:** [May 27, 2023, 2:19pm UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/13 "2023-05-27T14:19:18Z")

</div>

Recently updated to 5.2 and found out, that render distance is less than in 5.0.

Commands mentioned in this thread does not help.

Does anybody know what might increase Virtual Shadow draw distance in UE5.2?

---

<div class="post-metadata">

**Author:** ![TheRealBiomes](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/therealbiomes/32/1017675_2.png) [@TheRealBiomes](https://forums.unrealengine.com/u/TheRealBiomes)\
**Post date:** [August 9, 2023, 6:02am UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/14 "2023-08-09T06:02:10Z")

</div>

This command seems to be no longer available in 5.2

---

<div class="post-metadata">

**Author:** ![MineLucky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/minelucky/32/88717_2.png) [@MineLucky](https://forums.unrealengine.com/u/MineLucky)\
**Post date:** [January 5, 2024, 8:30am UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/15 "2024-01-05T08:30:02Z")

</div>

5.3 can use r.Shadow.RadiusThreshold 0.01(deault:0.03)

---

<div class="post-metadata">

**Author:** ![feralmoans](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/feralmoans/32/974428_2.png) [@feralmoans](https://forums.unrealengine.com/u/feralmoans)\
**Post date:** [October 6, 2024, 6:52am UTC](https://forums.unrealengine.com/t/improving-virtual-shadow-map-distance-quality/625163/16 "2024-10-06T06:52:40Z")

</div>

This is amazing. Without this, the default Engine behavior was having shadows disappear from my levels much too soon, even on High settings.
