mikebart 1 Posted January 1, 2009 Hey guys I've just finished writing part 1 of a 2 part tutorial about making foliage and trees, not sure why my thumbnails dont work on this forum, ill eventually convert this to a pdf but for now ill just post it up here. Tutorial: Modeling an Elm Tree. 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 seperation 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 usefull 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. Contents: 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 bascally cut out some leaves from photos, made a quick normal and specular map for them and UVmapped them onto the same model, then made aterations 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. http://i396.photobucket.com/albums....mg] You can either use these textures below, or make your own: http://i396.photobucket.com/albums....mg] http://i396.photobucket.com/albums....mg] http://i396.photobucket.com/albums....mg] 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. http://i396.photobucket.com/albums....mg] 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. http://i396.photobucket.com/albums....mg] http://i396.photobucket.com/albums....mg] http://i396.photobucket.com/albums....mg] 1.4 Add leaves to twigs. http://i396.photobucket.com/albums....mg] 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 horozontally 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 seperate layer and instance off of them. http://i396.photobucket.com/albums....mg] 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. http://i396.photobucket.com/albums....mg] once you've finished group the peices 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 http://i396.photobucket.com/albums....mg] 1.6 Arrange leaves and twigs onto small branches. http://i396.photobucket.com/albums....mg] http://i396.photobucket.com/albums....mg] Below, Small branches ready for render. http://i396.photobucket.com/albums....mg] Instance the twig and leaves groups and start arranging them onto the small branches. In the image above you can see the peices 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 acuratly at this stage due to the fact that you cant really see where things are going to be positioned because you havent 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 usefull 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. http://i396.photobucket.com/albums....mg] 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 proccess 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 familierize yourself with this technique, particually 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 origional, add a projection modifier, pick the origional 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: http://i396.photobucket.com/albums....mg] 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' dialogue box, once its done rendering You should now have a diffuse, specular and normal map in the specified folder. http://i396.photobucket.com/albums....mg] 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' dialogue box again and add another diffusemap. Name it 'myfoliage_alpha' turn off lighting and shadows and disable the origional 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. Share this post Link to post Share on other sites
.kju 3245 Posted January 1, 2009 hey mikebart impressive tut and BIG THANKS for sharing! Use http://pixload.org/. The forum works with its thumbnails. However note that 100 KB limit per pic and 6 pics per post limit. best regards .kju Share this post Link to post Share on other sites
mikebart 1 Posted January 1, 2009 ah ok, thanks Q, ill definitly pdf it, seems to be the best way, if you want to check it out with thumbnails i posted it on Armaholic.com here Share this post Link to post Share on other sites