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:
- Creating a tree trunk with big branches with Blenders sapling add-on.
- Unwrapping the trunk and texture painting it.
- Modeling a small branch with leaves, to be duplicated on the big branches
- Unwrapping the branch and texture painting it.
- Assembling the tree in Blender.
- Creating a lightmap UV for the whole tree.
- Exporting the model to Unreal Engine 4.
- Creating materials for the tree trunk, small branches and leaves.
- 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.
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.
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.
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.
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.
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.
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.
After I had the materials made, I just had to place a few of these in the world and take some screenshots.
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! 🙂