Rendering a cubemap/skybox

I’ve tried my best and seached on Google to no avail. I have a scene of which I wish to render a cubemap. You know, those cross shaped six square image things. I think it’s just a matter of getting the correct FOV on the camera but nothing I’ve tried has worked.

Easy as pie with Blender, I whip up a rough’n’dirty tutorial :smiley:
You need no camera for this.

  • Create a Cube around your scene.
    Either go to wiremode, or, go to the object panel and set the Display Type to wire. This way you´ll see all in your set viewport shading mode and the cube will be wireframe.

  • Mark seams to match a cubemap. (edit mode, select, ctrl+e > mark seam)

  • Flip normals to the inside. (edit mode, ctrl+a, shift+ctrl+n)

  • UV unwrap the cube. (edit mode, ctrl+a, u > unwrap - method conformal)
    you´ll most likely have to rotate your UV layout as blender will try to make most of the space and roate it.
    Now add a new image with a size of your desire.

  • Create a cube material, enable shadeless to prevent shading and specularity of the cube.
    Enable Mirror for the cube, set reflectivity to 1.0, fresnel to 0 and MOST IMPORTANT depth to 1.
    This is so important because you want the cube to mirror everything in the scene, and not go deeper! Focus for the next sentence:
    If you had a mirror material in your scene, it would mirror the mirrorimage of itself on the cubes image and thus create a double or even multiple mirror image on the cubemap if the depth is deeper. Hmm. I guess now your head smokes:
    Imagine two mirrors opposite of each other. They´d mirror each other infinite, but you just want one mirror to mirror in the other one once. So you tell one of the mirrors only to show one reflection.

  • Check all your lights and stuff like that.
    Now go to the render panel, there you´ll find bake.
    We got a cube that´ll mirror the scene and an empty image assigned to the uv layout to bake the scene on.
    Under bake, be sure that Full Render is selected and all that remains to do is to press Bake and watch how your cubemap is baked.

  • Save the image and use it as cubemap.

Here´s a sample blend I threw together:
http://www.pasteall.org/blend/10602

Good luck :wink:

Interesting idea indeed but not what I meant. This method produces six images of the scene from all six sides. That is not a skybox or a cubemap. Here’s a cubemap I grabbed from Google images.
http://infocenter.arm.com/help/topic/com.arm.doc.dui0505c/graphics/example_cube_map_environment.png
As you can see the scene is viewed from one point, not from six. If this was mapped on a cube and viewed from the inside it would create the illusion of 3D space.

My mistake facepalm

You´d have to place the scaled down cube in the middle of your scene and turn the normals around obviously.
But usually there´s something in your way to place the cube.

I just recalled blender can create environmental maps itself.
Create a cube around your scene.
Assign a material, and apply a texture. Check environmental map.
Set it to static, the mapping to cube.
Place an empty at the center of the cube, select the empty for Viewpoint origin.

just hit F12
it will render the 6 cube sides, then the scene.
after rendering is done, go back to the texture panel, next to [static|animated|ImageFile] is a downfacing triangle.
click it and select “save environment map”

IMO it´s a complete usability fail to pretty much hide that feature and make the save envo map almost impossible to find.

You have to edit the skybox though for use outside blender, blender creates them this way:


+----+----+----+
| -X | +Z | -X |
+----+----+----+
| -Y | +Y | -Z |
+----+----+----+

hope that makes up for the crap I posted before :smiley:

I can’t find the environment map checkbox. I’m using 2.6. I did find a few tutorials regarding the matter for 2.49 but that doesn’t help me at all.

There´s no 2.49 checkbox there anymore, that’s why :slight_smile:
I shouldn´t have said “check environmental map” :confused:

In the texture panel, right at the top under “Type:” you’ll find “Environment Map”

Thanks! It worked perfectly. The table you posted above had the axes wrong so I wrote them into the scene itself and then rendered.


Yeh, they prolly changed the layout, the table I posted is from 2.4x - I haven´t baked any cubemaps for a while now. It´s kind of yesterday´s tech but coming again with WebGL and GL-ES.