How to bake grass maps to not rebuild every time the level is loaded?

Hi.

I have made a landscape and it’s material that uses grass maps to automatically spawn foliage for me. It works very well.

The problem is that everytime the level is loaded the grass maps are rebuilt and that takes a minute or two. This also happens in the packaged project whenever the level is loaded.
When players enter this level the FPS drops a lot because of the grass maps that are being built in the background.

Is there a way to bake/build the grass maps when the project is packaged/built ?

1 Like

Have you tried packaging it? I think you’ll find the grass maps are baked. I don’t know a way to fix it in editor, though.

1 Like

Hi.
Unfortunately that is where my problem is.
Like I mentioned in the question, the grass maps aren’t backed in the final shipping package. I don’t mind it rebuilding in the editor. But when player’s are testing the game their FPS drops significantly while the grass maps are built.

Meh… Not sure actually. I’m assuming you rebuilt manually before packaging? There’s also the ‘cook by the book’ option in the launcher…

Grabbing at straws really. Could be a bug…

It’s been a few months and I’m still struggling with this issue. I’m convinced it must be a checkbox somewhere that I missed.
I’m not sure what “cook by the book” is. I’ve tried to find in the editor.

I’m really surprised that no one else had this issue before

Ignore the cook comment, not relevant.

I’m thinking it might be something to do with the way you’ve written your landscape material. Specifically, what’s feeding the grass node, if anything…

I’ve used my own custom landscape material before, and it did the same thing. I’ve since switched to using the “Landscape pro v2” assets hoping this might solve the issue. Their grass maps are a bit more complicated since it’s all procedural. But even with my own simple landscape material grass maps had reloaded every time even in the packaged project.

Here is the link to the assets I mentioned
Landscape Pro 2.0 Auto-Generated Material

Here is a screenshot of the grass maps nodes.

I super appreciate your help btw :slight_smile:

Ah, I don’t think you used that word before, ‘packaged’.

If that’s the problem, then it’s not properly packaged.

I think there’s a problem in UE5 where the packaging doesn’t work correctly when you call it from the menu. But it does if you call it from the ‘launcher’ ( also on the menu ).

If something is packaged for distribution, there should be no shader compilation, grass map builds etc.

If you can open the console in the distribution, it’s not packaged right.

1 Like

Alright so I just rebuild the game but from the launcher this time. It was set as a shipping build with cook by the book set.
Unfortunately the grassmaps still build in the packaged project and fps is horrible until it’s complete. I’m not able to open the console in the packaged build. In the editor there is a message that shows that the grass maps are being built. Obviously this message does not appear in the packaged build but it’s clear that it’s happening as the foliage is completely missing at first and slowly appears across the map like when the grass maps are being built in the editor.

Could there be a setting that makes this happen in packaged project? I couldn’t find anything.

PS. I think you might have missed that I did mention the packaged project in my previous messages :slight_smile:

You could be right :smiley:

But, darn. Apparently not the solution then… :frowning:

Thank you so much for your help though.
I took a whole week to find this solution, but it seems someone else did have the same issue as me.
Solution here
I hope someone could find this useful.

1 Like

Bizarre, but good that you found it.

Did you ever try using front end to package it up?

I find this method to be the best for cooking and recooking - glad to the code worked but maybe this could to? I wonder if you just add a loading screen and a delay and then let the grass populate and the player only spawns in once that time of grass creation has finished? Just an idea! Thanks for sharing and linking your code solution.

Hi. Thank you for your response.
This was how I packaged the project. The problem persisted.

The code solution is not perfect. It causes the distant foliage to not be culled resulting in even worse FPS.

I’ve thought about adding a loading screen as well but this would mean players would wait a good 5-10 min.

I’ve taken a look at other projects made by Epic. It seems they do not make use of grass maps but instead use procedural foliage spawners. I believe this to be the only viable solution. Unfortunately this means I would have to redo a lot of work now.

I’d suggest that just because Grass Node sucks.
You can’t even output it into RVT because they never finish coding up a single darn thin in the engine before moving on.

However your statement is also inaccurate.
The silly Kite demo does use the grass node. In a rather specific way too.
And at least up to 4.25 I have never seen a packaged project baking grass maps while running.
We are talking 224Km^2 in World Composition loading empty (no other foliage) levels in less than a second. So it’s definitely not cooking anything (when the editor does it it takes a good minute or 2).