Foliage performance - large foliage dependent scenes still a no?

Have there been any performance updates on foliage lately? I’ve been trying to make a scene with foliage, and I need to either set my settings down to ridiculous low settings and/or foliage density to such a low number that you would need to run a few meter to touch each grass mesh…

Even with just a very tiny amount of foliage meshes in a brand new map yanks up the gpu m/s with 8-10 more m/s and even more on a landscape scene.

GTX 670 and 3770k… Does GTA5 with 60fps with most stuff pretty high…

I think in 4.8 there were some foilage improvements. :slight_smile:
How many tris do you use for your foilage?

You can most definitely build huge foliage scenes. Our foliage density is very high and I’m seeing decent frame rates. I’m still working on optimization though and there are tons of stuff to do to optimize. But without any information about your assets I can’t really help much other than saying keep alpha down as much as possible and of course use LODs.

I am using the realistic grass pack 1 and I tried the grass from the open world demo… pretty **** laggy even with very very low culling distances.

Here is a package of a test map. Option menu under “o” and console key is “ø” on the Norwegian keyboard, no clue what that translates into English ones.

Edit; what is strange is when I go from Low to Ultra on view distance the amount of foliage multiplies quite a lot, but only a few frames gets freed up. But I get up to 60fps when all foliage is gone… Why does it not seem to matter much about the amount, but just that the foliage is in the scene and bam no frames…

Edit2; So when I stand in the middle of a patch of grass like here; I get 31fps or so… But when I lower viewdistance to Low as in this image; I only get back 2 fps from almost literally having NO foliage on screen. But when I delete the foliage completely I get back all the frames. The foliage on the images are max 40 triangles or so, down to only being two planes.

I want to give up this ****.

The short answer is to profile. GPU costs can be seen with ‘profilegpu’. Foliage is almost always heavy on the triangle/vertex count, which comes into play in both the base pass and shadowmap passes. It’s usually useful to click Play, then ‘setres 360x240’ or something tiny, then ‘profilegpu’ again. By comparing this against the original profile, you can see how much the vertex cost is (it’s the part of the base pass and shadow passes that don’t get reduced with lower resolution).

Setup aggressive LODs on your meshes, these are the key to getting low poly counts with foliage. Take a look at how the Kite demo foliage is setup once it gets released. It’s targeted toward high end, but could be scaled down to mid spec PC with some more aggressive LOD settings.

The improvements to foliage performance in 4.7 and 4.8 are mostly CPU side performance which allows millions of trees. GPU performance has not been changed as that lies mostly in how the content is created (how many instanced triangles, how much overdraw).

Then why does i only get 2 fps back when I go from Ultra view distance to Low? As you can see in the two images the amount of foliage in the two are exponentially more with Ultra, why is the trade-off then so low compared to removing the foliage all together. What costs more to render, a ton of overdraw or a ton of polygons? Should I try to cut out as much overdraw as I can like this; ? I could probably cut out more overdraw than that but at the cost of way higher polygon count.

Actually, the truth is if I have grass instances in my level and the whole tri-count added to the scene with “grasses only” is like 100k tris, I get a lot of frame drops. But If I remove all the grasses and add a single mesh (like a car) that is for example 500k tris, I don’t have any fps drops. So tri-count and LODs aren’t really the issue. I just think there’s something wrong with the foliage tool or something.

Also like fanzypantz mentioned, when hiding the foliage its not being rendered so all the frames should be back when the engine isn’t rendering a single grass out of the many that are placed. But in fact even though it’s not rendering them it’s still using a lot of frames for it and as soon as we delete the hidden foliage from the level frames are back up.

I used to have a LOT of foliage in my levels in cryengine without any fps drop with same PC. Never cared for tri- count and LODs and spent more time detailing my grasses and everything but ever since I switched engines I’m keeping my grasses as cards, no wind volumes, no touch bending, etc. yet, a lot of performance taken for it.

I think I’ve read about that it has to do with the way overdrawing is handled. I think we need to wait a bit for a much more optimized for foliage type shader. In the meanwhile I guess we just have to use LOD’s heavily.

You can have an insane amount of speedtree trees though : )

There is no difference between a SpeedTree model and any other model you import to the engine. So if you can have lots of SpeedTrees, then you can have lots of models made somewhere else, provided they’ have the same quality and all that.

In UE3 I would get a lot better performance by grouping up the grass into bunches of about 20 sets of grass (making a 5 x 5 ft circle-ish patch of grass), I don’t know if this is the case with UE4 though.

I have exactly the same problem, creating large fileds of dense grass is almost impossible. Would be really nice if epic would work on a solution for this problem.
I will post later a screenshot with a relative small but dense grass filed, i’m uisng a 780 Ti OC Version and i get is like 10 FPS on my scene.
I’m using the same mesh also very dense but like on a 40 x time larger area in cryengine and i still get my 60 to 80 FPS and we are talking here about full dynamic lighting not baked lighting “which should be faster in performance”.

Err, shouldn’t this make vert performance worse by introducing thousands of subpixel triangles? That’s really what kills it on modern GPUs, as they’ll eat > 1 pixel triangles all day long, getting vert bound is highly unusual if you’ve got proper LOD. I assume since it’s deferred the foliage uses alpha cutout/test? UE4 might be getting overdraw bound then for fields of grass. You can do a foliage/alpha test depth pre-pass then for the main g-buffer pass do GL_EQUAL depth testing.

Or, well there’s a lot of ways to optimize for overdraw when doing alpha test, which definitely sounds like what’s happening. For those wanting to optimize right now make sure your meshes/textures have the least amount of alpha tested space as easily possible, EG

B is better than A even though it has more verts, because it has less alpha test space.

Some good info there, DanielW, thank you.

Is there any more input for this topic? I’m having a really hard time optimising a large, foliage heavy scene scene.

Could anybody confirm whether having many more very low poly vegetation instances would be more efficient than fewer, denser meshes? Particularly for grass and short vegetation assets??

Overdraw performance hit with masked materials is pretty nonexistent from what I’ve seen. Large triangle counts with trees are way worse when it comes to performance.

Huh… well then, uhhh. Got no idea why OP is having such a rough time with performance, other than maybe they don’t have any LOD set up. Large tri counts are fine on the high end as long as you have a lot of good LOD levels to fade between. So the only other thing I can think of is they don’t have that and are getting hit with lots of sub pixel triangles. Come to think of it I never did look at how UE4 handles alpha test to begin with.

I’ve not had a proper look in UE4 yet as it’s not cleanup time, but in Unity I remember having masses of LOD’s actually caused performance slow downs due to variations in culling distance. I’m unsure if UE4 has a solution for this?

The one thing I did notice is anything with a cut out /alpha which pretty much all grass meshes use occur heavy material complexity. But that’s just the cost of having a fat G-Buffer with tiled deferred rendering and the only thing you can do, like pretty much every other engine does is a have a forward rendering path.

Is there any reason why the FR path tied to the same grid as the DR hasn’t happened yet? I dare say ALOT of games use some sort of terrain system so I’d of thought it’d be quite high on the priority list.

Please let me know if I’m incorrect.