Thursday, April 16, 2009

Spore's procedural terrain texturing

Spore's planets are the game's primary playfield. In most games, the playfield is hand built by artists.
In Spore, we wanted to fill a whole galaxy with planets, so it would have been crazy to try and hand author them. Instead, we created a system that could take planet recipes created by artists and reconstitute them.

But I'm not actually going to talk about that! Instead I'm going to talk about how we textured them after they'd been generated. Texturing is another thing that's generally done by artists, but because our planets were being created on the fly, we had to come up with a way of doing it automatically. Here's one of the diagrams I did as I was trying to figure out how...


(click to enlarge)

It was really important to me that the textures conform meaningfully to the terrain. I didn't want to have them look like a carpet covering the landscape, ignoring it's topography. So I came up with this approach. (incidentally, I've just recently discovered World-Machine, which does a masterful job at this sort of thing, and more)

This image shows the steps going from the terrain's topography (known as a heightfield) to the final texture. The heightfield had to be filtered to get the structure to emerge. And various other textures had to be blended in and integrated.

This is basically a visualization of the recipe that I gave to the engineer. It evolved tremendously from here, but this was the start. (as an aside, Spore was a strange project to art direct, as I spent more time working with engineers than with artists).


(click to enlarge)


Here are some images that I took while testing the system. I'm generating random planets while keeping the colors constant so I could see if the textures were describing the terrain in a believable way.


(click to enlarge)

Had to add this one additional shot, where I was testing out some of the different planetary color palletes. Also check out the shadow passing through the atmosphere on the night side of the planet.
(click to enlarge)

4 comments:

  1. Very interesting, thanks. :)

    Seems like a pretty straightforward height-based algorithm--I take it the one for SimCity (that you posted several days back) is much more complex?

    ReplyDelete
  2. My pleasure!

    Let's see, it's starting with height, but then extracting concavity & convexity (with a second derivative filter), slope (facing the poles, as it happens) and blending those into the heightmap along with latitude to create what I thought of as a "cold to warm" map.

    Cold areas would be on mountaintops, exposed ridges and slopes facing the poles.

    Warm areas would be low terrain, equatorial terrain and sheltered valleys.

    This combined map (which we called the "munge map" as it had all of these influences munged together drove the color.

    Frankly it was all overkill, and a legacy from an earlier game design that emphasized ecosystems to a greater degree.

    ReplyDelete
  3. Ah, interesting. Yet another little piece I'd have never noticed on my own. :)

    ReplyDelete
  4. hi there,

    how do you give the terrain that cartoony style? is it some setting of worldmachine?

    ReplyDelete