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

I enabled distance culling, Forward Rendering. And it’s not very dense. Zpass enabled.
1000 draw calls. 53k units of grass. 500 Vertices per asset. I am using ProjectNature Grass. Very good optimization.
Someone else gets gets 90 fps with another good optimized grass asset. Why don’t I get that? ProjectNature has very good optimization for games.

https://forums.unrealengine.com/core/blob:https://www.reddit.com/4fc07454-307a-4835-872e-3fd4ddfaa587

It’s probably not a good asset.
modern GFX perform better with less transparency and more triangles.
Look into Vertex grass.

Also make sure the LODs exist and are in use.
There is absolutely no need to keep the initial LOD at a distance since the grass quickly becomes less then 1 pixel and therefore hard to render.

Another thing is, disable shadows on it and fake the shadow with a texture. This prevents the dynamic light from wasting resources calculating the imperceptible shadow that the grass will cast - which is also more expensive if the grass uses transparency.

Forward rendering will get you more frames in general, but not in this case. You can revert to the regular system unless you need forward rendering specifically.

Last but not least your landscape is eating up FPS too. Which is normal. Drop the LOD of it down to 0 as a last touch and see if that gets you back above 60fps.

I’ve made lots of tests with foliage.
For that kind of grass, you should disable dynamic shadows for that mesh on the foliage tool, and enable contact shadows in the directional light. (That usually boosts performance).
You can also try to change the depth prepass from “opaque meshes only” to “opaque and masked”. I’ve seen some performance increase on forest like scenes changing that setting,
Of course all that “MostHost LA” said, are good advices also,

I know this is an old post but maybe this info can be usefull for someone else.

[USER=“3140864”]MostHost LA[/USER]
Grass is: focused “hp” meshes to reduce overdraw.

Drop down landscape lod to 0? That is the highest vertices count tho.
There is very little overdraw on this grass. I am sure you’re confusing this with ■■■■■■ grass.

Directional light and its contact shadows doesnt work for me. @iscaru1988
​​​​​​​This Post is not old.

I haven’t tested the asset in question, but nonetheless I told you all the things you need to check on to get things to run smoother.
and you misunderstood on the landscape LOD. Check the details tab on the landscape, you’ll find the setting.

Btw, 500 vertex per mesh is not low impact on transparency.

Hi, an image from the result of “stat gpu” might be useful here, since you’re gpu bound.

Btw. he is using exactly this grass here Creating Next-Gen Grass In UE4 which I think you know about :slight_smile:

LODS are in use.
I dont understand: There is absolutely no need to keep the initial LOD at a distance since the grass quickly becomes less then 1 pixel and therefore hard to render.
How do I fake shadows with texture?
Ive changed LOd of landscape and nothing happend regarding fps. MostHost LA

Check how aggressive the lods on the grass are. The more aggressive, the more likely they use transparency. The more transparency in use (there is a view for this btw) the more Overdraw. The more Overdraw, the more GPU cost.

To fake the shadow with a texture you simply darken the root of the grass by coloring the albedo texture (more performant) or overlay a texture to darken it (less performant but can be done with a UV mapping trick to save a texture).
Doing so will make the grass feel alive even during motion while you’ll be able to disable shadow on it and gain in performance.

I’ll dig out the exact setting to tweak on the landscape when I can.

I don’t understand how a AO similar shadow should replicate a sharp shadow incoming from moon/sun.

Because you will never be able to tell the difference between one and the other past 2 meters from camera.
So essentially you could even force a different material for LOD1 and up to gain performance. However, as far as I know, you can’t selectively disable shadowing only on a specific LOD level.
That means you usually have to disable the showing on it and just fake it - or else you will have performance issues.

Aside from that. Green isn’t bad, but it can be better:

Check the LOD coloration detail view. Depending on what you see color wise at the same distance, you can figure out what LOD it is that needs adjusting.

Last but not least, that landscape setting.
Try playing with SubSection Min Component ScreenSize. Also make sure your landscape material is good - without tessellation to gain FPS. Or alternatively benchmark without a landscape material entirely to see if you should be concerned about the landscape material you are using or not.

