Tree Setup

From Blue Mars Developer Guidebook

Jump to: navigation, search
There are security restrictions on this article

Back to Blue_Mars_Asset_Creation

Image:BlueMarsTrees.jpg To create custom trees for Blue Mars use the following guidelines and instructions to ensure that your trees work well in the engine and keep the established look. Installing the Leaf Generator First unzip File:LeafGenerator.zip to the Scripts\startup folder in your 3DSMax Directory. To access it: go to utilities and click the MaxScript button (if you don't have one click the Image:utilitybuttons.jpgbutton, increase the number Total Buttons: then find MAXScript under MAX STANDARD in the Utilities List box on the left. Now drag the MAXScript Text onto your new blank button on the right. Click OK.) In the drop down box select Leaf Generator (if it's not there you put it in the wrong directory or need to restart Max, the alternative is to click Run Script, find where you copied it and run it). The Leaf Generator will help you create geometry for your canopy. We'll come back to it in a bit. The things we'll be creating are:

  • A Trunk with branches
  • Leaves
  • Collisions
  • LOD's
  • A multisub that contains at least 3 materials
    • Physics Proxy
    • Trunk
    • Leaves
    • (optionally) Branches
Initial Setup Trunk Now you need to create a good trunk for you tree. I prefer Houdini for this but make sure you get UV's exported with your obj. As a standard we like to have some nice root structure, but aside from that you can probably get away with a trunk made of 6 sided cylinders and it should contain the main trunk and only the largest branches, maybe 7 or 8 max. As long as smoothing groups are set up appropriately it will look nicely round, and your normal map on the trunk will take care of variation. So the keep LOD0 of your trunk around 300-500 triangles. Make an LOD1 at approximately half that number. Now we need to set up some leaves. Branches We'll want to make 3 unique branches before we continue.
  • Inner Branch - this branch will be a large vertical one to add some volume to the middle of our canopy. You can simply create a plane with no segments it should be about the size of the height of the canopy (bottom of the canopy to the top of the canopy). Now just grab opposite corners and pull them up to create a good sized bend. Maybe 30 degrees. Next set up the UV's so that the map of your branch is diagonal (you may want to make it tile to create the impression of more leaves, this will be so deep in the tree no one will notice the tiling). Now the most important step for this branch is to set the Vertex Alpha to around 30. This will make the branch appear very dark in the engine. Now we'll make a medium depth branch that will act as the major volume of our canopy.
  • Middle Branch - this branch should be fairly large, somewhat smaller than the inner branch but you can make it large enough to tile the texture. This branch should be made of a plane composed of 4 triangles. That way the middle can be pulled out to make a bit of a cup. This will add a lot of volume. Now just set it up like the inner branch and set the vertex alpha to about 60.
  • Outer Branch - this branch is just to give variation in to the canopy and give the impression branches poking out. This one is shaped like the middle branch but it needs to have only 1 branch mapped to it (or not have noticeable tiling). The vertex alpha for this one should be set to 100.
Textures Speaking of the material we have a few places to get it from. First we can use the textures created from NatFX. NatFX will save them out when you save your .max file (you'll need to change the directory where they are saved in the NatFX menu in Max) then you'll need to find them in explorer, convert them and their normal maps to CryTif and fix the MultiSub in max to only have 3 materials. Apply the first material to trunk, second to the leaves and set the 3rd up for the physics proxy (you can add another material for branches if you decide to have clip map branches). Second you can make your textures from scratch, if you do try to start with a good picture of a branch of the type of tree you are making, if you don't have access to a picture you can paint it. The branch should be of the thinnest sort that the tree has, the one that the actual leaf stalks are attached to. The best ones are branches that have leaves all the way down them and the leaves don't overlap. This way you can create variation in the normal map. If your tree type tends to have clumps of trees you'll have to create different normals for each leaf in your normal map. If you have to do this (I don't envy you) then take your diffuse texture into Photoshop, create 2 layers on top of it. On one layer paint different values of red on random leaves. Make sure you are using pure red, no other colors mixed in, just in different values. Now on the other layer paint different values of green on random leaves. Again make sure its pure green. Now you want to set those layers to linear dodge (add). The idea here is just to get some variation, don't worry too much about getting too much detail in here since you won't see most leaves up close. Leaf Generator Plugin Now select your leaf object and run the Leaf Generator script (following the directions at Installing the Leaf Generator) Image:LeafGenerator.jpg Now let's go through the options on this rollout.
  • Random Seed - the random number generator in max will output the same series of numbers every time you restart MAX (it works ok if you never exit and restart). So to get different results you need to put in a number here to work as the random seed. Keep it between 1-100, other values may work, but you really don't need them.
  • Instances - This is how many instances of your leaf object you want to create. You might want to play with this for your tree but think of it in terms of how it relates to how many times you tiled your UVs. if you tiled them 4 times 100 is probably fine for a big orchard tree. If you only have 1 tile on your leaf object you'll want this up somewhere around 400. Personally I find going with the bigger leaf object with multiple tiles and only 100 instances works out the best.
  • Tree Type - Right now there are 3 tree types which will duplicate your leaves in different ways. The rest of the options work differently for each type so I'll explain them separately.
