Foliage reduces performance drastically

Hi there,

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?

Any advice?

1 Like

No. The whole engine is a dud.

Check/enable transparency in early z-pass and see if that makes any difference.

Depending on hardware, 1fps for a full forest sounds correct with respect to the current engine 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.

I’m using these trees: temperate Vegetation: Spruce Forest in Props - UE Marketplace

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?

1 Like

If I don’t use Nanite, what are base culling distances I can start with to test this?

Just adding my two cents worth here, but the is no ‘simple grass’ from Quixel :slight_smile:

They’re all massively highpoly.

A simple grass mesh, would be about 200 tris.

Well, relatively speaking for a game that should like quite realistic. There are also some fancy ones. Basic makes more sense.

510 tris

Lod0 of a MS grass mesh is about 2800 and covers about 1/8 of the area :slight_smile:

1 Like

I was thinking about using some other assets. Where are these from if you don’t mind me asking?

Landscape auto mat

Very useable stuff, this one is only 94

:slight_smile:

Also, this stuff is quite performant ( although higher poly )

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.

1 Like

Thanks, bookmarked