I am creating a forest and don’t even have that many trees, but it drops my fps from 60 to 10 when in play and looking at them. Simple grass also hurts the performance a lot.
When I set the grass models (from quixel) to nanite, it goes from about 30 fps to 4 fps.
Isn’t nanite supposed to improve performance?
If your hardware specs don’t suck, you might be using the wrong settings. The number of foliage instances can easily grow to thousands for a very simple forest (grass, trees, flowers, etc.) so every instance must be optimized.
First off, are you using the engine’s foliage types? do you paint them with the foliage painter and optimize draw distance / amount per instance? are you calculating shadows for all of them or not?
If you’d place that amount of plants as unoptimized hand placed static meshes I’d not be surprised at low performance on good hardware.
Nanite doesn’t cull assets, for foliage this is terrible because it will cause a huge amount of overdraw since you’re always drawing LOD0 while keeping the same need for the engine to render through so many transparent layers.
Best way to fix this is to change the way you think when making foliage for nanite. Triangles are not really a problem anymore, so you need to model any foliage as close as possible to the opacity map to minimize transparent areas, then in the shader you need to fill the opacity based on distance to the asset, in practice removing opacity after x distance. If you did a good job making geometry that has similar silhoutte to the opacity map and have good padding on your texture you shouldn’t notice too much visual difference.
If you use VSM and the foliage has WPO enabled you will also destroy performance. Ideally we would be able to have a static shadowcasting mesh so VSM can cache the shadows but don’t think this is possible with anything but maybe static meshes you placed by hand, not foliage.
And a simple grass pack from Quixel Bridge.
I am using the foliage painter (Shift + 3)
I dragged the assets in there, adjusted the density and painted.
Is there something I’m missing?
Depends on what the eye can see. If you are doing an airplane simulator and see massive amounts of land, you will likely set the cull distance for low poly trees to very far away, while removing most of the grass. If you are building a first person shooter where most of the map can’t be seen at once, say a city environment, you can get away with lower cull distances. try to have as few plants on screen as possible while making it look OK to the eye.