Foliage - real optimisation, what am I missing ?

Hello guys.

First of all, thank you for taking time to read me.

I’ve been trying for days to do all optimisations possible, step by step, to allow me to have lots of foliage in my landscape, but watever I do, it costs a big drop of FPS. It shouldn’t, as it’s instanced foliage meshes, generate so much draws.

I really would like to know, once and for all, how do do this correctly and the good practices. How do you guys do ?

So, I use the most basic mesh, without material, to remove any additionnal potential parameters :

I do place a lot of them :

It seems a lot but if I add my material, it’s not that much :

So here it is :

looking at the sky : 200+ fps

looking at landscape : 300 fps ( interesting how the sky is consuming 100 fps ?? )

and the foliages ( with and without shadows) :

debug5v

All of that without nanite, and without any LOD.

It is actually way better when I use even just 2 LODs, but it’s doing weird ■■■■ with the shadows like : shadows in the first plan, no shadows in the middle, and re shadow in the foreground, like a “middle shadow culling”, do you know how to fix this ?

Thank you !!

debug2v

The stats unit :

Well, you can shorten the draw distance, even remove transparency at a certain distance (don’t use shaded translucency). Also use a billboard that looks at the camera from a distance and tries to keep the material simple.

1 Like

Thank you for your answer @Jinkel

Well I did not even use a material for my test as you can see. But I am interessed by how to shorten the draw distance ? Or even change the material at a certain distance ?

My material when I use it don’t use translucency as it cost lots of gpu, I only use a mask one.

/!\ After making some more testing, it is actually good with lods., i got a solid 120+ fps even with the material !!

But i need to find how to fix those shadow issues :

debug3v

The mesh for your grass must be cut tight to the actual texture.

Bad → Good


Masking is a must for foliage. Transparency causes Overdraw. Meaning the render pipeline has to re-render a scene again to get what was behind the transparent mesh. If that mesh used transparency, it does it again, and again for each layer of transparency in view.


Levels of Detail (LoDs)! You have to use LoDs. I typically do 4 for foliage.

  • LoD 0 full clump of grass, highest detail.
  • LoD 1, reduction in number of Blades, Leaves/Branches.. can usually use the same materials.
  • LoD 2, more reduction in Blades, Leaves/Branches. May consider a material/texture res reduction.
  • LoD 3, Billboards. Definitely a custom material and textures.

Foliage is done in layers. Thin base coat, then a medium density, Then detail additions.

Grasstypes in landscape material place the base grass and other foliage, debris etc. small clumps and clusters. Thin sporadic grass, flowers, rocks, small clusters of leaves and tree debris.

Procedural Foliage is used to add density. More grass (larger clumps), bushes, large debris, boulders and Trees.

Foliage Tool (painting) is used to add those final detailed placements and Large (extreme distance visible) assets. You can do some of the heavy in the procedural step, But I prefer to do them with foliage tool.


Culling (Min/Max Draw Distance). You do not need to see every blade of grass from 150m away. The smaller stuff needs to be a 30-50m max. Large clumps/clusters of grass, flowers etc can go out to 100-150m, but you also need to increase their LoD screensize in the mesh editor. Takes a fair amount of tweaking and testing.


Shadows!!!
Small grass, rocks etc… basically all the stuff used in grasstypes shouldn’t have shadows.
Medium to Large assets can have them. If you’re using Lumen you need to note that it doesn’t support baked lighting, so all shadows will be dynamic.


Here’s a shot from a level, all painted (foliage tool). I use this level to test the assets themselves. To fully optimize I have to apply grasstypes, procedural and foliage tool correctly. And adjust LoDs, Culling etc. These steps are done in the main levels.

1 Like

thank you @RevoveR for this detailed answer ! I’ll deep dive into all those techniques.

However, I don’t really agree with this : “Small grass, rocks etc… basically all the stuff used in grasstypes shouldn’t have shadows.”

I have to say, grass without shadow really look differently, in a bad way :

And it seems like your grass do have shadow in your screenshot ?

But it only cost a few fps ( I am not using lumen) so i’m ok with that.

My material is using only mask, it seems ok ?

Would you have any idea for the shadow issue ?

Thank you

The grass in my photo is the big stuff. Large clumps. I’m not running the real small stuff in it. Just about every clump here is near knee height.

Shadows from the large clumps are generally enough to cast over and get the feel. You blend them in with the small stuff. Dynamic shadows are expensive as hell.