Switching Between Virtual Shadowmap and Shadowmap In-Game

I really like the high resolution look of the virtual shadowmap, however it cost much more than regular shadow map.
Is there a way to change between virtual shadow map and shadow map on the fly? Like with user settings or command lines, so player can switch in between them if I set up a button on the settings menu in my game.
Many thanks!

You can use the engine scalability settings

sg.ShadowQuality

You can get a searchable help file with all the console variables in

image

Using blueprint, you can run console commands from your menu

image

1 Like

Thanks for the note.
Yes scalability quality is what I’m using for the shadows.
However there doesn’t look like a on/off switch in between virtual shadow map and regular shadow map. I was thinking that for the low and medium setting to use the old shadow map, but for high and ultra settings use virtual shadow map.
Or the engine doesn’t allow you to switch shadow maps in real-time?

1 Like

I don’t know for sure, but I think it might switch itself.

It does for GI, for example.

Try changing r.Shadow.Virtual.Enable from 0 to 1 at runtime from a blueprint and report back if that works for you.

Optionally; while the scalability group method mentioned earlier is mainly for controlling individual quality settings properties in bulk, if you include r.Shadow.Virtual.Enable=0 in [ShadowQuality@0] and r.Shadow.Virtual.Enable=1 in [ShadowQuality@1] you would conceivably be toggling between shadow modes as you naturally change from Low to Medium settings.

1 Like

Wow, thanks so much for replying my old thread that’s been 6 months. In the mean time I’m still just using cascade shadow in my game since I haven’t found a good solution so far. I’ll definetely give it a try~

That doesn’t seems to work. I placed the following in DefaultScalability.ini:

[ShadowQuality@2]
r.Shadow.Virtual.Enable=0

[ShadowQuality@3]
r.Shadow.Virtual.Enable=1

Changing Shadows quality from Ultra to High does not disable VSM as expected. Am I missing something?

Calling Execute Console Command with those commands right after setting scalability settings does work, though.

afaik the default file only manages what scalability the engine starts with. if you make changes at runtime you gotta execute commands and perhaps safe the user settings/options for the next start.