Blender Skybox
Blender Skybox
Blender Skybox
This tutorial will show you how to create skyboxes relatively easily from panoramic photos. My favorite part is, you can
do it easily using free tools such as Blender and the Gimp.
Using the Gimp to manipulate images is not really in the scope of this tutorial... check out some other page on using that
software. You should have an understanding of how to edit images and apply alpha channels. (You could also use the
Gimp to apply a polar coordinate texture to your rectangular image in order to create a fisheye image. Hint: it's not the
sphereize filter.)
Or, if you're lazy like me, you can just grab photos online to use as templates to create original images. There are also
many places you can download non-copyrighted photos for free as well. One resource for cloudy sky textures, as well as
panoramic photography instructions, is Philippe Hurbain's site Philo's Home Page (http://www.philohome.com) . This
tutorial will use a fisheye sky photo from his copyright-free Panoramic Skies images collection.
You'll also probably want a photo for your ground, unless you prefer to use real models such as buildings in your
skybox. This earlier chapter (http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Mountains_Out_Of_Molehills)
on creating landscapes can be incorporated into setting up your skybox. However, this tutorial will use the sky photo for
the top half of our world, and a panoramic landscape with an alpha channel for the bottom half. I've created a ground
image using copyright-free textures obtained from Accustudio (http://www.accustudio.com) .
Here are the images I'll be using (you'll want to use images with higher resolution): Note that the sky has trees, etc.
1 of 8 23/02/12 5:54 PM
Blender 3D: Noob to Pro/Build a skybox - Wikibooks, open ... http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Buil...
Note: I've outlined the horizon of the ground texture with an alpha channel which will allow me to place the ground
mesh right against the sky mesh with a very natural feel.
The cube will be the center of our environment, so use Object->Snap->Cursor To Selection if your cursor is not
centered. Then, from the top view [KEYPAD-7], Use [KEY-SPACEBAR] to insert a new mesh; make it a UV sphere. I
find a 32-segment, 32-ring sphere to be sufficient. We create the sphere from the top view because that is the projection
from which we want to add the sky texture.
2 of 8 23/02/12 5:54 PM
Blender 3D: Noob to Pro/Build a skybox - Wikibooks, open ... http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Buil...
Scale up the sphere so it resembles a large "arena" in comparison to your cube, and select and delete the lower half of
the vertices, using the front view [KEYPAD-1] and [KEY-B] to create a bounding box. It helps if "Select Visible" is
turned off so you can select all of the vertices in one go.
Turn on proportional editing with [KEY-O], then select the bottom row of vertices and scale them up with [KEY-S] so
that the bottom of the sphere gets a bell shape. Because the projection of the sky texture will be from the Y-axis (ceiling)
we need the bottom faces of the sphere to be at an angle, to catch the texture. (Faces perpendicular to the projection will
look like smears.) Alter the influence of proportional editing with [KEY-PAGEUP] and [KEY-PAGEDOWN]. Linear or
Sharp falloff works best with the sphere shape.
3 of 8 23/02/12 5:54 PM
Blender 3D: Noob to Pro/Build a skybox - Wikibooks, open ... http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Buil...
Now you're ready to add your sky texture to this mesh. In the Materials menu, create a new material and a new texture.
Be sure to set your material not to receive shadows by clicking the "Shadeless" button. Then, in the Texture menu, set
the texture type to Image, and click the Load Image button to insert our sky texture. Back in the
Materials->Texture->Map Input menu, you may need to scale your image to get rid of the distorted textures at the edges
of the fisheye by setting the Size to, say, 0.950 for X, Y and Z.
At this point, if you wish, you can reposition the camera and render the scene to see how your sky mesh looks.
4 of 8 23/02/12 5:54 PM
Blender 3D: Noob to Pro/Build a skybox - Wikibooks, open ... http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Buil...
This time, I will apply the ground texture with a tube projection, so it is projected onto the mesh horizontally [Materials
panel | Map Input tab | Tube button]. Because I have an alpha channel on this texture, I click "Use Alpha" in the Texture
menu and Map To -> both Col and Alpha buttons [Materials Panel | Map To Tab | -> both Col and Alpha buttons]. You
will also need to set ZTransp in the Mirror Transp menu [Materials Panel | Links and Pipelines Tab | ZTransp button] so
that your alpha channel shows up in the envmap (which will become your skybox), and Alpha to 0 [Materials panel |
Material tab | A slider ] to allow the masked areas to be transparent. (Alpha channels appear to require Z buffering to
appear on procedural textures.) Also, you may need to adjust the offset of the ground texture (Y-axis), so that the
horizon appears properly on the "billboard" area of your ground hemisphere.
Again, you can reposition the camera and render the scene to make sure everything is properly aligned. Be sure to
activate the layer where you moved the sky mesh. Your results will look similar to the following image. Set OSA on in
the render screen for best results. Also, use higher resolution images with cleaner alpha channels -- the image below is
rather blurry and you can see a halo around the horizon.
5 of 8 23/02/12 5:54 PM
Blender 3D: Noob to Pro/Build a skybox - Wikibooks, open ... http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Buil...
Once you've created the Envmap texture, you should be ready to render the Envmap for your skybox. If you want to set
your file format such as JPG or PNG, you should do that first. Then, simply go to the render screen and click "Render."
Again, make sure all layers are visible. The rendering window appears. First, Blender renders the environment map of
the cube. Afterward, the camera view is rendered, at which point you can hit [KEY-ESCAPE] to stop rendering -- we
are only interested in the environment map which is already complete.
6 of 8 23/02/12 5:54 PM
Blender 3D: Noob to Pro/Build a skybox - Wikibooks, open ... http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Buil...
Select the cube again, then get to its texture menu. You will see the newly-rendered Envmap on the sample texture.
Click "Save EnvMap" in the texture menu to save the rendered Envmap.
Blender environment maps are saved as a 3x2 matrix of squares, as seen here:
You can now load this image as an envmap texture in a new cube, which you can incorporate into your game as a
skybox. This file can also be edited in the Gimp to remove any unwelcome artifacts such as trees, buildings, jet trails,
etc. Also, because I used a tube projection on the lower hemisphere, in the bottom face of the envmap you see a strange
star shape at the "pole." You'll most likely have a floor in your game, so you probably won't see that face anyway, but
sticklers can avoid it with clever use of the Filters->Distorts->Polar Coords filter in the Gimp or Filter->Distort->Polar
Coordinates (Polar to Rect.) in Photoshop. Patching also works well.
To make the skybox appear as a static background in your game, vertex-parent it to the current active camera object.
Video Tutorial
Ira Krakow's Blender 2.49 Skybox Tutorial: http://www.youtube.com/watch?v=azkk3JrM5Es
7 of 8 23/02/12 5:54 PM
Blender 3D: Noob to Pro/Build a skybox - Wikibooks, open ... http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Buil...
8 of 8 23/02/12 5:54 PM