BOOST Foliage Performance In Unreal Engine
When foliage causes massive drops in your frames per second this is the fix.
🔥BECOME A PATRON - for exclusive content and credit on new videos
🔗bit.ly/3pcBuBn
---------------------------------------------------------------
😁 Subscribe to Joshua M Kerr
🔗bit.ly/3l4U9wo
---------------------------------------------------------------
🎦 JOIN THE NEXT GEN FILMMAKERS DISCORD
🔗bit.ly/3kUzqvj
---------------------------------------------------------------
👀WHAT TO WATCH NEXT..
📺 An Unreal Engine Short Film In Three Days
bit.ly/3DwvPtI
📺 The Smallest Virtual Production Studio
bit.ly/3WW3KCY
📺 Virtual Production Playlist
bit.ly/3HnUeDe
---------------------------------------------------------------
Пікірлер: 199
There is actually a parameter in the foliage type for that. It's called "World Position Offset Distance". You can set a distance value there and any instance actor beyond that distance will have WPO disabled for performance. Landscape Grass Type also has it.
@JoshuaMKerr
Жыл бұрын
This won't give you the same increase as disabling within the material unfortunately. Trust me, I've been over those settings.
@rabellogp
Жыл бұрын
@@JoshuaMKerr that's interesting... Good to know, thanks!
@TGADB
Жыл бұрын
@@JoshuaMKerr use a distance blend between 0 wpo to wpo complex which mega scan uses. Speed tree also have this issue, so basically, wpo from these are very complex. Ideally we want to have branch wpo for mid range , and no wpo to long range. This problem occurs if you just drag and drop without knowing what those asset comes with , this is very basic mistake as for some reason people think , just drag and drop gonna work, but it won't unless one use their own brain
@xxerbexx
Жыл бұрын
@@JoshuaMKerr well, lets be honest this is a extremly poorly optimized tree. what u want to do is creat ur own proper trees from scratch and have them be optimized. also the mat is way to insain.
@isays
Жыл бұрын
@@JoshuaMKerr whats the delta between the increases? are we talking about editing the material gaining an extra couple frames? or are we talking double digit percent?
There is a setting in the foliage which removes WPO at a certain distance, it's called "World Position Offset Disable Distance"
@JoshuaMKerr
Жыл бұрын
Yes there is. It definitely should do the job but I may have something funky going on with my project. Might try with a clean project next time.
@unrealdevop
Жыл бұрын
I was just going to suggest some kind of distance based WPO but I didn't know there was an actual function for this.
@JoshuaMKerr
Жыл бұрын
@@unrealdevop It exists. Just not sure about the gains. Will do more testing
@res0lve
Жыл бұрын
@@JoshuaMKerr I'd like to see the difference between this video and the WPO distance, do a comparison video maybe :D
@JoshuaMKerr
Жыл бұрын
Think I may have to
Trees with nanite are best fully modeled, white space is a killer on any mesh in masked on large scale. You can distance blend the opacity from 0-1 to decrease the cost on masked at further ranges, thereby making the trees fully opaque in the far field. Also unchecking collision and ray tracing in the material. That with using the wpo distance variable and simplifying shaders nets great results at ~60fps
@Fafhrd42
5 ай бұрын
The masked materials, especially with nanite, are definitely a killer, and it's really annoying that the megascans trees haven't been updated to have fully cut out leaves and opaque materials for usage with nanite because it's tedious as hell to do it manually. Though WPO cost also goes up with vertex count, so it can be a complicated tradeoff.
You also can turn on mask calculation only in Depth Buffer (Project Settings - Mask Material Only in Early Z Pass). It works much faster on high masked overdrawed scenes (forest for example )
I was pretty shocked at how expensive WPO was, considering how nearly every asset creator turns it on for trees, foliage, and grass. But very few of them will make LODs that disable WPO with distance.
I think you could make the workflow more scalable by switching the material based on LODs in just one mesh asset. If you switch to a different LOD in the mesh viewer or click the "Custom" tickbox in the LOD Picker section you can specify different materials for different LODs. I hope that helps!
@JoshuaMKerr
Жыл бұрын
That is interesting and I've definitely never tried it. Thanks for the suggestion.
@lethaldumpster2699
Жыл бұрын
@@JoshuaMKerr Yes I use this method too, its incredibly effective. But stops being so effective if using Nanite. But then again, I'm not a fan of nanite to begin with due to its limited performance on very old hardware.
@JoshuaMKerr
Жыл бұрын
Ah this might be tricky then, I use nanite a lot unless I plan on pathtracing.
Very insightful ! Thank you !
Invaluable tip for performance!
Thank you very much for sharing this. I wonder if you could also lower the lightmap resolution for even better performance. I do that in darker scenes. Great stuff! 😊
@JoshuaMKerr
Жыл бұрын
I can certainly try that too.
@benblaumentalism6245
Жыл бұрын
It’ll make a smaller difference, but a difference nonetheless. I love your content, by the way. Bravo!
Huge thanks, this helped me with my final project!
@JoshuaMKerr
6 ай бұрын
You're welcome!
What if we were to instead set up 2 camera volumes in place of the single one and adjust the clipping planes so we have a 'close' frustum and 'far' frustum, and only use the WPO-enabled material when drawing the 'close' volume? You'd have to do some deep magic to make the shadows and nanite occlusion culling work, but my intuition says that it could improve performance
For a non destructive workflow, one thing you can do is using a static switch operator in you master material that enable or disable the wind accordingly your material instance. I think it may work instead of creating two master materials, then you just duplicate the instances
@JoshuaMKerr
Жыл бұрын
Could work and definitely worth a shot. But (unless you've tried it) I am finding that these sorts of workarounds may not actually give the same performance back.
@marceloaanascimento
Жыл бұрын
@@JoshuaMKerr Sadly I have not tried yet so I don't know how it will affect performance. Someone commented here that the materials will be compiled in the same way, I don't now how it works in this case but at least it still could be useful on a more flexible approach. Anyways, I am following the comments because the tips are being pretty useful!
@normaalewoon6740
11 ай бұрын
@@JoshuaMKerr I use static switch parameters all the time and it never gives performance issues. It will just be compiled again. That said, unreal can be a bitch when it comes to performance. Not just ue5 with (or without) its new fancy features, but compiling a material or changing a parameter can negatively affect the performance for a few minutes. Heavy raymarching can even trigger stuttery fps drops after some time in full screen mode. I almost hope something is wrong with my pc
I've only recently started playing around with landscapes in UE and naturally downloaded the same mega scans tree. I just thought my old machine was just becoming a toaster. I never accorded to me that the WPO was what was tanking my FPS. It always seems to happen when my RHIT goes through the roof. At least now I know what causes it so thank you. :)
@JoshuaMKerr
10 ай бұрын
No worries.
I am working on an open world bushcraft survival game with hundreds of thousands of trees and have been using the "camera depth fade" node to lerp between my world position offset wind effects and "0". This works well but am just discovering the world position offset distance bool in the foliage type properties and wonder if that would be better in terms of performance.
@JoshuaMKerr
Жыл бұрын
world position offset distance deffinitely does something but even on a blank project I get better results just turning it off in material. Haven't tried a lerp though, good idea.
i love your lessons!
It shows very quickly the increase in frames, thank you very much
I just use camera depth fade and lerp between the Wind MF output and 0 (plug the depth fade into the alpha.)
The best way is to use a plugin which has 2 trees for each "tree". one is moving with no shadow. and the other is not moving, but invisible, while rendering just the shadow.
@JoshuaMKerr
10 ай бұрын
Hi mate. Yeah I've heard of it. Super useful
@syedhs
9 ай бұрын
What is the plugin name?
@dr_j0nes
9 ай бұрын
@@syedhsUE5.3 has this feature now built in
@joelbartor
9 ай бұрын
He says that but don’t say the name of the plug-in , Jesus 🤦🏻♂️
@JoshuaMKerr
9 ай бұрын
You need to search for Foliage Shadow Imposters. There's a github page for it.
SOOOO HELPFUL
I just recently found out that Unreal Engine got a "World Position Offset Disable Distance" for foliage types now. :) So no need for multiple materials any more.
@JoshuaMKerr
11 ай бұрын
Is that not just part of the procedural content generation feature set?
Hi Joshua, loving the vids. You've got me wondering if there's a more flexible way to do this say by parenting a post process volume to the camera. Everything outside the volume has the offset off and everything inside has it on. That way, simply moving the camera around adjusts the offset on or off depending on it's proximity to the camera. Same effect but allows multiple shots to be set up without repainitng the foliage. I have no idea if this is possible by the way!
@wobbledaggerfilms
Жыл бұрын
Or perhaps a custom bluepint?
@wobbledaggerfilms
Жыл бұрын
"Utilize the Camera Position material node as an anchor for your masks. For example, if you pair it with the Absolute World Position, Camera Direction Vector, and the Sphere Mask nodes, you can mask out a consistent location based on the forward vector of the camera in world-space. This masking method is helpful for adjusting the World Position Offset of foliage, fading out walls when the character is behind them, etc." Maybe this?
@JoshuaMKerr
Жыл бұрын
I like the idea. Although I'm certain that the performance boost only occurs when it is disabled in the master material rather than by material attribute. So you would need to do the material switch via blueprint if that's possible. I'm not very good at blueprint though haha
@JoshuaMKerr
Жыл бұрын
Maybe you could give it a go and let me know
@Weckmuller
Жыл бұрын
@@JoshuaMKerr It's definitely possible to change material during runtime using blueprints. You just have to create a node called dynamic material instance, and then you can switch between material instances by programming the blueprint the way you want to. I did it a few times when the client wanted some materializing effects for the scenario to show up from the infinite black background as a surprise, but the materialize effect was very heavy on performance. So one way I found to help me save some fps after the materialize effect was done, was to programmatically change the material instance to an identical, more simple material without the materialize effect hooked to it. I worked perfectly! Saving up fps and optimizing performance is the coolest thing ever!
As people say there’s WPO offset distance + set the shadow map update to static at the instance group level (keep shadow with performance)
@JoshuaMKerr
7 ай бұрын
For some reason, this method hadn't worked for me in my last project, but then started working again in my next one. Go figure
@petebaker5369
Ай бұрын
How do I do the second part, where are the settings?
interesting solution! but isn't there a more dynamic solution? for example making trees use the windy material near camera and no wind when away from camera instead of manually placing them?
@JoshuaMKerr
Жыл бұрын
As far as I'm aware there is a more dynamic solution in 5.2 which uses the new procedural tools. But in 5.1 I've had a lot of trouble getting anything like that working.
Original solution. And it definitely works, thank you!
@JoshuaMKerr
Ай бұрын
You're welcome!
great video!
@JoshuaMKerr
Жыл бұрын
Thanks
There is also 1 very cool option - turn on RTX shadows in the direction light - it increases performance for me in almost each scene by at least at 50% buuuut it causes so many visual bugs and problems, so I would suggest using it only for dark scenes or where you won't see that problems)
@JoshuaMKerr
Жыл бұрын
Fair enough. Thanks for the tip
I wonder why UE5 doesn't take some sort of nanite approach to material properties. If a tree moves in a forest, but nobody is close enough to see it, is it really worth moving?
@JoshuaMKerr
Жыл бұрын
Haha I love that. But yes I can see that being useful. I'm sure it's on their radar because the wpo performance kinda defeats the point of the gains you make with nanite.
or with the camera distnace use could've use lerp to disable the animation when in certain distances, and if the camera gets near then the WPO will play.
Wouldnt it be easier to just turn off wind when you paint the bulk? And then turn it back on when you paint the other? Or would it switch it for all of them?
Perhaps this is caused in combinaation with virtual shadow maps requiring a recalculation with movement
@JoshuaMKerr
10 ай бұрын
Yes that would make sense.
you are a god, a legend sir
OMG Thanks bro !
@JoshuaMKerr
10 ай бұрын
Any time!
why dont you use a switch node in the base master material to toggle between the original wind and the WPO?
just use wpo evaluation distance and some kind of distance fade wpo function to hide the disable WPO moment
4:45 would be simpler to have a material custom pin for those assets that only move on the actor with a tag. smart material.
Amazing Tutorial! Thanks!!!
@JoshuaMKerr
Жыл бұрын
No worries!
I am surprised Unreal Engine is animating (wind) trees invisible to the viewer's viewframe.
@JoshuaMKerr
Жыл бұрын
For sure.
@isays
Жыл бұрын
perhaps in case the trees cast a shadow that _is_ in the viewframe, or would significantly affect global illumination. I'm not sure what would be a good way to handle that scenario, but then again I'm not a game engine dev.
hey, thanks for this tutorial, but you use the editor.... what about the build? is there much difference in FPS/performance on the build too?
@JoshuaMKerr
Жыл бұрын
Sorry, I've no idea. I use Unreal for virtual production filmmaking. I don't make games.
@2BRE-
Жыл бұрын
@@JoshuaMKerr i will check and let you know
@JoshuaMKerr
Жыл бұрын
@2BRE- Thanks man
Genius!
@JoshuaMKerr
Жыл бұрын
Thanks
What I found on the Unreal Learning website. I don't know if this is still the case. Currently, there are some limitations to Nanite. Some of these limitations may change with future updates. Here are some of the limitations: Materials for Nanite can’t have: Two sided materials Non-Opaque blend modes World Position Offset Pixel Depth Offset
@JoshuaMKerr
9 ай бұрын
I think much of this has changed since I made this video
You are my hero. Just Now
I am working on 1 scene with alembic cache character build with the grass on the landscape, The problem is while rendering the shot its consuming too much of time around 2, 2:30 hours Can you help me with this. Is there any setting in material or in grass attribute which can help to reduce the render time? Thanks. :)
@JoshuaMKerr
Жыл бұрын
Thanks fo rthe comment, without looking at your scene/project settings it's really hard to tell. Perhaps you could join my discord and post in the support forum. At least that way you can post pictures of the problem.
Hi Joshua! Did you try path tracer with megascans trees in 5.1? There's no way to make the wind blow in pathtracer...tried everything. Do you know if in 5.2 its fixed? Thanks
@JoshuaMKerr
Жыл бұрын
I haven't looked but may have to.
@martiespunya3254
Жыл бұрын
@@JoshuaMKerr thanks for your reply. I find that wind doesnt work with nanite and pathtracer so have to deactivate nanite inside tree mesh to make it work. Cheers
@JoshuaMKerr
Жыл бұрын
Aha. Good to know
Thanks a lot for your tips ! Can we activate and disactivate the leaf movement of each tree when a player cross the forest ?
@JoshuaMKerr
8 ай бұрын
I'm sure it's possible, but my channel is filmmaking and virtual production focused, so I'm probably not the best person to ask.
@vincent_souchiere
8 ай бұрын
@@JoshuaMKerr ok thanks for your reply Joshua ! And congrats for your work !
@JoshuaMKerr
8 ай бұрын
Thanks!
This is really strange. I haven't started using UE5 yet, but WPO shouldn't be affecting performance at all. That's the whole point of it. You get really low cost animation because you're simply moving the position of the verts. I wonder if it's something else that's actually tanking the performance.
@JoshuaMKerr
10 ай бұрын
I'm sure it's some strange mix of WPO and virtual shadow maps buut I'm not sure. There's been at least two engine versions since then so maybe it's sorted.
How much the simplewind version help with performance in this case ?
@JoshuaMKerr
Жыл бұрын
I'm not sure, I haven't tried. My feeling is it wouldn't help much.
Cant you do like the trees withinf your radius start moving and when its outside the radius it stops? You can use thwt for openworld games
@JoshuaMKerr
Жыл бұрын
There is a setting for this but I see no performance difference. I have to unhook the wpo in the master material to get the fps back up.
Cant you also just use the new model and materials as LOD?
Great
@JoshuaMKerr
Жыл бұрын
Cheers
Thank you for a useful lesson! Please take a lesson on how to properly create a landscape and textures for it. Usually, when a landscape is created and the texture of the earth is superimposed on it, it looks stretched and not very detailed, it is interesting to find out how to make a landscape with textures of earth, stones, grass look detailed and realistic.
@JoshuaMKerr
Жыл бұрын
It crossed my mind for sure. I'll see if I have time for some landscape material stuff.
what if the trees are turned into LODs and let that drive the material swaping? Or alternatively maybe we can just animate the texture only at distance and not mesh to fool people into thinking it's a moving tree.
@JoshuaMKerr
9 ай бұрын
I'll need to have another look at this, but when I tested it, I didn't get much improvement using other methods. Yours sounds like it would work
why not to switch off animation right in shader function by distance?
@JoshuaMKerr
Жыл бұрын
I think it should work but there's something funky going on in my project so the gains aren't as much as if I unhook the node.
Is this still a issue in 5.2? turning off WPO is not practical in a real game.
@JoshuaMKerr
Жыл бұрын
Culling would be better for games although my focus for the channel is cinematics and virtual production.
Why not disable WPO in the material depending on the player's camera?
Hello! very nice tutorial! Im'm running into an issue with my brushify grass - it is not showing with pathtracer enabled in viewport or on renders, but works in lit mode.. could anybody help please? I have no idea why it is happening but it was so nice to make levels fast with their materials and especially grass
@JoshuaMKerr
7 ай бұрын
Interesting, I haven't come across this issue. Let me know if you solve it.
hm can be something done with making shadow of foliage to use less performance but still keeping and having shadows from trees, have ones cake and eat it too? I have noticed that shadows are causing my problem
@petebaker5369
Ай бұрын
yeah same problem on my side, anyone have a solution?
@JoshuaMKerr
Ай бұрын
Its probably a mix of shadows and wpo. there is aparrently a setting in the foliage mode that allows you to cull the wpo by distance. try that.
is this applicable to a large map say 1.5km? meaning have a number of movable trees in the foreground? and the rest non-moving beyond that in the map?
@JoshuaMKerr
4 ай бұрын
probably better off with some of the solutions people posted in the comments. Apparently, in the foliage tool, you can set the distance cutoff for world position offset. It just didn't work for me back when I published this video.
@jamesbrady1930
4 ай бұрын
pretty much what I did in the end with the distance offset. tried the other way, didn't do squat really.
THX FOR MIC NOISE
@JoshuaMKerr
Жыл бұрын
ANY TIME
@diliupg
24 күн бұрын
Hallucinating on youtube!
Is it problematic to put no WPO Material on distant trees using the LOD system which change the Material at LOD1 LOD2, LOD3... so at LOD1 it can use WPO, at LOD2, LOD3.. will use the No-WPO Material. Is it feasable? the probleme i see is that we have 2 Material. does it take a lots of performance?
@JoshuaMKerr
10 ай бұрын
There must be an easier way. I'll see if I can figure something out.
Like other asset types the studios Ive worked for just use LOD's for the well... LOD's lol
When I apply WPOD the trees just stop moving period. What is wrong?
@JoshuaMKerr
Ай бұрын
Without seeing your setup, it's impossible to tell. Maybe join my discord and post in tne support forum with images.
Why not add a material to a LOD that has WPO turned off?
I am on a 1080 TI and my FPS are only 25fps with just 50 of these trees. At 150 trees I'm down to 10 FPS. How do you add so many trees and it's still smooth?
@JoshuaMKerr
5 ай бұрын
Are you using nanite? Otherwise the GPU I'm using is the 3080, so maybe that.
@fullbars
5 ай бұрын
@@JoshuaMKerr Yeah I have other megascans assets from quixel bridge that work fine. But these trees from UE Marketplace kill my FPS
The ark devs should see this
hum . i have a problem . when i quit and i back on my scene , all the duplicated trees are gone ...
@JoshuaMKerr
7 ай бұрын
That's very strange. I haven't come across that problem before
why dont you multiply vertex offset by camera distance??
@JoshuaMKerr
7 ай бұрын
I guess you could but im involved in cinematics and filmmaking. This works fine
@AlexViktor1997
7 ай бұрын
Ah, that makes sense
So your solution is ultimately, just to have less moving things... imagine that.
@JoshuaMKerr
Жыл бұрын
Indeed
Yeahhh.... as long as your player character never moves, this is great. lol I guess if you needed performance on your title screen?
@JoshuaMKerr
9 ай бұрын
I use unreal for filmmaking, that's what the channel focuses on.
@MichaelKocha
9 ай бұрын
@@JoshuaMKerr That makes more sense. Sorry. I just stumbled across the video and didn't pay attention to the context.
@JoshuaMKerr
9 ай бұрын
It's okay. I wasn't mega clear in the video:)
THANKS for identifying this problem and finding a workaround. Lets hope EPIC will fix this soon, so that none of us have to fiddle around with the #megascans assets to address this issue...
@JoshuaMKerr
Жыл бұрын
I really hope so. It's a pain really.
What you do is not the solution. World position offset drop fps because of VSM does not cache shadows. You cant close VSM, thats the only way of castig shadows on nanite. What you can do is disable cast shadows on nanite assets, make their duplicate, disable nanite on the new foliage, disable the imposter foliages visibility and enable its cast shadows. place the nanite tree and imposter tree on the same spor and orientation and size. Now you have cache shadows with nanite altho its not perfect its the only solution.
@JoshuaMKerr
9 ай бұрын
I've seen there's a plugin that can do this.
0:16 what are you right clicking here? its impossible to see you zoomed in on that menu way too hard
@JoshuaMKerr
9 ай бұрын
Right click on any asset in content browser to see that.
Mean while every UE5 game launched have the worst performance possible and is absolute broken.
@JoshuaMKerr
Жыл бұрын
Is that the case? I'm using UE for filmmaking mainly so haven't kept tabs on game releases.
this is a half solution what if you build an open world?
@JoshuaMKerr
4 ай бұрын
If you're in the game dev space, then yes, this isn't a solution for you. My channel is about virtual production, filmmaking, and cinematics.
Thumbnail was clickbait, I came looking for a comparaison between low and high fps foliage. Skipping through the video shows no such thing.
@JoshuaMKerr
Жыл бұрын
Sorry tha you feel that way. The video is about improving fps performance of foliage as mentioned in the title. I think the thumb tells that story.
mate if you are here and trying to increase your projects performans just like me remember that the main problem is your system.
@JoshuaMKerr
3 ай бұрын
That's not always the case. Sometimes software can tank even the most robust computer. Optimisation matters
Have you seen UnrealityBites solve similar problem using PCG in UE5.2? kzread.info/dash/bejne/a3iNm7qeYa64h5s.html Not sure if this helps. But he has a good explanation on grass which should work with trees too.
@JoshuaMKerr
Жыл бұрын
Yeah seems like a good solution if you're in 5.2 and using PCG.
No like ??/ I cannot like it ??
@JoshuaMKerr
Жыл бұрын
You can't like it? Strange.
what why it's called european beech lol 0:12
@JoshuaMKerr
Жыл бұрын
They are beech trees.
Damn it, thought this was for games until i got to the end. Waste
It is irrelevant but I liked your face gesture while you are speaking. I couldn't help myself not to look at your eyebrows and your forehead. The way you use them made me lost my focus. But it was a great tutorial, though...
@JoshuaMKerr
Жыл бұрын
Well that's nice. I didn't know I had hypnotic eyebrows
nanite is garbage nothing help still sucks fps
@JoshuaMKerr
10 ай бұрын
What's your biggest challenge with nanite