Home Technical Talk

Best Practices for Creating 3D Trees for Games

First of all, I apologize if a thread on this topic already exists. Feel free to link me to it.

I've done a search of this forum and google and while I find occasional discussions on the subject, I haven't found a source that provides definitive information. For instance, I have found advice regarding tree tri-counts really ranges. Are there tri-counts that are common and expected for trees, or is it mostly dependent on the nature of the project and the use of the tree (like other meshes)?

Also, I'm curious to know if there are any industry standard practices for producing best results, especially for procedurally generated trees. What is the best way to flesh out and fill out the crown of a tree? What is important to consider when creating convincing shaders for bark and leaves? Are there any pitfalls that are common that I should be careful to avoid?

Feel free to connect me with any favorite tutorials. Thank you for your time!

Replies

  • Macattackk
    Offline / Send Message
    Macattackk polycounter lvl 7
    yay polycount:
    http://wiki.polycount.com/CategoryEnvironmentFoliage

    3dmotive has a good tut on foliage creation

    speedtree is a program good for that and theres plugins for max etc.
    those kinds of things should be on the wiki if i remember correctly

    im actually curious on finding out about any good bark texturing/shader tutorials as well.
  • Eric Chadwick
    Like you said, tri count really depends on the game type, and how many trees are onscreen at once. MMOs typically go really low, because there can be a ton of performance-demanding character assets in view at the same time. FPS's on the other hand tend to have tighter enclosed spaces, so a "hero" tree can be pretty high resolution.

    Crown depends on the tree type, but sometimes it helps to add a specific alpha texture to your sheet for the crown pieces. Like a scraggly branch texture for the top of a pine tree, place three or four of those at the top and it looks pretty good. Can also reuse that lower on the trunk for dead mini-branches.

    For a forest, it is helpful to reduce the drawcalls, which usually means packing all the textures into a single sheet and using a single shader for the whole tree. The bark can be tiled, and the mesh can be subdivided everywhere the texture tiles, so you can split the UVs there. Or you can layout the texture so the bark runs vertically all along one edge of the texture sheet, so it tiles vertically.

    Bending the vertex normals can help a ton with tree shading. I put some stuff here. http://wiki.polycount.com/VertexNormal#Foliage_Shading

    A common pitfall I've seen is to make trees totally straight. Another one is to use crappy shading. Another is to not add dead branches, which can add a lot of naturalness to trees. Another is to use an alpha that is too dense... alpha works best when foliage has a lot of empty space between the leaves, especially for the mips (distance filtering) but also for dynamic shadowing, and silhouette.

    A big help is to closely examine the trees in a game you like, try to figure out how they're made. Load them in the game editor, or use a 3d extractor to grab models and textures.
  • Eric Chadwick
  • almighty_gir
    Offline / Send Message
    almighty_gir ngon master
    and battlefield 3 for example, has most of their trees on .DDS textures. they look fine from a distance but up-close it's just nasty.
  • [HP]
    Offline / Send Message
    [HP] polycounter lvl 13
    http://www.crydev.net/dm_eds/download_detail.php?id=4

    Check out the source sample assets for vegetation, it might give you a few leads.
  • Eric Chadwick
    DDS is pretty standard for PC games, and DXT1 compression is a necessary evil for most of us, not just DICE.

    Also, check out this one from the wiki page Macattackk posted...
    Vegetation Procedural Animation and Shading in Crysis - by Tiago Sousa
    A detailed overview of Crytek's process for vegetation shading.
  • Bunglo
    Offline / Send Message
    Bunglo polycounter lvl 16
    Vegetation is super tricky to get right, like stupid retarded tricky.

    Just to echo what Eric said, pick some foliage of a game you really like and start breaking it down and figuring out how they went about each step.

    When I started using CE2 a few years back, I could not get over how awesome the vegetation was in Crysis. I pretty much focused all my hours on trying to reverse engineer their trees, grass, bushes, etc and time after time I produced crap. I'm talking vomit inducing stuff here BUT! I learned a ridiculous amount with each "failed" attempt.

    If you can find a game that has an editor and viewable assets and textures, such as Crysis 1/2, everything becomes a lot clearer. When you try and recreate a piece of foliage you saw in a game that you can only examine when in-game, it's a bit like trying to feel your way through the dark. It's still doable but it'll most likely take a lot more trial and error to get on the right path.
  • iniside
    Offline / Send Message
    iniside polycounter lvl 6
    Bah. Creating tree it self is suprisingly easy. It's some spilnes tosed around and bended in random directions.
    The tricky part is to create good looking branches textures, leaf clusters and so on. This is biggest time sink to get them right.
    And there are few options:
    1. Take camera, go to forest, cut some branches of tree, take photos on them. Easiest way, giving nice results.
    2. Grab an reference of branch, model it,and bake it. You can use spline to model trunks, and then particle system to distribute leaves, or object paint to paint leaves. In my honest opinion both are equaly bad, and you will have to adjust all leaves manualy anyway. But at least they are placed.
    3. Buy yourself an GrowFX plugin for 3ds max. It's about 300$. Not as ridiculusly expensive as SpeedTree. Not a cheapest thing either (depending where you live and what are you doing anyway).
    It's high-poly L-System modeling for any foliage you can or can't imagine. I've been using it to grow small branches, and then bake them.
    Except for point 1 it's easiest and fastes way to produce tree. It might look compilated at start and it take some time to learn it, but after all is not that hard. IMO it's best foliage modeling tool on the market.

    As for other tips:
    1. Do no try to model realistic tree. You will fail badly each time. And it will never look good in game.
    1a. Trees should have enough negative space to cast nice shadows, and allow sun to cast nice sun-rays when you look trough tree. In real world, trees(especially bigger ones) are pretty solid and cast pretty solid shadows. Try to avoid it as much as possible.


    That's for theory. Now I'm going back to 313 failed tree attempt :D
  • Eric Chadwick
    iniside wrote: »
    ...
    2. Grab an reference of branch, model it,and bake it. You can use spline to model trunks, and then particle system to distribute leaves, or object paint to paint leaves. In my honest opinion both are equaly bad, and you will have to adjust all leaves manualy anyway. But at least they are placed.
    ...

    This is IMO the best way to go. I've worked hard to get the other approaches to work well, but they just don't cut it. We have a tutorial here from a super-talented team member in China, she uses exactly this approach, and the results are excellent. I wish I could share it. I'll ask.

    In the end, no matter which way you approach it, you just end up needing artistic talent to make good-looking real-time trees. I think a lot of the challenge for people is in designing the composition, the layout and pruning of the tree.
  • Bunglo
    Offline / Send Message
    Bunglo polycounter lvl 16
    I've also gotten the best results via the 2nd option. I personally prefer to use object paint as opposed to a particle system, I'm too slow with them and I'm always left wanting with the end result. Obviously you have to hand tweak but I get the results I want quicker with object paint.

    Also, the branch tool is pretty nifty, it saved me so much time compared to when I would hand tweak my branches from splines.

    Ryan's treegen script (3ds max) has also come in handy: http://www.polycount.com/forum/showthread.php?t=93240

    To touch on what Eric said regarding composition, observe what ever plant you're making and try to determine how it's grouped:

    - Main branch that everything grows from.
    - Smaller branches that grow from the main.
    - Even smaller Branches that hold the leaves.
    - Leaves on smallest branches.

    Here's an example of how you can create a few groups of leaves and paint them on the correct branches to create the entire tree branch:

    HZLWz.jpg
    Zlnc9.jpg
  • Eric Chadwick
  • iniside
    Offline / Send Message
    iniside polycounter lvl 6
    Thanks Bunlgo. You screen showed me fundamental flaw in my workflow. I started from big branch and gone to small detals. While I should start from small details and then add them to bigbranch.
  • ephemeratics
    Sorry for the delayed response. Just got back from a weekend Hackathon.

    Wow, thank you for all the tips, links and feedback! I'm going to go through all this information with a fine-tooth comb.

    But I wanted to say thanks first! This is AWESOME!
  • ephemeratics
    Macattackk: Thanks for referring me to the Polycount Wiki. I don't why I didn't stumble upon this sooner. But now I know! Also, since I'm working with Unity's Tree Creator, this tutorial seems very relevant: http://www.unifycommunity.com/wiki/index.php?title=TreeCreator_Tutorial

    iniside: "Do no try to model realistic tree. You will fail badly each time. And it will never look good in game." By this, I presume you mean a game artist should not try to recreate a tree from nature exactly (for instance, from photographic source), but use the source as a general idea for the basic tree shape/ properties. Since trees are so complex, this makes a lot of sense to me. However, I find this advice interesting considering that, in my experience, when it comes to other meshes, the artist's goal is usually to try to match the photo or concept art as exactly as possible. Are trees usually treated as exceptions to this standard, or does it really depend on the project?

    On another note, I'm intrigued by this concept of building and baking branches. Using photograph branches seemed like a natural first option, but I could see a benefit to building and baking your own... for presumably more accurate normal and ao results?

    Eric Chadwick: Thanks for all your feedback! I would be curious to see your colleague's tutorial, if possible.
    I suppose making 3D trees requires much of the artistry of a bonsai master!

    Bunglo: Wow, thanks for providing visuals. This really helped me understand some key points being discussed. Working from small to large makes a lot of sense.

    Thanks again, to everyone!
  • ZacD
    Offline / Send Message
    ZacD ngon master
    Working for branch photograph is a pain unless you find a magic image that works perfectly, which isn't going to happen unless you cut off a branch and take a photo with even lighting and a easy to mast background.
  • Eric Chadwick
    Pulling an alpha mask from a bkg color is tough, you have to hand-paint a good amount of the alpha. Also the background color tends to bleed into the leaves and bark. So using a red or blue sheet isn't a good idea.

    For a good silhouette and an alpha that isn't too dense, you want a flat wide branch with few overlapping leaves. Not easy to find.

    Making a normal map from a photo can look OK, but it's not sharp and clean like geometry.

    iniside's suggestion about not modeling a realistic tree is nonsense. Take a look at this forest mod.
    http://www.crydev.net/viewtopic.php?t=44230
  • Eric Chadwick
    Another example, not your typical Crytek jungle trees.
    crysis2011011509375100.jpg
  • iniside
    Offline / Send Message
    iniside polycounter lvl 6
    iniside: "Do no try to model realistic tree. You will fail badly each time. And it will never look good in game." By this, I presume you mean a game artist should not try to recreate a tree from nature exactly (for instance, from photographic source), but use the source as a general idea for the basic tree shape/ properties. Since trees are so complex, this makes a lot of sense to me. However, I find this advice interesting considering that, in my experience, when it comes to other meshes, the artist's goal is usually to try to match the photo or concept art as exactly as possible. Are trees usually treated as exceptions to this standard, or does it really depend on the project?
    Yes. You should use an tree photo as general reference to see how tree grow. But is that important. Most trees looks pretty much the same. With big excpetions like Acacia or Baobab. Remember all nature grow in L-System (look on google, "L-System", Fractals), stick to this while you modeling and you will be set good for most of the times.
    Problem with trees is that, if you want to model exactly what you see, you will far exceed any resonable poly count for game.
    Of course let's say Caucasian Spruce have very characteristic look and you want to catch it as close as possible, but if you overdo, you will end up with messy mesh that doesn't look intresting, and doesn't add any intresting lighting effects to scene.
    It's all about making good looking branches (or leaf clusters). If you have done them, 80% work is done, and rest is just fun.
    iniside's suggestion about not modeling a realistic tree is nonsense. Take a look at this forest mod.
    http://www.crydev.net/viewtopic.php?t=44230
    I disagree. Those as far from what I consider as realistic. You should try catch general tree shape, and make it look intresting in first place.
    Unless you think that by not realistic I mean trees bended in 720 degree angles in all directions :D
  • Blubberblase
    Offline / Send Message
    Blubberblase polycounter lvl 7
    i don't know if any of you know this script but i found it to be very nice for low and highpoly trees

    you can create your leaf texture with it and your tree for your game

    http://www.scriptspot.com/3ds-max/scripts/avizstudio-tools-atree3d
Sign In or Register to comment.