Unless you’re using a translucent material, it won’t display anything beyond green, so for this masked material green is the worst you can get. The problem for this overdraw is the high vertex count (if more than one triangle covers the same pixel that will result in overdraw). To reduce this overdraw you can either reduce the cull distance to before it turns all green, or add more lods with lower vertex count for the distance.

If your goal is only to reduce overdraw due to the opacity mask, you don’t need such an high amount of vertices. But if you also want realistic wind effects, then you do. And that’s another problem for your performance. The grass from project nature has a high vertex shader complexity (above 400) due to simulating player interaction and realistic wind effects and combining this with a very high vertex count is bad for performance.

And could you add an image from “stat_gpu”?

Not the original scene. This is really difficult to understand what you write.

hello MostHost LA
u can disable the shadow on lods
i think we can turn on dynamic shadow on lod0 and lod1 then disabling it and faking the shadows on the other lods by tinting the root off the grass to make it darker (and get red off some off the maps like normal map or AO +roughness ) to give more performance
is that a good solution?

Ok thanks, couple of things:

(1) “stat gpu” inside the shader complexity view will give you wrong results since this is rendering a different image, could you make another image from “stat gpu” while in normal view?

(2) Seems you’re capping at 60 fps, could you uncap the fps? (the console command is “t.maxFPS” and if you would set it to <= 0 it will uncap the fps)

(3) Always test performance (and therefore the image from “stat gpu”) in standalone (not sure if you’re already doing that but since this is rather important for performance I mention it). Because else you will also see the performance used up by the editor (and every window you have open there) and therefore you will get much lower framerates.

Hmmm, what specifically?

Standalone game runs with less fps than in editor viewport. EDIT: Standalone runs with 7 fps more
My cap is at 120 or higher.

Ok shadows take up around 2.6ms of time. To reduce this you can use the approach suggested above, so disable cast shadow for any lod other than lod 0 and fake it for the other lods in the material.

The grass from project nature is optimized, therefore changes to reduce the Basepass cost will result in a loss of features/visual quality. But you can basically do two things:

(1) If you don’t need player interaction and realistic wind, then inside the grass material replace what is plugged into “World Position Offset” there with “Simple Grass Wind” (I would use a static switch you can easily change back) that will reduce the vertex shader complexity.

(2) Add more lods/ do more aggressive lod transitions, so that when you would look at the grass in overdraw view, then it should still be somewhat blue in distance, since right now you have very high overdraw. [HR][/HR]
And at last you might wanna think about using grass that has less impact on performance because if you would really do (1) and (2) you could just save yourself the work and use a different grass that does not have this wind effect and such a high vertex count to begin with (you could try their single triangle grass) since without the realistic wind effect the poly count is an overkill for reducing overdraw due to the opacity mask and therefore somewhat useless.

But depends of course on how much performance you wanna use up for the grass.

@HERO4K60
if you can, that does sound like an awesome compromise.

@chrudimer
I was initially using a fully transparent material. The idea was if it can function with full transparency above 60fps, converting to a regular grass material will perform far better. Combined to the per instance fade it can also visually aid / debug far distance LOD Overdraw.

Testing for performance using and from with in the PIE is not best practice.

UE4 rendering best practice

Some good advice in general.

Our maps generally run at between 30 - 60 FPS but once cooked runs at a cap of 120

It should also be be noted that FPS is not really the indicator as to performance as most things in UE4 is based on rendering refresh rates in ms

Also you can LOD materials as well so so you could get away with out using a mask that adds to the overdraw problem

1 Like

Usually, just using proper culling distances you get some good balance of performance & visual look and feel.
Here’s my I went from 50 fps to 100fps: https://www.youtube.com/watch?v=BlMyL8J7HPo

Based on your stat gpu, it seems like Shadow Depth calculation is somewhat high. Actually, this is not related to grass. But you can remove dynamic shadows to get rid of that.
But you can keep some shadows & reduce this number by just reducing Num Dynamic Shadow Cascades to 1 in your Directional light.

Or you can run this R. command: r.Shadow.CSM.MaxCascades 1

> My cap is at 120 or higher.

With your graphics cards, I don’t know how to achieve 120 with landscape with a decent amount of foliage anyway. Maybe consider targeting for realistic goals.

but rdr2 etc. can do dynamic grass with much higher fps than ue