I’ve been doing tons research on modeling trees, during the last few weeks and it was about time I made something myself.

I faced a lot of problems with lightmap UVs and lighting in general, but I’m not going to write about it in detail, since I can’t even remember all the problems I had.

These are the steps that I followed for making the tree:

  1. Creating a tree trunk with big branches with Blenders sapling add-on.
  2. Unwrapping the trunk and texture painting it.
  3. Modeling a small branch with leaves, to be duplicated on the big branches
  4. Unwrapping the branch and texture painting it.
  5. Assembling the tree in Blender.
  6. Creating a lightmap UV for the whole tree.
  7. Exporting the model to Unreal Engine 4.
  8. Creating materials for the tree trunk, small branches and leaves.
  9. Enjoying the view 🙂

So here we go!

Step 1: Tree trunk

I’ve found out that the most efficient way to make a tree trunk is to use the sapling add-on in blender. Why? Because it gives me an easy way to control branch curves, thickness, lengths and their variations. I spent about 15 minutes to make this tree trunk.

tree_trunk

Step 2: Unwrap and texture painting

The next step is to unwrap the model (remove the skin to an image), so that I can apply a tree bark texture on it. Below is the bark texture I used for painting. I downloaded it from here. Below it, is the tree trunks UV (skin) before and after painting it.

TexturesCom_BarkDecidious0062_seamless_S

 

trunk_UV_No_color.png

trunk_UV_color

Step 3&4: Small branch with leaves

For the next step I had to model a small branch, make a leaf, duplicate it and connect the leaves to the branch.

I made a simple branch which splits in to two. Then I made a plane, which is divided in four subdivisions. I divided it to smaller sections, so that I can make the leaves a bit curvy.

branch and plane

Finally I applied a leaf image on the plane, unwrapped the branch like I did earlier with the trunk and painted it. Here is the result.

 

 

branch_ready.png

Step 5: Assembling the tree

This part was the most time consuming in the editor, since I was basically duplicating the small branch all over the tree trunk. After I found a good location for it, I scaled it to different sizes and gave it some rotation, so that all of the branches are not the same size and not pointing to the same direction. Enjoy the slideshow below!

Step 6: Creating a lightmap UV

This step didn’t take so much time in editor, but I spent days for the research. I tried many different variations and techniques for making it, but nothing seemed to work.

The purpose of Lightmap is very important. When you are building a scene, in for example Unreal Engine 4. There are lights and shadows from various sources. Every object that receives lights and shadows needs a lightmap. It’s basically the skin of an object in an image file where the game engine calculates and draws the lights and shadows. If you don’t have it, the object cannot receive light.

In my earlier projects I have just used a copy of the UV, that I use for painting. The problem is, that this model has three parts: trunk, branch and leaf. When I tried to import this model into UE4, it messed up my lightmap UVs, by placing them on top of each other, creating an lighting error. The solution I found was to join all the model pieces to one big model and to make a new UV channel for the whole tree. Below is the lightmap UV for the whole tree.

tree_UV_blog.png

As you can see, it’s really cramped and has a ton of stuff in it, so I was pretty skeptic about it. When I tried using it in UE4, I noticed that the build time was really short and I got zero errors. It looks stupid, but works. So it’s no so stupid 🙂

Step 7&8: Exporting the model and creating the materials

When creating models in Blender, that are used in game engines, you create a model, unwrap it and make textures for it. As far as I know, materials can’t be transferred from Blender to UE4. So the next step is to import everything to UE4 and create the materials for the model. I kept it really simple, because I’m not so good in creating materials yet.

Here is the model after importing it to my test world. As you can see it has no materials applied on it.

tree_no_material.png

Below you will see the leaf material I made. I had to make a mask using the leaf textures alpha channel, so that the game doesn’t display the background color. I also used the SimpleGrassWind node to make the leaves move a bit. I wanted to upload a short video of this wind movement, but unfortunately I can’t upload videos to my blog, since I’m not a paying user.

leaf_materialö.png

After I had the materials made, I just had to place a few of these in the world and take some screenshots.

trees_asd3trees_asd2trees_asdforest_2forest

I hope you enjoyed this post, because I learned a ton a new stuff while working on this project! Thanks for reading and feedback is always welcome! 🙂