- Home /
Randomize trees for terrain painting
Hello,
I created a few basic trees to put on my terrain, but the default tree painting tool only places a single kind of tree each time, with no randomness possible.
I tried to create 4 of each tree types, to prevent the unnatural feel given by all trees being the same, but the tool can only select one at a time for painting.
I thought that I might have missed something, like a way to randomize the "seed" for the trunk and branches, or other things like that, but google doesn't seem to net me any answer.
Am I stuck with either scripting the trees, or manually placing them?
If that's the case, it's going to take quite a lot of time to make a decent forest, but at least I'll know it's the only way to go about it without getting the same tree everywhere.
Answer by bartm4n · Feb 11, 2015 at 05:26 PM
Have you looked at the built in option to mass place trees, just below where you define the tree objects for the terrain? This will give the trees random orientation and color variation as well as use all of your defined trees.
The only thing that could be better about this is if you could specify upper/lower heights for trees to be placed. I have seen some custom editor scripts floating around to do just that, but with the built in functionality you will have to manually clean up the areas that you don't want trees to be placed.
It's not bad per say, but it uses the whole terrain, and what I wanted was to make a land with multiple types of forests, depending on climate and elevation.
For a single type of forest, the tool is great though, and as I didn't put that precision, it would have been an answer.
In that case, it sounds like you are looking for something like the Geometry Brush editor script that allows you to paint different game objects on to the terrain. A version of this tool is provided for free by larsbertram1, author of Advanced Foliage Shader. It is available at https://dl.dropboxusercontent.com/u/2322017/GeometryBrushAFS.v1.unitypackage
The downside to this is that the objects will be individual game objects and not benefit from the optimization that terrain-managed trees provide (billboarding, for example).
I did come across an old forum thread recently that discussed in depth writing a replacement for management of terrain trees. I am sorry, but I don't have a link available for you.
Best of luck to you in finding a solution that fits your needs.
Thanks a lot, that's a good basis to start, and I can always try my hands at coding for a tool I need.
Thanks for your time, it is really appreciated.
Answer by michidk · Sep 23, 2016 at 09:08 PM
We made a editor plugin, which creates new randomized versions of a tree. Input: A tree you made with the Unity tree system. Output: Any number (you can set it) of trees.
Get it here: https://www.assetstore.unity3d.com/#!/content/59228