- Home /
Converting polygon model to Unity Tree. Is it possible?
Is it possible to import a modeled 3D tree into Unity and set it up so that it works like the native Unity trees i.e. can be painted on terrains, reacts to wind, and changes to a billboard at a certain distance.
In the following article in the Unity Reference Manual it clearly states that trees can be created in this way, so I know that it is possible. However the article doesn't explain the process very clearly.
Is there a common workflow for this? Has anyone managed this successfully?
Answer by Pilot · Oct 24, 2011 at 12:29 PM
It is, but there are quite a few steps involved to get the trees working correctly:
Model your tree (any 3D package able to export to .fbx)
Assign two materials to your tree - one for the leaves, one for the trunk
Export your model as .fbx. Unity recommends to not exceed 2000 triangles (NOT polygons) per tree. Also take note of what units you are using.
In Unity, create an "Ambient Occlusion" folder
Import your tree assets into this folder
Adjust Ambient Occlusion settings as necessary
Assign textures to your materials. Make sure you use the Nature/Soft Occlusion Leaves and Nature/Soft Occlusion Bark shaders or your tree won't react to the wind (among other things)
Create an empty gameobject. Add a Mesh Filter & Mesh Renderer
Assign the relevant mesh, remember to change the number of materials to 2 (in inspector), otherwise your leaves will not show up
Add a collider to your tree if you wish
Create a prefab. Drag the gameobject onto the prefab
Done!
Now simply create a terrain and paint/place your new tree (remember to change the bend factor from the default "0"). If you can't see your tree when painting etc, adjust the scale factor in the inspector and try it again.
YAY!! Finally someone who knows how to do this. Thanks heaps
This does NOT work as of ver. 3.5.1, custom trees added with this guide can NOT be painted using the terrain editor nor do they work with windzones.
Does this work as of 4.0? I wasn't sure if the last comment about 3.5.1 was a bug in only that version, or if this just doesn't work anymore.
Answer by larsbertram1 · Sep 04, 2014 at 08:28 PM
If you want to import custom made trees and still benefit from advanced bending and lighting functions such as offered by the tree creator shaders you may give the custom tree importer script a try. It lets you import manually modeled trees from 3d Apps like Maya, 3ds Max, Modo or Blender and adjusts them to be compatible with unity's advanced tree creator shaders and directional and radial wind zones on the fly:
Answer by martiankuo · Apr 28, 2013 at 12:00 AM
My solution is as follows: 1) import your tree into Assets > Standard Assets > Terrain Assets > Tree Ambient-Occlusion > Your sub folder name (NOT just a folder whose name contains "Ambient-Occlusion") 2) Assign the Nature/Soft Occlusion Bark or Leaves Shader, and adjust the main color of the leaves to pure white (otherwise the leaves will show up black and opaque) 3) No need to add empty gameobject and then mesh filter or mesh renderer because when imported into the folder in 1), Unity to know how to set it up correctly. 4) edit terrain in inspector, add your tree and set up bend factor, and paint tree 5) add wind zone and play. Done
(I am using Unity 4)
Your answer
Follow this Question
Related Questions
Tree Spawn 1 Answer
Tree Spawning Question 1 Answer
using model that is geometry placed? 1 Answer
Tool for converting 3D Mecanim model to Sprite Sheet 0 Answers
Painting with homemade trees 2 Answers