Howto Create a Skybox in GIMP 2.8 for Unity3D

There’s a lot of mis-information and guess-work when all someone really wants to know is what to do from step A to step Z.

Skyboxes/Cubemaps

Skyboxes are simply 6 textures, each representing a separate plane of a 3-Dimensional box, the top, the bottom, and the four sides.

Generally all 6 textures are stored inside of a single image file known as a Cubemap (.DDS format) as separate layers. However, currently as of Unity3D 4.0.1 cubemaps are not exactly supported 100%. Unity has its own idea of what a Cubemap is and is used for reflective surfaces and is beyond the scope of this article. So you’ll just be importing the six different textures as six different assets.

Mipmapping

Other engines can import a DDS file directly (with mip-mapping and everything). Fortunately, you can select a “mip-mapping” option in Unity to have it generate mip maps for each texture you import. So no need to worry about generating lower-resolution images.

Starting the Image

I would create the new image using a resolution of 2048×2048 and then copy that layer 5 more times (and then I recommend labeling them.. the standard is as shown, with the positive/negative dimensions of x, y, and z used for right, top, front and left, bottom, back respectively)

 

The Whole of It

The trickiest part is not the the sides of each layer as clamp mode inside of the Unity will help, but rather the 8 vertices – the corners of your labels. Keep those in mind and you will make things much easier for yourself.

Personally, I like to open up another image with a resolution of 9216×3072 play around with that.

Night Sky
A starry night

 

What you are seeing is the original 8192×2048 of the X and Z faces all lined up side by side and expanded to 9216×3072.

We fill in a little more sky like so….

A Skybox in the Works
Now most of the corners and edges will match with the top and bottom faces of the cube against the sides.

You will notice at this point I have move guides setup parallel at X coordinates 512 and 8704 and then on the Y coordinates 512 and 2560 (512 pixels set aside for sides of the Y/Top/Bottom faces of the cube). 9216 – 512 = 8704 and 3072 – 512 = 2560.

I then add in more guides at X coordinates: 2560, 4608, and 6656 (512 + 2048 = 2560, 2560 + 2048 = 4608, and 4608+ 2048 = 6656)

 

Skybox Sections
Easy to see what sections belong to which part of the cube.

Now we cut out the X and Z planes easily and paste those puppies into the original Image we were working on into their corresponding layers.

The last part involves cutting and pasting/overlapping the sections of the Y planes to match correctly with some simple rotation and then copying the last two pieces into the original image in their own layers.

Done!

Exporting

I recommend saving/exporting the data as either a .DDS or .XCF so that you can keep everything together neatly organized in one place for future use/editing – as well as so that it will be easy to use by other applications (or easily exportable) again.

If you do export as .DDS – remember to set it as a “Cubemap” in the export settings, and make sure to have it generate mipmaps as well.

Exporting for Unity3D

For Unity you will have to export each of the layers separately as PNG – and I recommend naming them the same as the layer name so as not to get confused when importing them as individual assets.

When you do import them, remember to set the wrap mode from the default repeat to clamp instead. Also set the maximum texture size to 2048×2048 (or next highest resolution supported that meets your settings) and when creating a new Material set it to RenderFX/Skybox and you can drag on drop the appropriate 6 new sky textures into their corresponding places.. voila!

Official Directions

To have a better idea of what I mean, from here you can check out the directions laid out at Unity’s official site:

http://docs.unity3d.com/Documentation/Manual/HOWTO-UseSkybox.html

Leave a Reply