Working with Trees in Jibe and Unity3d

Everyone loves trees.  They fill the world around us with life and beauty.

And when you create your own multiuser virtual world with Jibe, you can plant an entire forest with just a few clicks of your mouse.

Today we’ll learn how to get started with trees in your Jibe world using the Unity3d editor.

Get your green thumb ready!

Where can I find trees for my Jibe world?

A great place to find trees for your Jibe world is in the Unity Asset Store.

Here's where you can find the Unity Asset Store.

The Unity Asset Store is a global marketplace for content creators.  It’s run by Unity Technologies (the folks who created Unity3d), and they run it very similar to how Apple runs the App Store.  All content is reviewed and approved before it goes online.  And you can decide to either give your content away for free or sell it for whatever price you like.  It doesn’t cost anything to put your content in the store, and you keep 70% of whatever you make in sales.  If you’re interested in putting your content on the Unity Asset Store, you can find more information here.

I think the best feature of the Unity Asset Store is the fact that it is integrated into the Unity editor as a window.  Very handy.

Open the Unity Asset Store and search for “trees.”

That's a lot of trees!

Here’s a free package that contains many different tree models.

A whole collection of trees for your world.

Click the import button, and your new collection of trees will immediately appear in your Project window in a folder called “Terrain Assets.”

New trees are now in your Project window.

How do I get my new trees into my world?

Just drag any one of those tree models from the Project window into your Scene window and it will immediately appear in your world.

To get a Japanese Maple in your world, select this and drag into your Scene window.

The Japanese Maple tree in your Scene window.

How can I create my own trees?

Since all models in Unity are mesh-based, you could use any mesh editing program (e.g., Blender, Maya, 3DStudio Max, AC3D) to create your own tree models.  Save your model file as either .fbx or .3ds (those are the most compatible file formats for Unity) and then drag the model file and associated textures into your Project window.  Just be sure the associated textures are placed in the same folder in your Project window as the model file, otherwise the textures might not map onto your model file.

You can also create new trees from scratch using the Tree Creator tool, which is built-in to the Unity editor.  The Unity3d website has a very helpful and comprehensive tutorial on how to use the Tree Creator if you’d like to learn more.

The very talented virtual landscape artist Michèle Brown (aka Marmottina Taurog) of Green and Wild has been doing some experimenting with the Unity Tree Creator tool, and she was kind enough to share one of her initial test trees with me.

Marmottina's first test tree using the Unity Tree Creator.

How can I plant lots of trees very quickly?

You can plant trees individually by just dragging them from your Project window into your Scene window.  But if you want to plant a large forest, placing each tree individually could take a very long time.

Fortunately, with the Unity editor you can paint trees on a terrain.  You just select which tree model you want to paint with, click and drag your brush across the terrain, and an entire forest will unfold in seconds.

To paint trees on a terrain, select your terrain file in your Hierarchy window.  Then look at your Inspector window.

How to start painting with trees in the Inspector window.

When you click the Edit Trees button, select the “Add Tree” option and you’ll see the following popup window.

What tree model do you want to use?

Now look in your Project window for the tree model you would like to use and drag it from your Project window onto the “None (Game Object)” field in the popup window.

In this example, I’m going to use the tree that Marmottina gave me.

Marmottina's tree added.

Click the Add button and you’ll see the tree pop up in the Inspector window.

Ready to go!

Play with the settings to change your brush size.  You’ll see your brush area as a blue halo in the Scene window.

This blue halo is your brush area as you move your mouse over the terrain.

Start clicking and paint a forest.

Notice how each tree is automatically placed so it is sitting on the ground.  If you ever go back and change the topography of your terrain, your painted trees will automatically reposition themselves to adjust to the new terrain elevations.

A forest planted with a single mouseclick.

Advanced Note: If you want avatars and rigidbody objects to be able to bump into your trees, this tree painting technique requires the use of a capsule collider with your tree models.  Other types of colliders (e.g., mesh colliders) won’t work.

When you’re done building your forest in the Unity editor, save your Jibe world and upload it so you can explore it online with your friends.

In my Jibe world forest.

You can check out my own forest in my Jibe world.  Watch out for the bears!

-John “Pathfinder” Lester

ADDENDUM 7/18/2011:
Dave Pentecost recently posted in our Jibe-Unity3d Discussion Group about a very interesting app called TreePad.  It’s a fully featured interactive 3D tree modelling application for your iPad.

Creating a tree is as simple as painting on the screen while watching the tree grow into your stroke.  And it works great for creating trees you can pull into the Unity editor and then into your Jibe world.  Thanks for the excellent tip, Dave!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s