For anyone watching this video in the UE5.3+ era, there was a new parameter added to foliage called "VSM Cache Invalidation Behavior", where you can make it so specific foliage doesn't update the VSM at all whether it's moving or not. This will allow you to have things like trees in the distance blowing in the wind without having a perf hit of the VSM cache invalidation. This setting is also available on static meshes as well, so if you have other things that you aren't too worried about invalidating the shadow map you can use it on those as well.
It's not just the virtual shadowmaps. WPO introduces also significant overhead for nanite meshes. That's why nanite diagnostic view has also WPO mask channel displayed, as WPO comes with significant cost on nanite meshes. So distance culling the WPO animation gives performance boost which comes both from VSMs as well as Nanite having easier work. It's combination of both.
The world position disable distance was already there on the other foliage types and the runtime grass nodes. You can also make a shader function to blend off the WPO as well to stop a sudden pop.
@@jhett1746 hey your right you still want the hard cut off set on the foliage (wpo max distance). Say the hard cut off is 5000 you start you fade around 3500 and finish before 5000
Another thing that often goes ignored for foliage performance in UE5 is that the per-pixel cost of masked materials with Nanite meshes is actually really large. It's often better to have a higher triangle count for the meshes cutting out around where the alpha mask is and then use an opaque material instead. This is what Epic did for the foliage in Fortnite when they upgraded to UE5.
another thing that could work (not sure if it is possible right now) is to turn off dynamic shadow generation at certain distance from camera, because no one would notice if the shadows on grass leaves aren't geometrically correct 30m away from them, heck, even 5 meters, that would basically eliminate all the extra load having to recalculate that stuff, probably would work for larger things like trees, maybe a bit further away than grass
This is exactly what I want to try, have you found anything on it? I'm gonna try disabling all dynamic shadows for grass etc. which is entirely covered by other shadows since it seems unnecessary. Not sure if ue5 takes anything like that into consideration but I assume everything gets calculated by default (VR so I need every frame I can get)
From the Unreal documentation for Virtual Shadow Maps: In some cases, creating Material LODs that remove WPO/PDO may be impractical, but the end effect of these transformations is small in the distance. Use r.Shadow.Virtual.Cache.MaxMaterialPositionInvalidationRange to set a distance (in centimeters) beyond which cache invalidations from these materials are ignored. I'm not sure if this will work with Nanite meshes, as there's some stuff about Nanite always rendering into VSM regardless of distance.
if the world position offset disable also had a 'falloff' parameter there could be a blend between non moving and moving foliage, stopping the 'jump' at the threshold
Awesome! I've been trying to optimize some foliage and narrowed it down to world position offset, affecting FPS. I started to check the distance from the camera in the material itself but thought there might be a better way. Glad I found this video! This has made a drastic change in many of them.
@@unrealitybites763 yes it works! Landscape is green in the view mode now and the wind is only on foliage close to camera. I'm not getting this kinda of performance boost however, like in the video.
World position offset distance definitely improved performance for me, thank you. I wish there was a way to reduce VSM quality over distance, as its absolutely the shadows that are costing me a lot of frames. Possibly some global VSM shadow quality setting would help but I can't find anything in 5.2.1
Oooh, So that's why Nanite Foliage was so performance heavy....I never considered that the Shadow Maps would be constantly recalculated. Nice video man, thanks for sharing this info.
@@user-se2gm6bu5r Oh, that too...yeah I forgot about Overdraw and since most foliage has overlapping geometry I could see how it might drag down performance. However, shortly after 5.0's official release I got a Solid Geometry Foliage pack designed for Nanite before it actually supported Game-Ready Foliage and the performance was pretty bad. That was also before there was any way to preserve them from having the leaves striped from a distance.
It's tremendous, especially seeing the tests you do in the other videos, the only thing I see here is that it's a preview, we can't go over to it yet T.T
Another good way to limit the WPO distance is to use the "CameraDepthFade" node in the material to lerp your WPO value between your wind effects and "0". Not sure what the performance difference would be between the two though, would be a good experiment.
While creating landscapes, I sometimes look at the developers and they always show realistic mountains from a single scene. The foothills of the mountain, the body, the upper layers are always the same, I wonder what is needed to create scenes that are at least a little more realistic.
Hey, i have a different problem sir. My grass assets dose not work work with pcg as expected. When nanite is enabled my grasses move blury and glitchy. When i disable the nanite they work fine. This issue is same with megascan's trees unless you use pivot painter ones. As i see in your video your grasses work perfect do you have any idea regarding this problem.
@@gulagwarlord Hes saying it didnt affect Virtual Shadow Maps which he is correct it didnt. It would still make them dynamic around the foliage instead of whatever the green was in the debug view.
Even if I bring the WPO down to 1 the trees and grass and such still move. Is this bugged? Or might there be another place I have to disable WPO? I would like the 'distance from camera' that the PCG setting enables.
Nice little parameter that! :) Seems a no brainer to expose that to foliage paint / PFV or just regular material graphs.. but time will tell. 1uu = 1cm btw, which I'm sure you knew already.
Any good tips on creating animated foliage. All my meshes are static and i would love a procedural fix to create some movement. Guessing i will need to go to mesh level in my 3d package and set it up??
I can't get WPO to work with the Quixel European Beech trees with WPO turned on. They get all blurry and streaky unless I put the WPO culling distance to 0. Any ideas? Thanks.
Is it possible to make area movement on the grass? For example on vast plains when the wind blows it makes some kind of waves that move across the whole plain. Like a crowd that stands in a wave on a stadium. SO that a grass movement will have an overall feel of movement along the plain. Maybe making an invisible area that will affect the grass movement that will move across the plain?
Really good stuff! I wonder if there is also a way to just stop regenerating shadow maps 10 or 20 meters away from Player. That will look fine, and save processing power
That's kind of what's happening by disabling the WPO animation over a certain distance. It only has to calculate the distant shadow map once for the distant meshes and then that is cached from frame to frame.
Can't you just use distance to camera with a lerp? You get a smooth transition between static and moving assets, good performance and if you place the asset by hand it is using the same parameters as the ones placed with PCG.
Use Camera Distance and IF's or better yet Per LOD Material Instances to disable WPO and other complex calculations, like shadows (use Cascade for close and distance fields for medium to far for larger objects) and unneeded texture lookup's for far away grass and tree's etc. Also in regards to Virtual Shadow Maps EPIC has a HUGE document around optimization / suggestions etc
Yeah... no... doesnt work doing it only in the shader, as they are non branching, there no perf benefit. Yeah different material for lods with WPO disabled can work... But your using nanite, so there are no lods.
I wonder if it is possible to make the movement of the grass dependent on the movement of the character - turning off the movement of foliage when the character moves.
Hello there, thanks for your great tutorials - When I apply nanite to trees from previews packs - Such as Rural Australia pack and Meadow Packs trees - and I paint with the foliage tool or add as procedural foliage - the trees are broken / blurry - When they blow in the wind? Do you know how to fix this please?
Make sure your project settings are using Direct X 12. I rolled back to DX 11 and all my nanite broke. Going back to DX 12 fixed it. Could be your issue.
PCG vs Procedural foliage from editorpreferences , who is best in performance , who can spawn on particular layers of landscape , height and slope aligntment , etc
Probably similar performance, they both utilize the same instancing systems. PCG can indeed filter based on slope, landscape layers etc. The real point of PCG is you can expand the system with blueprints relatively easily. Depends on your goals/scene on if the procedural foliage tool or PCG will be the right choice.
Hi Gulag. I see the WPO Disable parameter in the Foliage Type asset as you describe, but it doesn't seem to actually have any affect on the painted foliage. Have you got this to work?
@@unrealitybites763 I checked, it works as expected. I just uploaded a quick video showing it in action. It's my most recent upload th-cam.com/video/uijIG8K0vPI/w-d-xo.html. Make sure you set the distance to something low but not zero. You probably know this but 0 disables the feature entirely. In my example, I'm switching between 10 and 1000. Cheers.
@@gulagwarlord Hello guys, I'm testing the wpo Disable parameter but I get it to work just in editor. If I then launch the game I can still see the WPO being active . Is it the same for you? Thank you
For anyone watching this video in the UE5.3+ era, there was a new parameter added to foliage called "VSM Cache Invalidation Behavior", where you can make it so specific foliage doesn't update the VSM at all whether it's moving or not. This will allow you to have things like trees in the distance blowing in the wind without having a perf hit of the VSM cache invalidation. This setting is also available on static meshes as well, so if you have other things that you aren't too worried about invalidating the shadow map you can use it on those as well.
That is great info, must test that out when I get the chance.
It's not just the virtual shadowmaps. WPO introduces also significant overhead for nanite meshes. That's why nanite diagnostic view has also WPO mask channel displayed, as WPO comes with significant cost on nanite meshes. So distance culling the WPO animation gives performance boost which comes both from VSMs as well as Nanite having easier work. It's combination of both.
The world position disable distance was already there on the other foliage types and the runtime grass nodes. You can also make a shader function to blend off the WPO as well to stop a sudden pop.
It didnt actually work before now.
Hello, do you know how to make it ?
@@tgykurtulus you basically do a lerp to set WPO to 0 based on view depth with the max depth being just before the hard cut off.
@@joegaffney8006 lerps aren't branching. you are still paying the cost of it
@@jhett1746 hey your right you still want the hard cut off set on the foliage (wpo max distance).
Say the hard cut off is 5000 you start you fade around 3500 and finish before 5000
Another thing that often goes ignored for foliage performance in UE5 is that the per-pixel cost of masked materials with Nanite meshes is actually really large. It's often better to have a higher triangle count for the meshes cutting out around where the alpha mask is and then use an opaque material instead. This is what Epic did for the foliage in Fortnite when they upgraded to UE5.
this video has great audio. loud, clear and not unpleasant to listen to. good work!
another thing that could work (not sure if it is possible right now) is to turn off dynamic shadow generation at certain distance from camera, because no one would notice if the shadows on grass leaves aren't geometrically correct 30m away from them, heck, even 5 meters, that would basically eliminate all the extra load having to recalculate that stuff, probably would work for larger things like trees, maybe a bit further away than grass
This is exactly what I want to try, have you found anything on it? I'm gonna try disabling all dynamic shadows for grass etc. which is entirely covered by other shadows since it seems unnecessary. Not sure if ue5 takes anything like that into consideration but I assume everything gets calculated by default (VR so I need every frame I can get)
@@VictorTheSweGuy any solutions yet?
From the Unreal documentation for Virtual Shadow Maps:
In some cases, creating Material LODs that remove WPO/PDO may be impractical, but the end effect of these transformations is small in the distance. Use r.Shadow.Virtual.Cache.MaxMaterialPositionInvalidationRange to set a distance (in centimeters) beyond which cache invalidations from these materials are ignored.
I'm not sure if this will work with Nanite meshes, as there's some stuff about Nanite always rendering into VSM regardless of distance.
if the world position offset disable also had a 'falloff' parameter there could be a blend between non moving and moving foliage, stopping the 'jump' at the threshold
In 5.3 there is a PCG option to disable shadow map updates from world offset position. Should be enough for most cases.
Awesome! I've been trying to optimize some foliage and narrowed it down to world position offset, affecting FPS. I started to check the distance from the camera in the material itself but thought there might be a better way. Glad I found this video! This has made a drastic change in many of them.
This is Gold! I wish they had this function on the foliage painting tool too
Oh, the function is there! happy days!
Erik, I can also see the parameter in the Foliage Type asset, but it doesn't seem to affect my painted foliage. Does it work for you?
@@unrealitybites763 yes it works! Landscape is green in the view mode now and the wind is only on foliage close to camera. I'm not getting this kinda of performance boost however, like in the video.
You absolutely kick butt, Dude! Thanks so much for sharing.
World position offset distance definitely improved performance for me, thank you. I wish there was a way to reduce VSM quality over distance, as its absolutely the shadows that are costing me a lot of frames. Possibly some global VSM shadow quality setting would help but I can't find anything in 5.2.1
Thank you so much for that important information and show us this new feature.
WONDERFUL INSIGHT AND EXPLANATION! 👏 👌 😊
I'm taking this to the team!
Thank you. This is indeed a very nice feature to have.
You really know your stuff. Thanks a ton!👍
TBH, I came across this parameter by accident, I was just lucky to realise its potential ;-)
World Position Disable Distance is in HISM and Foliage and Static Mesh Details in UE 5.1.1 (Only Works for Nanite).
Oooh, So that's why Nanite Foliage was so performance heavy....I never considered that the Shadow Maps would be constantly recalculated. Nice video man, thanks for sharing this info.
No, Nanite Foliage is heavy no because of that. It's heavy because of overdraw which is caused by many geometry layers.
@@user-se2gm6bu5r Oh, that too...yeah I forgot about Overdraw and since most foliage has overlapping geometry I could see how it might drag down performance. However, shortly after 5.0's official release I got a Solid Geometry Foliage pack designed for Nanite before it actually supported Game-Ready Foliage and the performance was pretty bad. That was also before there was any way to preserve them from having the leaves striped from a distance.
Tx man, life saver!
It's tremendous, especially seeing the tests you do in the other videos, the only thing I see here is that it's a preview, we can't go over to it yet T.T
Yes, you're right , it is experimental but it has so much promise
just what I need, thank you.
This is because, the foliage is casting dynamic shadows, you can play with it aswell to get the desired work. great tutorial though :)
Another good way to limit the WPO distance is to use the "CameraDepthFade" node in the material to lerp your WPO value between your wind effects and "0". Not sure what the performance difference would be between the two though, would be a good experiment.
This is Marvelous!
While creating landscapes, I sometimes look at the developers and they always show realistic mountains from a single scene. The foothills of the mountain, the body, the upper layers are always the same, I wonder what is needed to create scenes that are at least a little more realistic.
ohh my god, this video is a blessing!!!!
Thanks for sharing man
Hey, i have a different problem sir. My grass assets dose not work work with pcg as expected. When nanite is enabled my grasses move blury and glitchy. When i disable the nanite they work fine. This issue is same with megascan's trees unless you use pivot painter ones. As i see in your video your grasses work perfect do you have any idea regarding this problem.
That’s Rye, you can grind it at a grinder in any guarded town if you have milling skills and agrostology lores maxed out
This option does exist on the other foliage assets since 5.1 but in 5.1 it did not affect VSM.
Yes it does, check the foliage editor... it was in 5.1
@@gulagwarlord Hes saying it didnt affect Virtual Shadow Maps which he is correct it didnt. It would still make them dynamic around the foliage instead of whatever the green was in the debug view.
Controlling from material and controlling from PCG with WPO disable distance. Is there a difference in performance between the two methods?
Even if I bring the WPO down to 1 the trees and grass and such still move. Is this bugged? Or might there be another place I have to disable WPO? I would like the 'distance from camera' that the PCG setting enables.
me to , we need help
Nice little parameter that! :) Seems a no brainer to expose that to foliage paint / PFV or just regular material graphs.. but time will tell. 1uu = 1cm btw, which I'm sure you knew already.
It is already there in the Foliage menu.
Awesome!
Awsome!
Any good tips on creating animated foliage. All my meshes are static and i would love a procedural fix to create some movement. Guessing i will need to go to mesh level in my 3d package and set it up??
I can't get WPO to work with the Quixel European Beech trees with WPO turned on. They get all blurry and streaky unless I put the WPO culling distance to 0. Any ideas? Thanks.
Is it possible to make area movement on the grass? For example on vast plains when the wind blows it makes some kind of waves that move across the whole plain. Like a crowd that stands in a wave on a stadium. SO that a grass movement will have an overall feel of movement along the plain. Maybe making an invisible area that will affect the grass movement that will move across the plain?
Really good stuff! I wonder if there is also a way to just stop regenerating shadow maps 10 or 20 meters away from Player. That will look fine, and save processing power
That's kind of what's happening by disabling the WPO animation over a certain distance. It only has to calculate the distant shadow map once for the distant meshes and then that is cached from frame to frame.
Can't you just use distance to camera with a lerp? You get a smooth transition between static and moving assets, good performance and if you place the asset by hand it is using the same parameters as the ones placed with PCG.
Use Camera Distance and IF's or better yet Per LOD Material Instances to disable WPO and other complex calculations, like shadows (use Cascade for close and distance fields for medium to far for larger objects) and unneeded texture lookup's for far away grass and tree's etc. Also in regards to Virtual Shadow Maps EPIC has a HUGE document around optimization / suggestions etc
When WPO is not a constant zero, it will count as moving object, so only static switch (lod)
Yeah... no... doesnt work doing it only in the shader, as they are non branching, there no perf benefit.
Yeah different material for lods with WPO disabled can work...
But your using nanite, so there are no lods.
@@MrSofazocker Yes, it works exactly as i said - you still can use Material LODs with Nanite.
I wonder if it is possible to make the movement of the grass dependent on the movement of the character - turning off the movement of foliage when the character moves.
Some meshes like trees , fern tend not to work when spawning with pcg graph. Have you encounted this and found a solution?
fantastic….
Hello there, thanks for your great tutorials - When I apply nanite to trees from previews packs - Such as Rural Australia pack and Meadow Packs trees - and I paint with the foliage tool or add as procedural foliage - the trees are broken / blurry - When they blow in the wind? Do you know how to fix this please?
Make sure your project settings are using Direct X 12. I rolled back to DX 11 and all my nanite broke. Going back to DX 12 fixed it. Could be your issue.
PCG vs Procedural foliage from editorpreferences , who is best in performance , who can spawn on particular layers of landscape , height and slope aligntment , etc
Probably similar performance, they both utilize the same instancing systems. PCG can indeed filter based on slope, landscape layers etc.
The real point of PCG is you can expand the system with blueprints relatively easily.
Depends on your goals/scene on if the procedural foliage tool or PCG will be the right choice.
how it will work ? .does it uses two materials ,or a single material instance with wpo off on off bool ?
This feature has nothing to do with PCG. Its also available on static meshes or regular foliage.
How are you getting blueprint up for the grass?
Why is that a secret? It's right there in the settings and obvious what it's there for.
that wpo culling distance can't be set in any other part on the engine for real?
Been in the foliage editor since 5.1
Hi Gulag. I see the WPO Disable parameter in the Foliage Type asset as you describe, but it doesn't seem to actually have any affect on the painted foliage. Have you got this to work?
@@unrealitybites763 Yes, on my end it seems to work... I'll pop open my 5.1 project again and confirm though.
@@unrealitybites763 I checked, it works as expected. I just uploaded a quick video showing it in action. It's my most recent upload th-cam.com/video/uijIG8K0vPI/w-d-xo.html. Make sure you set the distance to something low but not zero. You probably know this but 0 disables the feature entirely. In my example, I'm switching between 10 and 1000. Cheers.
@@gulagwarlord Hello guys, I'm testing the wpo Disable parameter but I get it to work just in editor. If I then launch the game I can still see the WPO being active .
Is it the same for you?
Thank you
Is this only in Version 5.2 or is it the Same in Version 5.1?
A 1-minute video is stretched to 10 minutes
You'll hate my one-hour videos then
Love your videos but your microphone quality is really bad
Really? How so? Sounds ok to me...