Dev Diary #6 – I got wood!

Well, I am making trees, that is! Welcome to this week’s Dev Diary Avalonians!

After the recent post on IGN that publicized our landscape trailer, it felt somewhat relevant to talk about the subject. The content shown in the landscape trailer is pretty old, and a good deal of it has been improved on and will not be in the final game. It does look pretty though.

Here you can see how they look at the moment:

What makes a forest?

First let’s look at the task at hand, and ask what we really need to achieve. Forests are pretty, they are dense and large, and all the leaves play with the light that flows through them. The lightplay that goes on in a forest is quite complex, and the key to making trees look good in-game is to make them look dense, and give their crowns volume. To do this, we need to simulate the lightplay in an organic way. The tools at our disposal are not optimal for this task, as we render trees with polygons, which are mathematically flat triangles. They are so flat that there is nothing at all in reality that is as flat as a polygon. So, let’s use them to show off some large, dense volumes shall we?

The common CGI solution is to just use a lot of them. If we make a bajillion polygons and scatter them in a neat way in the shape of a tree’s crown it will look really nice. However the next problem to deal with is that we are extremely limited as to how many polygons we can put on the screen, so yeah… that idea goes out the window.

Luckily this is a well-covered subject, and there are varying methods of going about it. Among them are tree creators that generate the trees, which is what we used for the ones in the landscape trailer. However, we have changed our workflow since then, and most trees in Avalon Lords will be handmade models with handmade textures. This method is a bit more costly, but with the tools available, the runtime result and visual quality will be vastly improved.

So how do we make a tree?

First off we make some really high detail twigs. Then we use the standard method of transferring high detail to low detail geometry to get neat visual fidelity pasted onto objects that run smoothly. In this process we include some data from the high poly twig that can be used for low poly ones, such as thickness, translucency and self occlusion to help with lightplay and other cool things. After that, it is mostly a process of building the tree by arranging all the low poly twigs in a manner that looks great from most, hopefully all, angles. This is a very basic process, but it has to be done manually to give us that full control.

In the end, the tree always comes out pretty polygon heavy no matter what we do. There are solutions to that; we simply build five different versions of every tree, each with fewer polygons than the last. Then we switch models depending on how big the trees are on your screen. If we do that right, you will hardly ever see the difference. Lastly, when the trees are really far away, we switch them for a billboard.

Within the tree we store some information about how it occludes itself from the sky so we can further increase the complexity of the lightplay that goes on around it. We are working to get image-based lighting (IBL) on everything in the game, so it will be lit by the actual sky in a very nice way. On outdoorsy settings, IBL combined with ambient occlusion, which is information that shades the object based on how far it is from other objects, creates a visually appealing and decently accurate image of what actually happens in the shadows. In this case, the ambient occlusion only shadows the skylight. Since the skylight is one big light coming from every direction, the ambient occlusion, which occludes in every direction based on distance, creates a realistic image. The result will be that inside a big crown of leaves the shadows will be much deeper, as the skylight gets diffused and lost in the leaves.

This only occludes itself however, as the tree does not know whether it is standing next to other trees. We have some really nice things in the works for solving the interplay between objects, but more on that in a later Dev Diary…

When all that is complete we stick some really nice shaders on it to make the sun shine through them in a beautiful way, and also to make them flutter in the wind and make the scene come alive!

Hail to Avalon,

Fredrik Larsson, Art Director

Animus Interactive