![Image](http://mxsimulator.com/treehowto/Bob_at_Easel.jpg)
How to make happy little trees and keep your polygon budget happy too!
=== Making the Tree ===
First, make a leaf.
![Image](http://mxsimulator.com/treehowto/ss02.png)
Switch to object mode.
Make a linked duplicate of the leaf. (Object > Duplicate Linked)
You don't want to move the new leaf yet so press ESC to leave it where it is.
Move the duplicate to layer 2. (Object > Move to Layer...)
Switch to layer 2.
Make a bunch of linked duplicates of the leaf.
Scatter them along the Y axis.
![Image](http://mxsimulator.com/treehowto/ss03.png)
Create a cube. (Spacebar > Add > Mesh > Cube)
Rename the cube object to "twig", switch to edit mode and stretch/scale it to fit the leaves.
Switch back to object mode.
![Image](http://mxsimulator.com/treehowto/ss04.png)
Select the twig and all the leaves.
Add them to a new group. (Object > Group > Add to New Group)
In the "Object and Links" panel, change the group name to "twig".
![Image](http://mxsimulator.com/treehowto/ss05.png)
Switch to layer 3.
Duplicate the twig group. (Spacebar > Add > Group > twig)
Move/rotate it.
Add more until you have a good branch.
Select every other twig and move them to layer 4.
![Image](http://mxsimulator.com/treehowto/ss06.png)
Create a cube.
Rename the cube object to "branch" and stretch/scale it to form the main branch
This is going to be shared by both branch planes, so you shouldn't make the twig to branch connections with this object.
Make a linked duplicate and move it to layer 4.
![Image](http://mxsimulator.com/treehowto/ss07.png)
Create a cube. Use this mesh to connect the main branch to the bases of the twigs.
Switch to layer 4 and do the same thing for the other half of the branch.
![Image](http://mxsimulator.com/treehowto/ss08.png)
Switch to layer 3.
Rotate everything around the Y axis by -25 degrees.
![Image](http://mxsimulator.com/treehowto/ss09.png)
Switch to layer 4 and rotate everything around the Y axis by +25 degrees.
Shift+click layers 3 and 4 so they are both visible.
Select everything.
Add it to a new group. (Object > Group > Add to New Group)
In the "Object and Links" panel, change the group name to "branch".
![Image](http://mxsimulator.com/treehowto/ss10.png)
Switch to layer 5.
Add an cylinder and make a tree limb out of it.
![Image](http://mxsimulator.com/treehowto/ss11.png)
Duplicate the branch group. (Spacebar > Add > Group > branch)
Move/rotate it.
Add more until you have a good tree limb.
Select everything.
Add it to a new group. (Object > Group > Add to New Group)
In the "Object and Links" panel, change the group name to "limb".
![Image](http://mxsimulator.com/treehowto/ss12.png)
Switch to layer 6.
Add an cylinder and make the trunk out of it.
Add the limbs and move/rotate them into position. (Spacebar > Add > Group > branch)
If things get too slow, try changing draw type to "Bounding Box".
If it's still too slow, go to layer 5 and remove the branches from their group. (Object > Group > Remove from All Groups)
You should now have a tree that uses a few million faces.
![Image](http://mxsimulator.com/treehowto/ss13.png)
=== Adding the Low Detail Planes ===
Switch to layer 13.
Create a 2 sided plane.
Switch back to object mode, and make layer 3 visible. (Shift+click)
Switch back to edit mode.
Rotate the plane around the Y axis by -25.
Resize it so it fits the branch on layer 3.
Repeat in layer 14 for the branch on layer 4.
![Image](http://mxsimulator.com/treehowto/ss14.png)
Switch to layer 16.
Create a 1 sided plane and fit it to the complete tree on layer 6.
![Image](http://mxsimulator.com/treehowto/ss15.png)
UV unwrap everything but the leaf.
![Image](http://mxsimulator.com/treehowto/ss16.png)
=== Setting Up the Materials ===
Switch to layer 1 and select the leaf.
Select the shading panel.
Change the color to green.
![Image](http://mxsimulator.com/treehowto/ss17.png)
Switch to layer 2 and select the twig.
Add a new material, name it "textured".
Under "Links and Pipeline", enable "ZTransp".
Under "Material", enable "Shadeless".
Set the color to black (col, spec and mir), alpha to 0.
![Image](http://mxsimulator.com/treehowto/ss18.png)
Add a new texture, call it "colormap".
Under "Map Input", choose "UV".
Under "Map To", choose "Color" and "Alpha".
![Image](http://mxsimulator.com/treehowto/ss19.png)
Switch to the textures panel.
Set the texture type to "Image" and open/select your color texture.
Add another texture, call it "normalmap".
Under "Map Input", choose "UV".
Under "Map To", deselect "Color" and select "Nor".
Set the slider labeled "Nor" to 1.0.
![Image](http://mxsimulator.com/treehowto/ss20.png)
Switch to the textures panel.
Set the texture type to "Image" and open/select your normal map texture.
Under "Map Image" select "Normal Map".
![Image](http://mxsimulator.com/treehowto/ss21.png)
Add another texture, call it "x".
In the textures panel, set the texture type to "Blend".
Under "Map Input", choose "Nor".
Disable the y and z inputs.
Under "Map To", choose "Color" and "Neg".
Set the color to red.
Set the texture blending mode to "Add".
![Image](http://mxsimulator.com/treehowto/ss22.png)
Add another texture, call it "y".
In the textures panel, set the texture type to "Blend".
Under "Map Input", choose "Nor".
Set the x input to y.
Disable the x and z inputs.
Under "Map To", choose "Color" and "Neg".
Set the color to green.
Set the texture blending mode to "Add".
![Image](http://mxsimulator.com/treehowto/ss23.png)
Add another texture, call it "z".
In the textures panel, set the texture type to "Blend".
Under "Map Input", choose "Nor".
Set the x input to z.
Disable the x and y inputs.
Under "Map To", choose "Color".
Set the color to blue.
Set the texture blending mode to "Add".
![Image](http://mxsimulator.com/treehowto/ss24.png)
Now assign that material to all objects except the leaf and the duplicated objects/groups.
You now have all the required objects and materials set up.
=== Converting the Branches to Planes ===
Switch to layer 13.
Select the branch plane choose "Object > Group > Add to Existing Group > branch".
Do the the same in layer 14.
Switch to layer 3, select all and then "Object > Group > Remove from All Groups".
If you go to layer 6 the tree should now have planes instead of branches.
=== Setting Up the Camera ===
Switch to layer 1.
Select the camera and move it to layer 6 and then switch to layer 6.
In the Scene/Format panel, set SizeX and SizeY to fit the billboard area in your texture.
Set the format to PNG and RGBA.
In the Editing/Camera panel, set the camera to Orthographic mode.
Set the scale to the height of the billboard plane.
Bring up the tranform properties window. (Object > Transform Properties)
Set LocX to 0.
Set LocY to -30.
Set LocZ to 1/2 the height of your billboard plane.
Set RotX to 90.
Set RotY to 0.
Set RotZ to 0.
If you did it right, the dotted line that shows the camera border should match the billboard plane.
![Image](http://mxsimulator.com/treehowto/ss29.png)
This is a good time to save.
The next steps are either destructive or create extra junk you don't want saved.
=== Baking the Branch Planes ===
Switch to layer 3.
Select everything.
Choose "Object > Duplicate".
Move the duplicated objects to layer 13.
Switch to layer 13.
Select everything and choose "Object > Clear/Apply > Make Duplicates Real".
Deselect everything and choose "Select > Select All by Type > Empty".
Delete the empties you just selected. (Object > Delete)
Now select everything and make the branch plane the active object.
Switch to edit mode, select all faces and switch to your color texture in the UV/Image Editor.
Switch to the materials panel and uncheck the x, y and z textures.
![Image](http://mxsimulator.com/treehowto/ss26.png)
Switch to the render panel.
Under the Bake tab -
Set the bake type to "Textures".
Enable "Selected to Active".
Set "Bias" to 10.
Disable "Clear".
Now click "Bake" and it should bake the textures for those branch planes.
![Image](http://mxsimulator.com/treehowto/ss27.png)
Repeat the process in layers 4/14.
While in edit mode, select all faces and switch to your normals texture in the UV/Image Editor.
In the Bake tab -
Set the bake type to "Normals".
Set the normal space to "Tangent".
Click "Bake" and it should bake the normals.
Repeat the process for the other branch plane.
![Image](http://mxsimulator.com/treehowto/ss28.png)
=== Fixing Up the Normals ===
If you like, you can now use a paint program to extend the edges of the normal map into the transparent areas of the map. This will keep the flat background from bleeding into the leaves in lower detail mipmaps, which will flatten out the shading.
![Image](http://mxsimulator.com/treehowto/extendednormals.png)
=== Rendering the Tree Billboard ===
In the Scene/Render panel, make sure "Key" is on.
![Image](http://mxsimulator.com/treehowto/ss30.png)
Click the render button to render the color texture.
Save the rendered image.
In the "textured" material, check the X, Y and Z textures.
Select the "colormap" texture and under "Map To", deselect "Col".
Click the render button to render the normals texture.
Save the rendered image.
Copy the billboard renders into your textures.
=== Exporting the Models ===
We've been working with the Z axis as the up vector instead of the Y
axis like MX Sim uses, so you'll need to rotate 90 degrees around the
X axis before you export.
Export tree billboard like any other model.
For the full detail tree, select everything and make the duplicates real. (Object > Clear/Apply > Make Duplicates Real)
Deselect all and then select the empty objects. (Select > Select All by Type > Empty)
Delete the empty objects. (Object > Delete)
Now select the tree limbs and trunk, with the trunk as the active object.
Join the objects. (Object > Join Objects)
The tree is now ready to export.
=== Smoothing the LOD Transistion ===
To reduce popping you might want to make some extra LOD's to smooth out the billboard to 3d transition.
If your tree is named "tree.jm" and the billboard "tree_lod8.jm",
you want some LOD's just under 8 that progressively have their Z coords flattened out, but keep the original normal values.
To do that, you can use this one liner in a Linux shell, or you could use a spreadsheet to do it.
Code: Select all
(for ((i=1;i<=9;i++)) do awk '{ if (NF == 8) { print $1, $2, $3 * (1-'$i'*.1), $4, $5, $6, $7, $8 } else print}' <tree.jm >tree_lod7.$((50+i*5)).jm ; done)
tree.jm
tree_lod7.55.jm
tree_lod7.60.jm
tree_lod7.65.jm
tree_lod7.70.jm
tree_lod7.75.jm
tree_lod7.80.jm
tree_lod7.85.jm
tree_lod7.90.jm
tree_lod7.95.jm
tree_lod8.jm
Download the blend file and textures/exported models here.
A couple of things you might want to try now:
- Make the tree go to planes at the twig level instead of the branch level. This will look better but use a lot of extra geometry.
- Use more than one material for the leaves to vary the color more.
If there's anything in here that's hard to understand, let me know and I'll try to improve it.