Forum Jump :

Author Message

Posts: 19

Level: Member

Country: au
Location: Melbourne
Age: 40
In-game name:

#1 Posted at 2009-01-01 11:16        
[size=2]Tutorial: Modeling a Tree[/size]


Original topic at BI forums:

Things you need to have:
- 3dsmax
- Photoshop or Gimp

Things you need to know:

Tutorial: Render to texture with multiple texture maps using the projection modifier in 3dsmax By mikebart

The difference between this tutorial and the more common ones out there regarding high to low poly projection baking is that it also covers rendering out more than just a normal map, you can also render diffuse, specular, ambient occlusion, lighting, shadows and masks, which are useful for component separation e.g 'bricks and mortar' or in this case 'branches and leaves'.

Creating A Normal Map Right In Your 3D App by Ben Cloward

This is a very useful technique, by setting up coloured lights in a scene you can render normalmaps strait out of your veiwport, it also enables the rendering of alpha planes, so that you can render the high lod model foliage down to the lower lod model foliage.

Part 1: Modeling the high poly leaves and branches.

1.1 Setup your layers.
1.2 Model the leaves.
1.3 Model the twigs.
1.4 Add leaves to twigs.
1.5 Model the small branches.
1.6 Arrange leaves and twigs onto Small branches.
1.7 Set up some lights.
1.8 Collapse and attach geometry. (optional)
1.9 Render to texture using the Projection modifier

Part 1: Modeling the high poly leaves and branches.

1.1 Setup your layers

1.2 Model the leaves.

I've basically cut out some leaves from photos, made a quick normal and specular map for them and UVmapped them onto the same model, then made alterations to each model to give them some variation.
Name the leaves, 'leaf_high' and add them to the 'Control Meshes' layer, then make instances of them and add them to the 'HighPolyLeaves' layer. You can use the control meshes to swap out leaves and twigs to change the type of tree.


You can either use these textures below, or make your own:

3-elm_tree_tutorial_02.jpg 3-elm_tree_tutorial_03.jpg 3-elm_tree_tutorial_04.jpg

1.3 Model the twigs.

Model a variety of twigs that can be used in different ways to help make the foliage look interesting and sporatic.
Be sure to study photographs of branch structures and take note of how they grow and how they might break down into smaller parts.
Name the twigs, 'twig_high' and add them to the 'Control Meshes' layer, then make instances of them and add them to the 'HighPolyBranches' Layer.


If you photograph a tree yourself, get underneath and take some good upward shots of branch formations.
Texture the twigs Using the trunk textures below or create your own.

3-elm_tree_tutorial_06.jpg 3-elm_tree_tutorial_07.jpg 3-elm_tree_tutorial_08.jpg

1.4 Add leaves to twigs.


You dont need to be a tree expert to figure how foliage for a particular tree is structured visually, be observant, take simple mental notes like for example, "Elm leaves usually point downwards and out diagonally when in large clusters, but when the branches/twigs reach outwards horizontally they can point in other directions and be more sporatic."
Set the pivot point of all the leaves to where they join onto the twig. Remember to instance your leaves, then you can make alterations to them later on, for example if you wanted to change the type of tree, you could simply swap the leaves out with another and change the twig texture. Keep control meshes on a separate layer and instance off of them.


Now repeat this step on the other twigs. Notice how in the image below Ive made a variety of small clusters all going in different directions, some hang down, some reach out wards and upwards, and then there are a few clusters in there which are great for fill.


once you've finished group the pieces individually, so you should have about 13 groups.

1.5 Model the small branches.

These branches should be reasonably low poly, i'd recommend about 150 tris, these will be used in the high lod of the tree model.
Name the small branches 'smallBranchLod0_' and add them to the 'BranchesLod0' layer


1.6 Arrange leaves and twigs onto small branches.

3-elm_tree_tutorial_13.jpg 3-elm_tree_tutorial_14.jpg

Below, Small branches ready for render.


