The sky's the limit

The sky's the limit

Rate This
  • Comments 3

Skies are one of the most important yet easily neglected graphics in a game. In a typical 3D world the sky can occupy as much as a third of the screen, so having a good one can do wonders for overall visual quality.

The great thing about skies is that you don't need fancy shading techniques or leet artistic skillz to create them:

  • Wait until nature comes up with a good one
  • Climb the tallest hill or building in your vicinity
  • Take a dozen photos while you spin in a circle
  • In Photoshop, paint over any objectionable artifacts (birds, treetops, phone lines, chimneys of neighboring buildings)
  • Stitch the photos together into a panorama (either using a dedicated program or by hand in Photoshop)
  • Create a 3D cylinder, and wrap your panorama texture around it (or use the sky processor from the Generated Geometry sample, which will automatically construct the cylinder for you)

Voila! You just created a detailed, realistic, and unique sky for your game.

The only problem with this technique is that you get discontinuities at the top and bottom, where the texture is pinched into a single point at the poles. I think people worry too much about this, though. Most games have some kind of ground, so you will never see the sky when looking down, and as for the top, how often do you look straight up? That is impossible in many games, and rare in almost all.

If your camera can look straight up, use a gradient fill to fade your sky texture to a constant flat shade at the top. For instance this:

image 

would become:

image 

Sure, the very top looks a little boring compared to lower down, but this is plenty good enough for the handful of times when the player actually looks that way.

Simple, efficient, doesn't require great art skills, and the quality of the results is limited only by how much patience you have waiting for the weather to cooperate...

This is how we created all the skies for MotoGP. Although we included tracks from all over the world, the sky photos were taken from the roof of our office building in Brighton. For several years, the artists kept a constant eye on the weather. Every few days I would hear someone cry "wow, pretty clouds! Quick, where's the camera?"

  • Great article, Shawn, thanks!

    I was trying to think of 3D games where you never look up at least once.  Only FPS games were coming to mind, and then you said MotoGP!  "Oh, racing games, right." :)

  • I had a question about sky cylinders. In the GeneratedGeometry example they not only wrap the texture around a cylinder, but they use a special shader that - if I understood it correctly - was rendering the cylinder centered on the camera so the view is always in the center.

    Is that right?

    Is the shader needed or can just render a giant cylinder outside the borders of where the camera can be?

  • The sky should appear to be effectively infinitely far away, ie.

    1) sorted behind everything else

    2) fixed in position, not moving along with the camera translation

    The vertex shader used in our sample alters the projection math to achieve both these goals.

    Alternatively, some people achieve #1 just by drawing the sky first with zbuffer disabled. It is more efficient to draw it last with z states set like in our sample, though, as this avoids needless overdraw in areas where the sky is not visible.

    For #2, you can either use a custom shader like in our sample, or just modify the camera matrices to omit the translation when rendering the sky.

Page 1 of 1 (3 items)
Leave a Comment
  • Please add 5 and 3 and type the answer here:
  • Post