- Home /
Can I create a tree using L-systems without having to instantiate each branches ?
I need to generate procedural trees, if I can, without the tree editor because i'd like to get different trees from each generation. I used to instantiate each branches but the result was not pretty good and, as I want to generate a lot of trees, I don't think it will be a great idea. Can i use scripts (and extrusion maybe) to generate those ?
Answer by Bunny83 · Jun 22, 2020 at 11:59 AM
There was a free and simple procedural tree generation script on the asset store, but unfortunately it has been deprecated by the developer. However in my answer to this question there's still a modified version of the script on my dropbox. The script essentially generates a "cylinder like" structure for each branch and just adds some random variations to it. The resulting trees looked quite nice.
However since you want to use a Lindenmayer system to generate the tree, you might only be interested in the actual meshing of the tree. How you apply your L-System to the actual generation is up to you.
Of course instead of generating the mesh from scratch you might be able to use prefabs for certain sections, instantiate them, positioning them the way you want and finally you could combine all the objects into one mesh. While this is a possible approach I wouldn't recommend it. It's quite wasteful since we still have to instantiate all the prefabs (which can be destroyed afterwards), but it also is quite limiting. The main issue is to properly combine different sections. The script I've mentioned above simply branches off the center of the previous branch.
Finally keep in mind that having a lot high detailed trees will certainly cause issues for performance. However how large your "forrest" should / can get depends on your specifications
Answer by Altimors · Jun 22, 2020 at 06:44 PM
Thanks a lot for your anwser, I think I will try those differents methods !
Your answer
Follow this Question
Related Questions
How to darken a procedurally added texture (explained below) 0 Answers
Multiple Cars not working 1 Answer
Generating a minimum spanning tree from a list of edges 0 Answers
Distribute terrain in zones 3 Answers
Where is the directory for GUI skin 0 Answers