grass killing my fps. gtx 970, 3700x - empty map fps 120

there’s always room for improvements for sure. Since they are targeting especially for PS4. They sure have done some clever optimizations.

Since UE4 is a generic tool, there’s an abstraction layer. So, it will have some performance cost or not utilizing the full power of the hardware.

This grass has 8k textures, every individual grass blade is modeled, and most of the maximum LOD’s don’t drop below 150 triangles, with some bottoming out at 700~ (???)

It might be “optimized” in some sense but it was clearly designed for realism over performance

1 Like

do you know better foliage than that? something like within RDR2

Sure it’s called “make your own” friend.
as a tip. If you enable dithering on lod within the material you get less of a popping effect when you transition to the billboards.

You should probably have 1500 tris per meter in lod0.
and around 20 tris in lod 4/5

Each blade at lod 0 should have a max of 6 quads and 3 tris.
shorter blades can get away with 4 quads.

The final billboard needs to be baked into the grass texture. A total size of 1024 is probably overkill already… making the impostor size maybe 1/4 of that when you bake it down.
ofc, you can build in 8k texture and shrink after.

It’s a process. A long one. And one that take experience to boot.

I don’t own RDR2 and can’t comment on how they made their grass, but given that it’s a game it almost certainly used grass cards, because that’s what virtually every game has to do.

Though I don’t know anything about RDR2, I do know that it had to run on a PS4. And luckily there’s another game with lots of foliage that also had to run on the PS4: Horizon Zero Dawn. And their whole foliage workflow has been walked through by the developers, which shows their top-most grass LOD was around 20-36 triangles.

Note: I’m fairly sure that LOD1 is the full resolution geometry (LOD0) in this context.

This about what you should be aiming for. So either find an asset that is suitable, or make it yourself.

Red flag on play.
You should really get it just to see how well it is made art wise. On PC ofc.
In terms of open landscapes it is likely to be the holy grail.

You’d be hard pressed to see a single LOD pop for the first 6 hours of gameplay - and even when you know where the transition distance is, it’s near impossible to spot the change in grass/vegetation.

As far as as rest you shared. That’s an instant no too.

Grass in unreal doesn’t perform well at all because of overdraw/transparency and the engine being a ■■■■ about z pass. Regardless of forcing early or not.

Its preferable and much more performance friendly to use VERTEX based grass up to a good distance from the player. The engine just handles tris count much better than transparent or masked materials.

To be clear, rdr2 PC looks rather realistic.
Having 3 or 4 meshes of grass like ps3/4 games used to have is not the end goal here. Think 1b and upwards meshes of the type you shared in a 90 for 4k screen.

The overdraw alone is enough to cripple a 1080ti. In fact, above 11k meshes of those epic produced in kite you get a 4k performance cost of around 25ms. Without anything else in the scene. And still get patchy looking terrain to boot.

Where as, 11k meshes at around 1500 tris each run fov90 4k at around 12ms.

I’m not the only one saying so btw.

Nor am I preaching gospel, having barked at this particular tree for over a month in the past before figuring out myself that tris count is better than transparency.

In fact, I’m actually still barking at a similar tree today, by adding vector field tracking to the meshes…

No idea what you’re doing if you’re “crippling” a 1080ti with masked materials. Here’s the stress test I did for my own project:

Alpha Cards
LOD0: 35 triangles
LOD1: 6 triangles

Mesh Only
LOD0: 815 triangles
LOD1: 408 triangles
LOD2: 78 triangles

Both use the same material with the only difference being that the mesh material is set to opaque, while the alpha card material is set to masked. Same foliage actor, all I did was replace the foliage mesh. Meshes were modeled to look as close as possible to each other to get a realistic estimate of the cost of achieving a desired density.

Difference is trivial. Geometry is not free, it generates tons of overdraw on its own which is the whole point of having LODs.

Do I need to point out that this article was written by the guy who authored the ‘optimized’ grass pack that the original poster is complaining is killing his framerate?

This article may have been true at the time, I don’t know when the early depth pass was added to the engine, but it’s definitely not true now.

Usage error is enough to account for crippling performance when using the pre-made pack. You can’t expect things to work at a default density value of 400 when the base mesh has more that 5k tris.

Ofc geometry isn’t free. Its still cheaper than material masking when overdraw comes into play.

And no. Geometry on it’s own does not generate overdraw as far as render cost or even as far as optimization viewmode goes. If you use masked materials then yes. But minimizing the amout of transparency is still beneficial.

Also, if you think the quality of your tested grass is even remotely close to the visual quality of the of end result from the article you are dreaming.
It’s essentially the same as comparing supermario64 to red dead redemption 2. What’s the point?
None. Two completely different ball games.

You also have to consider the texture size. The pack probably comes with 4k or better. If you don’t reduce that for actual usage you also take a needless memory hit.

Early z pass has been in long before the article btw.
It didn’t really improve things much at all up to and including the latest .25. It works better in certain situations. Usually not with just grasslands. I had success on some tree/forest scenes by enabling it.

What are you even looking at? Every triangle in the scene generates quad overdraw where two triangles share the same 2x2 quad. This is blatantly obvious in quad overdraw visibility mode.

You do understand how a controlled test works right? Furthermore geometry is inherently less efficient than cards, it only scales worse the more of it you have to use and you have to use a ton of it to get a remotely realistic result. Which is no doubt exactly why RDR2 uses alpha cards just like every other game.

Think of it this way: Overdraw is expensive right? Even with a masked material it can really add up. Your article says that, and it’s not wrong.

