So, I found this issue in my game, And this is more of a “Trying to understand how it works” More than anything. I have had long loading times for the main scene (A large, open world scene) and i always figured it had something to do with the terrain size and some initializing scripts. However, I found that loading times are minimal once I get rid of the foliage.
Now, I will say, I just did a quick full map foliage tool. I know that is very lazy and counterproductive to performance, but i was just going to have something working and deal with it later.
Before removing the foliage, there were around a few hundred thousand (maybe 400k?, short/medium culling distance, around 20000 i think?) instances of JUST a grass object that i have. It’s just a few planes with a really low resolution texture applied to it. Like i said, i was just going to have something that worked and then clean it up later. There were a few things that came with this # of foliage instances.
File Size: This many foliage instances made my scene file go from 1MB to ~1.2GB
Loading time: The scene now took anywhere from 17-33 seconds to load. Time did not change when built (This is what led me to think it was the initializing scripts)
Saving: With the foliage, saving took probably about the same time as loading, i did not check however.
Without the foliage: Loading time is under 150ms, size is ~1MB, save is back to minimal
Like I said, this is more of a “How does it work” question, so i can see if i can think of a workaround if possible.
Foliage is saved as raw bytes encoded into Base64 isndie json format of the scene file. This processing used to be rather fast but maybe we need to optimize it. I’ll add a task to the roadmap to investigate it
Ah that makes sense. I think we need some runtime-generated foliage over terrain/meshes via some shaders that would be a better fit for grass that’s more dense.
That would be awesome if it ever gets added. I’ve seen a lot of custom implementations in other engines and they always look so cool, but i for one do NOT know enough about shaders to do that
I’m back on this issue. I recreated a simple foliage (1 tree type, 4 grass types) with about 400k instances and file size is 40mb but the load time is already slowing down. I think this amount of foliage is reasonable for games so I’ll optimize it.
For larger grass counts, like 2mils you had, I think we will need a procedural grass generator (esp. based on underlying terrain) or even more universal procedural mesh generation system. Will work it on future.