Search Unity

Mass place trees on terrain based on polygon/point data

Discussion in 'World Building' started by GIS_Vejle, Mar 8, 2022.

  1. GIS_Vejle

    GIS_Vejle

    Joined:
    Jun 3, 2019
    Posts:
    12
    Is there a way to mass place trees on the terrain based on points or polygons?

    I have a pretty big scene for a town and got some data on where the trees are placed in real life. This can be exported as either points or polygons.

    If the polygons are aligned on top of the terrain in Unity - is there an easy way to mass place a specific prefab of a tree based on the individual polygons/points on the terrain?

    On the image below each red dot is a tree and this is just a fraction of the entire city. I would hate to place each tree manually with Terrain Paint Tree function...

    upload_2022-3-8_15-8-52.png
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
    Steps to success:

    - Look into Unity editor scripting

    - Write an editor script to accept the list of points and create trees on your terrain

    - Dirty the scene and save it.

    The heaviest lift will likely be:

    - figuring out how to produce trees in the terrain (read the docs)

    - figuring out coordinate transforms to operate against the terrain from whatever coordinates the source data is using

    You could always instead just create GameObjects at those positions rather than actual terrain trees.
     
  3. GIS_Vejle

    GIS_Vejle

    Joined:
    Jun 3, 2019
    Posts:
    12
    Hi Kurt-Dekker

    Thanks for getting back to me. Sounds like an almost impossible task for at none programmer like me :) I was more looking for a plugin that could help me with the task. I don't mind paying a bit of money for something that could potential save me a lot of hours of manual work.

    I've been looking at the documentation for Vegetation Studio Pro and it looks like it has an option that can bake a splatmap for treeplacement based on geometri. So this could be a solution for me for now

    https://assetstore.unity.com/packages/tools/terrain/vegetation-studio-pro-131835
     
  4. chbran

    chbran

    Joined:
    Dec 9, 2018
    Posts:
    23
    GIS_Vejle likes this.
  5. GIS_Vejle

    GIS_Vejle

    Joined:
    Jun 3, 2019
    Posts:
    12