So you start cutting out the transparent areas of the mesh, makes perfect sense. But geometry has a cost too, we know this, so essentially what you are doing is shifting the cost of transparency to the geometry so that you don’t have pay the cost of alpha testing. No problem, this makes sense provided the added geometry is cheaper than testing the alpha. You just have to decide while you’re making the mesh whether the cost of adding more geometry to an area is going to be higher or lower than simply alpha testing. If you’re not masking in the early z pass then it might make sense to be very aggressive and use a lot more geometry than you otherwise would.

So now you’ve got your mesh, it’s got a lot of geometry in there to eliminate as much overdraw as possible. Enabling masking in early z-pass at this point would not accomplish much, because there’s very little overdraw cost to reduce, you’ve already shifted it to the geometry.

But what if you knew you could make the overdraw less expensive by doing the masking only in the early z-pass? Well it would still make sense to cut out transparent parts, but now you wouldn’t need to be as aggressive about it because overdraw is less expensive, and so adding more geometry doesn’t provide as much benefit, it might even be more expensive now to use more geo as the cost of alpha testing is now cheaper relative to using more geometry than it used to be. The dynamics of the geometry/pixel performance tradeoff have changed. Now it makes sense to use less geometry (within reason)

Regardless, you can keep doing whatever you want, makes no different to me. I just hope others who read this will test the performance themselves instead of just taking your word for it that masked materials are going to melt their 1080ti.

If you read what I said it’s that the 1b meshes with a masked material required to have the same look (as the article) will melt your 1080ti.

The rest is obvious. If you re-read what I wrote it’s pretty clear. You have to transition to cards over distance in an asset that allows for both single strands and alpha masked cards.

how much/ what distance, that’s up to the user after testing performance.

can you elaborate on this please?

and in general I read a lot of claims here based on theory but theory varies depending on engine/platform and the geometry requirements of the art style (i.e. zelda/switch with stylized spikey grass blades is better at pushing polygons, horizonZD/ps4 with more realistic/thin/varied grass shapes is better at handling overdraw). the scene complexity might also have an influence. an empty scene with hundreds of thousands of grass triangles probably won’t perform the same vs that same grass on top of a scene that already has 1-2 million polys on-screen
do you have any UE4 comparisons that you can show?

there’s several things at play here and like you say it depends on how the assets are made and how optimized they are.
also when using z-pass using the alpha as its own texture (instead of using the alpha of an RGBA as most people do) you save on texture bandwidth, moreso if you downscale the texture and/or reduce texture filter quality, resulting in minimal quality loss but can give a decent performance boost (also doesn’t cost an extra sampler bc doing the alpha sample in the depth pass already costs an extra sampler. and it can even mean less memory usage if you downscale it). have any of you considered this?

I’ve only tested with trees but so far I’m getting better performance using z-pass with less triangles and more overdraw, compared to tighter geometry and no z-pass

So a totally pointless hypothetical will melt a 1080ti? Fair enough

Indeed. “Use more geometry near the camera” is very much a statement of the obvious. Modeling individual grass strands however, is not at all necessary.

I ran my original benchmarks on .22 and Kite.
At 4k you had something like a 2ms difference between early z pass and non early z pass.
in a scene that’s absolutely not optimized for 4k, doesnt use good meshes, etc.
I though it a good reference since it’s still something I thought everyone can access and test.

Haven’t ran similar tests on the same project since, but given everyone is complaining about an fps loss in .26 testing this now seems like a total time waste.

I actually need to make some grass assets so I’ll end up testing properly made assets and differences shortly anyway.

As far as using alpha as its own texture. That’s not usually how I work, so it’s good to know/consider.
originally, I had tests going with both a separate alpha texture and a packed one. Still didn’t make much of any difference for the base cost. To the point I started just combining it to roughness and specularity out of convenience.

Originally I even ran tests using just the mesh from the docs/grass tutorials in the docs.
The results were equally poor / a plush looking field (default grass node settings of 400 density) would not render at 90fpv/4k past 30fps with or without early z pass.

last thing, if you want grass performance testing a scene with 1 to 2 b tirs already in it won’t give you the performance of just grass. It would give you the performance of the whole. Normally that’s what you need. In a project / when testing etc.

However if you can get a scene to render just grass at the required distance with a cost of 10ms or so, in the res you need, you also know you won’t have issues when packing it into just about anything…
And, it’s a lot easier to replicate the test, since others won’t need to download a whole scene…

I’ll get back with current benchmarks in .25 on the mesh I make today/tomorrow. We’ll see what happens with that.

Depends on what you are doing.
May not matter in supermario64, but it matters in any other game where the meshes actually move with character position / you do other crazy shader stuff.

it’s also a good way to produce a perfect card with all the trimmings. Normal, radiosity, roughness, gloss, AO, curvature, random color id so you can apply sine over time * the random id to do more crazy shader stuff. Etc.

So don’t go around saying it’s “completely unnecessary” just because you don’t see an immediate application/reason…

Think it was pretty obvious I was specifically speaking from a performance optimization standpoint.

You may want to give it another shot

Though I would not recommend using the Kite assets, as they’re just extremely heavy in general.

That’s actually why I was testing off those. The idea being whatever I can make is actually a lot more performant than it.

Also it says fixed in .23, but if it was, I saw no factual improvement with it when making trees about 3 months ago in .25 between switching it on/off. Didn’t bother investigating much. Making better leaf sheets fixed the performance issues I was having…

why do people get different results when they try to optimize for foliage? why cant it be one standard method?

different pcs/gfx…

ehm no? cause then you could just create a standard where you do that and everything’s fine.

Just out of interest, that’s not ‘darkGreen_Mesh’ by any chance is it? There should be a public enquiry about the number of polys in that.

Better off making a new mesh from about 10 copies of ‘grass_01_mesh’ and LODding it heavily…

what is darkgreen mesh?
and what is 10 copies thingy?