Billboard Trees

No, not like this. Well, sort of like this.

So, I had my fancy schmancy terrain. I could render the ground. Yay. Accomplishment of the century. So, the next task would be to put something on the ground. Ambitiousness!

I figured the best thing to start with would be a vegetation system. I’d need a cheap, plentiful food source for when I started putting creatures on the map, and plants were the obvious choise. In addition, they add detail and make the entire map more interesting than just a ground-plane. To render them, I decided to use billboards.

Who needs more practice with their drawing tablet? You do! Yes you do!

Billboards, in a computer-graphics sense, are one-dimensional shapes that always face the camera so you don’t [i]see[/i] that they’re only one-dimensional. They’re like other-dimensional monsters that always know where you are. They’re used all the time in games, but normally only to represent complex objects that are often some distance away from the camera (like trees), or are too numerous to represent more accurately (like grass). As of the time of writing this, Species is still using billboards for it’s vegetation. This may have to change, but at the moment it’s one of the lower-priority items on the development list: the sprites, tacky as they are, are functional.

It would have probably been best to configure the vegetation to render in tandem with the QuadTerrain system, but knowing I would have to continually update the vegetation based on how much energy any particular vegetation object had, and allow all the creatures on the map to interact with it, I realised that a QuadTree would be less than ideal. The QuadTree system relies on larger nodes being less detailed than smaller ones: for the creature interactions, if not the rendering itself, I would need the same amount of detail everywhere on the map. So I divided the terrain into a simple grid, with each grid-square being given a small number of tree objects to manipulate and render. Creatures more than 2 squares away from a vegetation square don’t process the trees in it at all, saving CPU.

One advantage of a grid is that it correlates exactly with real-world space. Rather than checking the grid square by square, or sinking down through parent nodes in a quad tree, I can simply divide the creatures position co-ordinates by a given value and plug the result into the array to tell me instantly which square they’re in.

Am I being too technical? I’m being too technical, aren’t I? Oh god, what if I’m swamping you with boring technical information? Here, have a picture instead!

Look at the picture! Ignore my crippling insecurities!


Now, they’re not perfect. They blend in with the terrain, which I don’t actually want in this case since it should be easy for the player to spot and identify food-sources. And they’re unbelivably tacky-looking because I threw them together in Adobe Flash using a laptop touch-pad. And, of course, they’re billboards. They look okay from a distance, but get too close and the illusion stops being at all convincing.

But then again, hindsight is always 20-20, and even though there’s a lot of things I would/will/might change, the vegetation billboard grid works for now. And maybe that’s good enough. For now anyway.

Want to hear something worrying? I don’t think he was actually being sarcastic in that first sentence.

  1. #1 by stam on July 24, 2011 - 4:17 pm

    Great post, Qu. For me it was wonderful brief explanation how to do fast basic vegetation.

  2. #2 by ququasar on July 25, 2011 - 11:43 am


    Interesting fact I was going to mention (but forgot about) was the fact that the billboards themselves aren’t actual physical geometry, at least not on the CPU. Each billboard is just a group of vertices in the same position, just at the base of where the billboard itself will appear.

    It’s the GPU that translates that group of vertices into a standing shape depending on where the camera’s at. This means that, rather than continually sending a huge load of vertex position data to the GPU every time the camera moves, all I have to do is update the camera position and the GPU will take care of the rest, leaving the CPU free to do things like creature AI.

  3. #3 by glass shelves suppliers on December 18, 2012 - 2:21 am

    Howdy! I simply want to offer you a big thumbs up for your great info you have here on this post.
    I am coming back to your web site for more soon.

  4. #4 by Sonya on February 11, 2013 - 2:24 am

    I really like your blog.. very nice colors & theme.
    Did you create this website yourself or did
    you hire someone to do it for you? Plz answer back as I’m looking to construct my own blog and would like to find out where u got this from. thanks a lot

  1. GRASS GRASS GRASS GRASS « Species Development Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: