VSM with Nanite Foliage (WPO)

  • Nanite trees are fantastic
  • Trees with World Position Offset (WPO) are fantastic
  • Virtual Shadow Mapping (VSM) is fantastic

But since WPO invalidates the shadow cache, performance tanks.

Trying this command (as per the documentation) doesn’t have any effect:

r.Shadow.Virtual.Cache.MaxMaterialPositionInvalidationRange 500

The idea is of course not to invalidate the cache when far from the camera to get back some of the performance.

Why is this not working? Is it a broken feature? Any workarounds?

3 Likes

if I remember correctly this documentation is not updated and they already enabled by default to the Virtual Shadow map,

I did manage to enable VSM… My issue is that I need to get WPO to stop having an impact on the cached maps, but that doesn’t seem to work

it should be automatic…
did you try to disable WPO to see if you can see performance difference?

Yes, disabling WPO has an enormous performance impact (going from 20ms to 2ms for Shadow Depths in my case).

1 Like

how complex is your Material?

The foliage material is not very complex, rather typical foliage (trees from the CityPark package, in fact).

It’s clear that the cache is still being invalidated: You can see the shadow moving from a great distance - so I don’t really think material complexity has much to do with it.

The impact is so large because the trees have a lot of geometry and there are a lot of shadow calculations that have to be updated every frame.

Any solution/news on this topic? I see that VSM in combination with Nanite Foliage using WPO in 5.2 is still an issue and the VSM shadows are still very expensive.

From what I saw the console command r.Shadow.Virtual.Cache.MaxMaterialPositionInvalidationRange still doesn’t work in 5.2 preview.

1 Like

Haven’t tried it myself, but noticed this video from someone that made it work:

Hope it helps.

1 Like

what about for people not using PCG

Hi,

You can change the WPO disable distancing in Foliage Actors too, it’s in the properties of the mesh when you select it in Foliage Edit mode (1.).

5.3 also introduces another option - Shadow Invalidation type (2.) - you can set this to static, it still uses WPO on your foliage, but doesn’t update the shadow - this is very efficient when combined with a WPO disable distance.

You can also access the WPO disable distance from blueprints, changing straight onto a InstancedStaticMesh Component or HISM Component - affecting all instances in that component.

2 Likes

unfortunately my WPO is all utility wires swaying in the wind and airconditioning fans spinning… its not foliage.

You can change the ISMC/HISMC directly in your blueprint if you’ve got those components there:


image

Alternatively, I’ve got a couple of plugins on the marketplace, they’re called rdBPtools (Instance and Prefab editor) and rdInst (a singleton Instance manager, written in c++ for speed).

I’ve exposed all the instance settings such as WPO distance and shadow invalidation in there to make it easy to set things like that.

1 Like

Thx… for spline mesh i had to add a node in the construction script to set world position offset disable…

and for static meshes alone i find those options!

Hi, those options are in UPrimitiveComponent which all of the mesh types of components subclass from - they are in the SplineMeshComponent as well.

1 Like

Yes i edited my last comment i found them. Thanks.

1 Like