[TUTORIAL] Procedural forest creation at runtime in Blueprints


I have created a tool to generate procedural forest, you can check it out here.

Any comments and feedback is appreciated.

Awesome work!

Awesome!!! :slight_smile:

This is so cool!! Thank you for making this, it looks great! :slight_smile:

Very cool, thanks!

That is really cool. Blueprints is really impressive and keeps amazing me at what can be done with them. Keep it up and I look forward to seeing more :).

Very cool!

Do you run smoothly with all that amount of trees? Are those speedtrees?

This is awesome! Thanks! :slight_smile:

This is an amazing tutorial, thank you for taking the time make it.

Very cool. Though my mesh is spawning without a material on it. The small bush from content examples. Hmmm? Ideas?

Thanks for all the positive feedback.

You probably need to select “use with instances” in material details. Just open your material and in details panel type “instance” in the search box, and the option should be right there.

All trees i used for testing were, if I remember correctly, from vehicle game desert map. The material of palm tree is quite heavy, so if i got this tree in my spawn pool I try not to go over 5k objects. If I only spawn cactuses I can easily spawn over 10k+. I did some testing with 40k+ objects on the map but the performance hit was too big.

“You probably need to select “use with instances” in material details. Just open your material and in details panel type “instance” in the search box, and the option should be right there.”

Yep. That was it. Thanks a lot. So many switches and buttons, Oh my!

Wow. This is AMAZING. Quick question: I followed the instructions in the blog, play the level, run theblueprint in the level, and it populates with trees, etc. and looks great. However, once I pop out of “play” into the level editor, all the trees disappear. I tried to see if I could get the StartWorker to fire outside of actually playing the level, but couldn’t figure out how to do this. Maybe I’m missing something totally obvious? (probably!)

Oh, did I mention this is AMAZING!!! Thanks for sharing!

I’m afraid that there is no easy way of doing this. To make this blueprint work in editor whole forest creation process must be called from contruction scrip, however in construction scrip you cannot create custom events. Because of that you cannot split work between multiple actors, so whole functionality (creating grid, choosing spots to spawn, adding tree instances etc) must be called from one blueprint as single chain of functions. It should work ok for small areas with low tree density, but larger ones might freeze whole editor.

Thanks Zlug! Makes sense when you explain it, and STILL think this is amazing!

On thing I messed around with over the weekend was doing an event on begin play in the Level Blueprint to trigger the generation at the moment the game starts up. Figured, if you wanted to, you could maybe mask what the player sees for the first second or so it takes to populate the level, and then it would just “be there” when they fade in. Though, I actually think it’s kind of cool to just stand there in the game world and hit a button and have a bunch of forest appear around you. . . very matrixesque. . . .

This is cool. I’m going to see if i can combine this with alpha maps for more controlled converges.

Hi zlug,

Your instructions work great for a Level Blueprint.

However, I got a little stuck at the last part of your instructions : ‘4. Prepare Level Blueprint’ when trying to initialise the forest from a class blueprint.

This is what I did:

(1) open class blueprint (e.g. the character controller Blueprint from the FirstPerson example project)
(2) create StartForestObj variable of type:StartWorker_C
(3) dragged the StartForestObj variable into my class blueprint graph
(4) dragged a wire off StartForestObj to access -->[Call Starters]
(5) added event begin play to [Call Starters]
(6) compiled and a clicked play.

However, nothing happens.

Is there a different setup required for a generating a forest from a class blueprint?

BTW, a simple 1D perlin noise is a great way to make a patchiness map for something like this, so that you get patches that are a bit bare and such.

Then you can add a second layer with the noise layer inverted and add smaller plants and shrubs or grass to it to make it so the patchy areas are covered in smaller plants.

By preparing level blueprint i meant this one: lvlBlueprint.png and you just call function Call Starters on a object that is responsible for creating the forest that you placed in your map.

Sounds intresting, thanks for the info.

Would it be possible to use a black and white texture and only place the trees at the white areas?