Witness Trees

Hi, I'm Shannon and this in my first blog post about The Witness. I'm currently the only 3D artist working on the game and this post is about game trees... both the ones I'm making and game trees  in general.

I've worked on trees for games over the years, and I've come to a conclusion: There's no good way to make them currently. Trees reject the idea of low poly versions of themselves by their very nature, and what you're left with is many unsatisfactory ways of making them. It's up to the artist to pick which one of these techniques to use and to do their best to make it work. That choice depends on a lot of things. Does it have to be real-time, or can it be pre-rendered? Where will the player be when he sees the tree? Up close, far away, underneath, from above, or (in the worst case) all of these? Will there be a few trees or a forest of them? Then there's the engine constraints.  Overdraw, poly counts, texture space, LOD systems, lighting and light maps; all these affect how the trees need to be created. And none of that is even scratching the surface on the style you want the trees to have.

Still, I like a challenge as much as the next person.

Here's an early visual mockup of the game that contains some trees. I didn't actually make this, but it did give me some direction is where to go. As you can see, the trees are very colorful and full of volume. I wasn't sure how close I could get to this, but I was going to give it a try. The problem with most low-poly game trees is that they are made with large sheets of polygons with branch and bough textures on them...and while this is certainly a way of making game trees, they usually can't be considered volumetric.

The current trees I have right now started from a lucky accident. Early on the engine couldn't handle alpha maps, so I want to make a bough structure that would look vaguely leafy without being too many polys and without using opacity maps. That's how I came up with this.


It's basically a ton of triangles sitting in a bowl. The bowl is there to simplify the bottom and hide the triangle nature of the triangles. It worked fine for the time I needed it. Recently I started adding a bunch of trees to the world and I wanted something fairly lightweight for even the large trees (the one I had done just before that was 40,000 polys, which was way too big). So I went to the old non-opacity tree, added some opacity maps and tried it out. And, surprisingly, it worked really well. It was giving me a volume I didn't expect, and it looked really good at a distance.

Not only that, I took a look at them with only the lightmaps on and the structure looked really nice...especially the branches underneath.

They were still too heavy though, being 12 thousand polys. Worse, they looked really bad up close and you could see that, what read as a nice, thick foliage from a distance, was really a mess of triangles.

So the past few days I've been trying to make the trees look better from a close distance and be lower poly without losing what I liked about the previous ones. After a bit of struggle, I got something that seems to do the trick. Ignacio helped a lot, making a shader that made polys disappear when they became too edge on to the camera, which eliminated many ugly artifacts. The foliage is half the polys of the other trees, plus it looks a lot better close up. Here's a close shot of it, plus a comparison shot with an older tree.

I still have a bunch of other ideas I want to add to these to make them look better, but I think we're on the right track to getting trees that really do have a nice amount of volume and harken back to the early mockups.

