Modular Tree Assets
In case you haven't heard enough about trees, I have decided to talk a little bit about how our tree assets work in Overgrowth.
Many games use the popular tree editing middleware called SpeedTree. Although SpeedTree does some cool things, it has the problem that because it creates tree models from scratch using procedural parameters, the trees tend to look a bit similar and generic. This problem is compounded by the fact that it's use is so widespread that you have probably seen these trees in dozens of games (GTA4, Gears of War 2 and Fallout 3, just to name a few). David and I are pretty tired at looking at SpeedTree content, and having worked with it, I am not sure why so many games use it. Did I mention it costs almost $10,000?
Having decided that we didn't really want to use existing middleware, it was my job to come up with something that would work for our trees. I wanted my art assets to be as flexible as possible, and look naturalistic. I wanted the workflow to be simple, and to fit in with our existing techniques so that there would be fewer special cases to learn. What I came up with is to make the trees modular, which is simple, but works very well.
The modular tree assets are broken up into a 3 main categories; trunk, branch and leafy areas. Here is an example:
In the above image, the leafy parts share the same textures, but the branch and the trunk have their own texture space. One advantage of this is that the parts of the tree can look different, while standard procedural techniques usually use a tiling texture for the trunk, which means it looks the same everywhere.
Another great thing about this is that I can use these parts to make all sorts of different looking trees. In the above image, I have used the modular tree assets to make trees of different ages. because I can tweak each branch by hand there is another advantage over procedural generation; because I know how the game camera works, I could put dense branches that use more graphics resources only in places that the player is likely to see it. This means we have more resources for everything else.
It may seem that I don't like procedural techniques, but that is actually not true at all. There are a few ways we can use procedural systems with these same assets. For example, because our different trees use the same basic pieces, there is no reason we can't make a procedural editor to define how the pieces fit together. Another way to use procedural systems with these assets is to to make a bunch of tree presets, like those different aged trees, and have the editor decide where to place the trees based on the amount of sun or water they might get.
The main reason people use procedural asset creation is because it saves time, but the ironic thing is that complex middleware has so many sliders and dials that it can take ages to get the look that you want. With our method if I want something to look a certain way, I just make it that way, which takes far less time. Since all the editing takes place using the engine I don't have to worry about exporting data from middleware which can sometimes be tricky. This way we can avoid all the bad parts of procedural content creation but keep all the good things about it.
Rendering Plants with Smooth Edges
When we are rendering many objects on screen at the same time, we only have a few hundred polygons to allocate to each individual plant. We use intersecting alpha-mapped planes to give the impression of much greater detail. Here is a picture of what our desert tree looks like with the alpha channel used for color instead of transparency:
If we just turn on blending, it starts to look like a tree, but there are serious artifacts around the leaves. The transparent pixels in the nearest leaves are occluding the background leaves. The following pictures are zoomed in ~200% for clarity; click to see the full image.
We can fix that problem by turning off depth-writing. But now you can see the background leaves in front of the foreground ones!
We could draw everything in the correct order by sorting each quad from back to front, but this is slow, and intersecting quads would have to be split. In practice, the most common solution is to turn off blending, and turn on alpha-testing. That is, for each pixel it checks if the alpha value is above some threshold, and if so, draws it at 100% opacity.
Now we have everything drawn in the correct order, and it looks like a very detailed tree, but we have lost the smooth, blended edges. This is especially problematic when viewed from far away. Here is an enlarged distant view with alpha-testing used on the left, and blending on the right.
One way to get smooth edges using alpha testing is to use the multisample buffers. By using a different stippling pattern in each alpha buffer, you can combine them to get fairly smooth gradients.
However, this option is not supported well on many 3D cards, and only works well with 4x or more samples per pixel. What we are doing right now in Overgrowth is drawing the plant using alpha testing, and then drawing it again using blending with depth-writing disabled. This is not perfectly accurate, but it is compatible, easy, and fast.
Please let me know if you have encountered this problem before, or know of a better solution!
Overgrowth alpha 13
Another week, another alpha! Here is what is new in Overgrowth this week.
As usual, we have fixed a number of bugs, tweaked some stuff, and implemented some new features. Aubrey has created even more art.
Going through our svn code logs the past week, here are a few highlights:
- A few optimizations
- New transparency stuff
- Fixed widescreen FOV
- Hooked up Shark and Instruments
- Group rotation and group scale working
- Objects glow when selected
- Deleted groups and undone groups recorded properly
- Editor graphics polished
- New color scheme for groups
The migration to the new forums / blog server should be done for real now! Sorry if you noticed any downtime.
Thanks for the feedback on which bug tracking system to use, last week. We have settled on Trac and I am just finishing up the setup right now. We will open it up to SPF to help categorize bugs and help get more organized in our alpha testing.
We are also testing out BitTorrent this week as additional way to help distribute the alphas. That could be awesome as the alphas are getting quite large.
Thanks for all the support!
Trees
I finished up some trees and a few smaller bushes recently. Some of this stuff is still a work in progress, but I was happy enough with how the tree came out to show it off a bit. Here is our new tree in action!
This is still using our standard material shader. Soon we will have a special leaf shader that helps even out the tone so there is not such high contrast between the lit and shaded leaves. Real leaves are translucent, so they glow even when they are facing away from the light. Here is a picture with some other random plants at the base of the tree:
I will have a lot of new plants done soon which I think will dramatically change how the game has looked up until now.
Oh, and there is a new terrain heightmap here also-- almost forgot.
It would be great to get some feedback on the new tree and hear what you think about natural environments.
Staying Current with Graphics Research
One of our favorite things to do is to find cool graphics research videos and to share them with each other on AIM. We're trying to stay current with the latest graphics techniques in hopes that we may find useful technologies for Overgrowth and for our future games. Here are five of the coolest research videos we have been enjoying:
Generating 3D Faces from a Single Image
Seam Carving for Content Aware Images
3D Texture Capture with a Consumer Camera
3D texture capture research page
3D Virtual Reality from 2D Images
3D virtual realities research page
Cutting-Edge Fluid Dynamics
One thing we've noticed is that academic research is often far ahead of mainstream game tech. Perhaps this is because it's hard for big companies to overcome their inertia and update their development pipeline. As a small indie company, we're hoping to stay agile and to embrace as many cutting-edge ideas as we can. In fact, we've been in contact with a number of researchers and even managed to arrange a lunch with Gregory Ward, one of the authors of the third video above! In a future blog post we will explain how this technology might help us with Overgrowth.
Have you guys come across any awesome graphics research videos that seem years ahead of their time? Please share in the comments!