Image:Conical.jpg
    • Conical - This will basically make a cone of your leaves. This makes nice cypress or pine type trees. Might want to stick to the lower tiling smaller leaf objects for this one and crank it up instances to like 300. The following is a description of how to use the options for Conical.
      • Inner Radius - This will determine the interior radius of your cone, this will also be the size of the point at the top
      • Outer Radius - This is how large the largest part of the foliage will be. This will be the radius of the base of the cone.
      • Z Offset - The cone of leaves will be generated using the existing leaf object as the center point. So this number is HALF the total size of the foliage.
      • Rotation - These values are the axis to be rotated about. To keep the normals facing away from the trunk I used the rotation of the Z axis to determine XY position values. X and Y rotation values will just rotate your foliage in place on their respective axis (in most cases keep these 0-15, anything more can end up turning your normals wrong).
Image:orchard.jpg
    • Orchard - This will make a big canopy of leaves over your tree shaped like a parachute, this is a little harder to control but once you get used to how to use some of the hidden functions you can make a large variety of trees, from banyan to oak to juniper. You can get very good results with very big leaf objects with lots of tiling on these trees, or if you are doing a special case (like a bonsai scene or really gnarly tree) you can use the smaller leaves and just dump hundreds of instances into it. This has some slightly different options.
      • Offsets - Again I used the leaf object as the center of the canopy so the offsets are all amount in any 1 direction to offset from the leaf object. There is one slightly hidden effect you can get with the orchard tree. If you move you leaf object from the origin you can change the radius of the curvature of the canopy. Basically this will create a parachute shaped canopy, perfect for tropical deciduous trees. If you want a tight dense canopy put the leaf object closer to the origin. I highly suggest you play around with this as you can get some really nice effects.
      • Rotation - Since the orchard type tries to make a ball of leaves we need a way to limit how much of the ball is used. Rotation is the way to do that. X and Y Rotation determine how many degrees in each direction the ball will be generated, Z determines how much variation our leaves will have in the direction they are facing. 0 means they will uniformly face away from the trunk, 180 means they will face in lots of different directions. Note that they will still tend toward facing away from the trunk so if you want them to face down or in, you should change the normals to face that direction.
Image:modified.jpg
    • Modified - This was a test that ended up working out pretty well for something, I just don't know what yet. Basically you just get a little more variation in the depth of the canopy. Note that this option will tend to create a box of the canopy.
Final Steps Depending on where you created your canopy (right on the origin or a little way up the tree or whatever), you may need to move it to where it belongs on the tree. You now have a bunch of objects in your scene you should be able to move them about. The leaf generator is a good tool to get you close, but don't get lazy, use your artistic eye to move leaves around so they seem to naturally follow branches etc... The point here is that you should move these guys around before you merge them all. Once your tree looks how you want select your trunk, then use the use attach list to attach all the leaves. Personally I leave my original leaf object separate in case I want to make more variations. If you decide your tree could do with some dead branches or other ornaments just create another plane with your branch mapped on it and copy it around where it belongs. Then attach it to your trunk just like you did with the leaves. A note on vertex colors here. I've found that for most tree types you want to leave all of the vertex colors white on your leaves. If you use branches you might want to change their vertex colors to black. White verts will act like leaves, black verts will act like branches. If you didn't create any LOD's before you'll want to at least duplicate your tree and put an optimize modifier on it. Delete some of the interior leaves and branches. Whatever, but try to keep the same general shape and thickness. Name this tree to $lod1, link it to your original tree. You should make a few more of these, reducing the number of polies as much as possible without changing the overall shape of your tree, by $lod3 you should be at 300 polys. Don't worry about reducing the number of material ID's, just try to make the transition from one LOD to the next as seamless as possible. You really should work between the engine and max to get this right. Back to Blue_Mars_Asset_Creation
Problems with this wiki page? Contact us either by: Support Email or Support Ticket System

Blue Mars Guidebook Privacy Policy
Blue Mars Guidebook Community Guidelines

Personal tools