Whats the best way to populate large terrains with vast amount of foliage?

Hello everyone !
This is kind of a plea for help . I’m trying to build a project , a game level , for my university thesis . It is going to be a large landscape , kind of an open world , although just a piece of it will be playable (playable as of just explorable , no actual gameplay is required ) , but alot of it must be shown , with a camera flyby . This is actually the first time ever , I try to build something with a game engine . I have some 3D modeling experience , but as you can imagine I’m running into alot of problems with trying to build something that runs realtime .
Now for the current problem I can’t seem to think my way out of . The landscape will be populated with alot of vegetation , sort of a forest environment . I have build my models , and materials , and I was makind alot of tests to determine the amount of culling it will need for acceptable performance, everything seemed to work fine in the small test section I was using , so i moved to the next stage - actually painting the whole terrain with the foliage . I was planing to do it in stages , first paint the grass and some bushes , then paint some flowers in select places , paint some rocks for flavor , finally paint the trees . The problem I ran into was at the first stage , at first painting the grass was going ok , but soon when I had about half my terrain painted , I started to run into some huge performance issues both with frame rates and editor responsivness . Right now for example even if i’m using culling amount that was resulting in 90-100 fps before in the relativly small test area ( about 50000 units radius) now it results in 20-ish fps . Not only that but lighmass crashes and can’t be built and when something in the foliage options is changed the editor hangs for a couple of minutes .
Some technical data for what i have right now , my grass mesh has 50 triangles , I have painted about 1.5million instances in 3200 clusters . Culling is set fromm 1000 to 5000 .
I realise now , that this method is probably not going to work at all . I’m at a loss here , I don’t know how to go about populating my terrain with vegetation . I was thinking of something along the lines of spawning the meshes when the player is at a certain distance , or maybe even using something like the vegetation blueprint from the BlueprintOffice sample project , but larger and ataching it to the player so it moves with him . All of this i don’t know how to do or if it’s even possible .
If there is someone who has more experience with big terrains and large amounts of meshes and could possibly throw me an idea or describe the best way of doing this kind of things , I’ll be immensely grateful .

Is there any examples of this that we can read about? I am having quite some issues with things like too much foliage myself.

That’s exactly what I was thinking , i’ll try to adapt the blueprint from the office example maybe .
I tried to search around , I’ll do some more digging , but if someone could direct us to some learning materials . It might not be directly foliage related , just more info on how to begin with building such a procedural system , it would be great !

http://www.michalorzelek.com/blog/?p=374

I’ve always wished you could assign foliage to a material and set the density dynamically.

I’d love to see Epic assign grass to 4km of terrain with the current system, I think their computers would explode.

Thanks , this looks pretty awesome . I’ll see if I can adapt some of that .

That sounds really cool.

How are you detecting what layer material is painted down in the component?