Instance the twig and leaves groups and start arranging them onto the small branches.
In the image above you can see the pieces that will be rendered to texture for the high level of detail, make sure you have a good variation of branches for different situations much like in step 1.2.
You'll notice that the 4 foliage clusters on the right hand side have no small branch model, these are used for filler, while the 4 on the left with small branches are more structural and will always connect to a larger branch.
Group the branches and foliage clusters, so now you should have 8 groups.
Go into front view, Draw a square plane, colour it green (or your foliage colour) and arrange the branches and foliage clusters inside of the plane. This plane represents your UV space, so be careful not to overlap geometry and be just as careful not to waste UV space by having the branches and foliage clusters too far apart.
Judging how much UV space to use right now can be a bit tricky and It would be pretty difficult to plan out accurately at this stage due to the fact that you cant really see where things are going to be positioned because you haven't made them yet. One advantage you do have though is that when you make the lower lod levels you're going to be able to scale them down to fit onto the map relative to the size that those planes will appear ingame.
So, as you can see in the picture above I've used about just under half of the UV space, we'll be rendering out to 2048's so they'll still have plenty of pixel density.

Now you should have a fully instanced arrangement of foliage with control meshes, save this scene seperatly before you carry on any further, you might find this scene useful in the future for making other types of trees.

1.7 Set up some lights.

Place 2 directional lights pointing at around the center of the plane, like shown below, select the top one and turn on shadows. For the rest just follow the settings provided in the image below.
Now select the bottom light, leave shadows off, set the multiplier to 0.2.


1.8 Collapse and attach geometry. (optional)

Now that you've saved the instanced scene and are working on a different file, make all the geometry unique (non instanced), by ungrouping and converting all geometry to editable poly and then attaching them accordingly.
This is more of a scene management decision which is probably best left for you to make yourself, 3dsmax runs faster when you've got less objects in a scene, instanced or not. Also, if you have too many objects to add to the 'pick list' in the projection modifier it can become too large a process to handle resulting in 3dsmax running out of memory and crashing, and you cant pick groups from the projection modifier, only objects.

1.9 Render to texture using the Projection modifier.

Tutorial: Render to texture with multiple texture maps using the projection modifier in 3dsmax

Make sure you familiarize yourself with this technique, particularly steps 3 and 7, the biggest differences between the tutorial in the link above and what we're doing in this tutorial is that with the tree foliage we're only working on a flat plane so in some ways its a bit simpler, but we'll also be rendering for an alpha channel.
Select the square plane, (the one you created in step 1.6), make a copy and drag it behind the original, add a projection modifier, pick the original plane to add it to the reference geometry in the projection modifier panel, and pick the small branches.

Push the Cage out past all the geometry, now your scene should look something like this:


press '0' to open the 'Render to Texture' dialog box, add a diffuse, specular and normal map, open options, then Global Supersampler 'Setup' then tick the box 'enable Global Supersampler'
Now click the 'Render' button at the bottom of the 'Render to Texture' dialog box, once its done rendering You should now have a diffuse, specular and normal map in the specified folder.


Assign a full black colour to the background plane (not the projection plane), open the material editor and tick off the diffusemap from the leaf and branch textures that are assigned to your high poly models.
Open the 'Render to texture' dialog box again and add another diffusemap. Name it 'myfoliage_alpha' turn off lighting and shadows and disable the original diffuse, specular and normal map from rendering by ticking off the 'enable' boxes, and disable 'Global Supersampling'.
Hit 'render' and open the diffuse map and alpha map in Photoshop, put the alpha map into the diffusemaps alpha channel and save it as 32 bit.

Thats the end of part one and thats all the Projection rendering you'll have to do for this little project, in part 2 ill cover loding and building the rest of the tree.

This post was edited by mikebart (2011-02-04 05:35, ago)

Author Message


Armaholic icons master

Posts: 5559

Level: Former Staff

Country: es
Location: Who knows
Occupation: Industrial Engineer
Age: 45
In-game name:

#2 Posted at 2009-01-02 07:45        
Thanks for posting the info here, we made a news post about this nice first part on the homepage and also added your tutorial to our Addon editing tutorial FAQ. :thumb

This post was edited by Foxhound (2009-01-02 10:14, ago)