25 Comments:

  1. Making a good looking game is not necessary when the game play is of high quality. Similar to how an ugly piano can play beautiful music. However, a game with a well designed game engine and that is also beautiful is a treasure. The attention to detail in this game, from what I have seen, is incredible. I look forward to purchasing it the moment it becomes available.

  2. Shannon! These trees look beautiful!

    You said they were too heavy at 12k polys, is that really too heavy? I appreciate modern games have that kind of budget for characters, but is the limit here imposed by the lighting system?

    Either way, it looks like you’ve made some excellent progress towards optimizing the trees, though personally I think there’s something about the style of the 12k trees that just looks stunning.

  3. Just think about how many trees can be onscreen at once in some of those screenshots…

  4. Sure, I get there are a lot of trees on-screen at once, but what is the main deciding factor in the final polygon budget?

    I’m not entirely sure how you decide what is an acceptable compromise between visual quality and framerate when there is such a large range of target hardware capability.

  5. Nice trees, Shannon!

    You’ve been working out different modeling approaches to trees for what, 15 years now? SimCity, Spore and now these, which look the best of all.

    I’m still using your “umbrella” technique, but with somewhat fancier lighting. I did a writeup here, if you’re curious;
    http://oceanquigley.blogspot.com/2010/11/lighting-3d-trees.html

    Yours look better though.

    O.

  6. Woah! That final tree actually looks *like a tree*, instead of looking like a 3D game model trying to be a tree. This is very impressive stuff; I’m not sure I can recall seeing in-game trees that look this lush and look so natural.

    Stellar work.

  7. Sigh. People don’t seem to know effort these days.

  8. And when I mean that, I mean like people say “sheesh Portal 2 was short and cheaply made”.

  9. Nice, one question. The first thing I noticed about the concept art was amount of very different looking trees. So are you planning on incorporating other species of trees or do you just want to reuse the triangles in a bowl idea in slightly different ways to create unique but similar trees?

  10. Man, trees — they are terrible. I have tried so many things, and deciduous trees are the worst case scenario.

    One common trick to help smooth out the lighting is to edit the normals for the mesh. Here is an example using the Normal Thief script:

    http://wiki.polycount.com/VertexNormal?action=AttachFile&do=get&target=Tree_Normals.gif

    I have not used this technique though, so I don’t know much about it.

    One interesting option suggested by the concept art is making the trees less naturalistic and more like topiary. A couple spheres with a dense texture of leaves, and then some tris outside of those, with a more sparce leaf texture could maybe work.

    I think for our project we may end up going with aggressive LOD, and make dense “high” LODs. Transitions can be ugly, but I am not sure there is really any substitute with the current tech.

  11. Poly count is a good question. You’re right in wondering what is the right poly number when it’s to go on different systems. We’ll eventually have an LOD (level of detail) system that will handle various amount of polys, but right now I’m just shooting from the hip and taking a guess. I did a few tests, and more polys weren’t making the trees look better to any real degree… so I kept it low. If I start noticing some degradation, I won’t be hesitant about tossing some more polys in there.

    I do plan on making more types of trees, though I still want them to be volumetric. I’d rather err on the side of fewer types of trees than some trees that don’t fit with others. It’s a fairly small island, so I think I can get away with that.

  12. Did you get a LOD system working, or have you not worked on this yet as you are getting the highest poly model polished first?

    If you have got something for the LOD system working, is there any chance we can have a screen shot of the different poly models?

    By the way they are looking awesome. You have inspired me to get on with more asset building :)

  13. From my own experiments with procedural trees, I’ve found two potential problems with trees like that – you can’t quickly draw lots of them if triangle count is >2k and if the leaf triangles are dense, looking at the leaves will slow everything down quickly because of the huge overdraw. I tested everything with 3k trees, if you use less, the speed of tree rendering won’t be that important for you. But maybe you know better ways of drawing lots of high-detail trees?

  14. > Ignacio helped a lot, making a shader that made polys disappear when
    > they became too edge on to the camera, which eliminated many ugly artifacts.

    Would you mind elaborate a little bit on this point ? I have similar shaders for my trees, but it turns out that the fadeout looks ugly when Alpha-To-Coverage is used ; especially on latest ATIs where they seem to have removed dithering for Alpha-To-Coverage (in OpenGL at least).

    Do you use some ramp to modulate the polygon alpha according to its eye-space orientation ? Or is it something more involved ?

  15. If a tree falls on an uninhabited island, does it make a sound? Or are you still working on it? :P

    Seriously though, these trees are looking great! Are you also using a similar technique for the various hedgerows in the game or are these different?

  16. Thanks for making a blog post about the trees. I really liked the trees that were posted in the previous blog posts, and, although I liked the old ones, I understand that the problems they have when you look up close at them are pretty apparent. However, I like the new trees as well. They still have that soft, flowery look I liked about the old ones while still looking good close up. As a 3d artist myself, I can’t stress how annoying it is to make trees in video games, it’s one of the hardest things to do right. Is this LOD system going to include billboarding for really far away trees?

  17. Had you told me this “Triangle Bowl” technique before you would had made my life a whole lot easier. I made this little fan animation to impress Jonathan to get a job with you guys, but it’s my first animation alone and it looks pretty hairy.

    http://www.youtube.com/watch?v=4IlgPpzXUZA

    Look at those threes… not good. not good at all! my trees are like 50ps not 50k just 50 polygons. but do you think, …can i get a job?!

  18. Let’s see.

    I didn’t mention the normal maps I’m using because I didn’t want to get too detailed for this post…but I am using them. They’re kind of odd, a mixture of leaf direction and a hand painted map that both breaks up the leaves and rounds out the boughs.

    We’re currently working on the LOD system, but once we have that going I could put up a quick post on it. Snake5, I should mention that while the tree is about 2800 polys, 1900 of that is the trunk. Only 900 are the leaves, so that might be one reason the trees are running pretty efficiently right now. I’m sure the trunk will LOD down pretty easily, too.

    As for the shader, you might want to mention that to Ignacio next time he posts. I described what I was looking for, and he got it working, but I’m afraid I don’t really know the details.

  19. >Ignacio helped a lot, making a shader that made polys disappear when
    >they became too edge on to the camera, which eliminated many ugly artifacts.

    This shader, I’m assuming, would take the angle between the viewing vector, and the normal (by using a dot product), you would then have an “if angleBetween<someArbitraryAmount = discard triangle" type statement.

    you could then add a fade to this etc to smooth out the effect.

    That is one way of doing it, however I'm not sure if Ignacio used this or something more optimised.

    • It seems like that would only work if your leaves are planes that have the same normal at each vertex. Which looks like the case for The Witness, I think. In that case that seems like a nice quick solution.

      In my scenario leaf bundles are generally curved meshes with up to ~20 faces. I don’t think that method would work for me, since I don’t want bits and pieces of them vanishing when viewed on edge.

      What I end up doing is clamping the mip level in the pixel shader. This prevents “lines” extended out into the transparent parts of the leaves when viewed on edge (I assume these are the ugly artifacts we’re talking about). I discuss it in the “Alpha-testing artifacts” section of a blog post here: http://mtnphil.wordpress.com/2011/10/25/vegetation-improvements/

  20. sorry for the multiple comments.

    one thing I have noticed about the trees is there doesn’t seem to be any light coming through from behind. you could write a shader that when the normal is within a certain range (say backfacing) then you’d calculate a glow factor from the lights.

    I know this is not a shader dev blog, but… yeah.

    Excellent progress so far, I’m so excited to see this game progress, and it’s really inspired me in my own works.

    Thanks very much for the insight

  21. Hello,

    there are some intersting papers on this topic, maybe some could help a bit.

    http://graphics.uni-konstanz.de/publikationen/

    sincerely

  22. It may be way too late to get an answer to this, but I’m curious about the shader. Does the plane fade out at a linear rate as the camera points away from the normal, or is there some sort of threshold where if the angle gets to perpendicular it just disappears? Not sure which would look better if the player is moving.

    Thanks

  23. Really cool work Shannon. It’s very interesting to see the work you’ve done on those pesky trees. I was curious, do you use any sort of color gradient in your leaf texture to help with the shading?

    Also, how do you model those really cut surfaces on the rocks and other geometry. I’ve messed around with creating simple shapes like that, but they really rely on keeping the shapes planar, and as I edit the model and add detail I tend to really jack up the faces and then triangulation appears and then… poof it’s crap. I’ve considered trying to carve a rock with a boolean block, or using slice plane and capping over and over, but those processes sound very tedious.

  24. Some truly wonderful information, Glad I noticed this. “Nothing can resist the human will that will stake even its existence on its stated purpose.” by Benjamin Disraeli.

Leave a Reply to Ocean Cancel reply

Your email address will not be published.