I post news
- Jan 28, 2011
CRAFTING THE FLORA OF BROKEN ROADS
Our VFX and Technical Artist, Ryan Gee, does a lot of work to breathe life into our representations of Western Australia. In this blog, he discusses differences in vegetation from one end of the Wheatbelt to the other, how he created a tool to paint the correct biomes and unique wind patterns onto existing levels, and how he uses a "non-destructive" workflow to make collaboration between departments as easy as hitting "regenerate".
With Broken Roads being set in the Australian Outback, we knew it was important to create diverse and vibrant environments to immerse players in a truly Australian-flavored apocalypse. Australia has a huge range of flora and fauna that varies wildly by region, and many of which aren’t found anywhere else in the world. As the technical and VFX artist at Drop Bear Bytes, one of the coolest parts of my job has been helping the art and level design teams fill our apocalyptic world with trees and plants across the whole range of the outback, from forests to barren wastelands.
As a technical artist, I get to work in the wonderful area in between pure art, pure programming, and the mysterious art of level design. One of the immediate challenges we faced was how to fill large areas with dense vegetation (without having to place each bush and twig by hand), and how to vary the vegetation according to the different regions and areas of the game. As a Canadian currently living in Spain, I’ve not yet had a chance to visit Australia, so I started off on a virtual road trip, thanks to Google Maps.
After having visited each of the real-world locations of the scenes in the game, I had a nice overview of what each area’s vegetation looked like. Armed with this, I was able to make some categorizations of the various biomes, and typical plants, trees, and scrub. However, there was still the challenge of filling large environments with regionally correct vegetation, now that I understood what it should look like.
My solution was to create a custom tool, creatively named the Vegetation Tool™ (I’m not the best with creative naming). It allows our level designer, Luke, to paint in the density of vegetation across the scene, and then spawn vegetation according to a pre-defined biome. These biomes are made of a list of regionally correct plants, debris, grass, rocks, etc, and some information describing how they grow and are scattered. This creates a non-destructive workflow; it ensures everything is editable, reversible, and allows the art team to work on or change any individual assets without level design having to redo vegetation every time (just regenerate vegetation with the updated biome). Here’s how that works in practice:
The gray cubes show the painted vegetation density, which can be painted either by hand or according to a pattern as shown above. The tool in the video is using a fairly dense green biome, but this can be modified or swapped out for any other biome set, and just regenerated.
The generation process roughly simulates the root density of each plant, and how various plants form clumps as a result, collecting loose dirt, debris, and twigs around them. The generation algorithm can also adapt to other trees or objects that have been manually placed in a level if more artistic control is needed over their exact locations.
Creating this tool has allowed us to rapidly fill levels with the patchy, scrubby vegetation that’s common across the outback, and facilitates the workflow between level design and art production. However, placing vegetation is only part of the process: it still needed to be animated.
(Beware, there be technical dragons ahead)
Realistic wind animation proved to be a challenge, and the first version I came up with looked laughably like seaweed rippling underwater. However, we needed something with sufficiently realistic motion, customizability according to environment or game needs, and something that wasn’t too much of a headache for the art team to create models and textures for. Taking inspiration from a GDC talk that Guerilla Games presented on the subject, I came up with the current system.
First, there’s a global wind manager that controls the direction and strength of the wind in every scene. This allows each location to have different settings, and for those settings to be changed if, say, a dust devil or sand storm rolls in mid-quest. Below is an example of what the primary wind vector looks like in-scene:
The tree and vegetation models also have information baked into their vertex color channels: the red channel contains a mask, used if we’re animating cloth or something other than vegetation; the green channel contains an index value for each separate part of the tree, and the blue channel contains a value for overall flexibility. These are quick and easy to apply to each model, and the rest of the animation is done in a shader.
The shader calculates bending, based on height and flexibility, as well as detailed fine movements for leaves, small branches, and grass. The amount of bending is controlled by the global wind settings and texture, and offset by the index in the green color channel, to give individual parts of the tree their own sway and non-uniform movement.
One of the final steps in adding flora to our environments is adding grass. This posed a similar challenge to spawning vegetation, as it required an editable system that could be easily modified, but also quick to render to allow for thick fields in some of the lusher regions of the game. To this end I created the Grass Tool™ for easily painting grass into scenes, that can also be hooked up to the Vegetation Tool™ to automatically generate grass based on the same density settings as the rest of the environment uses. Additionally, the grass can be animated using the same global wind patterns as the rest of the vegetation, allowing for ripples of wind to flow through grassy fields.
The difficult part with rendering grass is that in essence, GPUs can render lots of grass, really really fast, but the problem is that everything else about the grass (like where it is, how big it is, its rotation, etc) starts on the CPU, and getting it to the GPU is really slow. To solve this, the grass is rendered with GPU instancing, which effectively bundles up all the information about the grass into one package instead of a zillion small ones, and lets the GPU do what it does best and sort out all the information for each piece of grass.
To make it even faster, we can use a technique called CPU binning (tech artists have very fun lingo). This allows us to limit the size of the package the CPU passes to the GPU (as opposed to passing information about every bit of grass in a scene) by roughly guessing what the camera can see at any given moment. This allows us to have hundreds of thousands of grass cards in a scene with minimal performance impact.
TLDR: GPU go brrr, grass go zoom.
If you made it through all that, thanks for reading! And if you just skipped to the tldr, thanks as well, just a little bit less. Hopefully this article provided a little glimpse into some of the tech that makes Broken Roads tick, and exactly what on earth technical artists do anyway.
Ryan Gee, VFX & Technical Artist
Drop Bear Bytes