A skybox is a method of creating backgrounds to make a computer and video game levels look bigger than it really is. When a skybox is used, the level is enclosed in a cuboid; and the sky, distant mountains, distant buildings, and other unreachable objects are projected onto the cube's faces (using a technique called cube mapping), thus creating the illusion of distant three-dimensional surroundings.
A skydome employs the same concept but uses either a sphere or a hemisphere instead of a cube.
Games often employ skyboxes. Traditionally, these are simple cubes with up to 6 different textures placed on the faces. By careful alignment, a viewer in the exact middle of the skybox will perceive the illusion of a real 3D world around it, made up of those 6 faces. http://en.wikipedia.org/wiki/Skybox_(video_games)
A good example of what the skybox and environment cube does.
Skydomes
For the in game background, SoaSE uses a spherical skybox, often referred to as a skydome, in conjunction with an environment cube for in game reflections on the models.
SoaSE uses 2 types of spherical UVs for the skydomes. The first set is a smaller size (4 mb textures) but separates the top and bottom islands to avoid the 'pole pinch'.
The larger texture set spheres (8 mb textures) UV unwraps the entire sphere onto a single flat UV. Pole pinch is an issue, but can be avoided by leaving the poles transparent for stars to show through, or using a solid colour. The alpha channel is the transparency mask.
To open, edit and save the textures in GIMP, the DDS plugin is required. The GIMP project files below can be opened without the plugin as the textures are already saved in the project.
SkyboxBackdrop.4096x2048.xcf
Includes the 3 stock 4096 x 2048 textures, a simple star field, the UV map, and a few nebula examples from a google image search.
Trinity (used mipmaps)
Rebellion (no mipmaps)
The Alpha mask
Once the skydome texture is complete, the alpha channel will need to be edited to allow the in-game star field to show through. The black areas on the alpha allow the texture to show, while the transparent areas allow the star field to show through. Applying the mask to the alpha keeps the original image intact.
To edit the alpha channel, add a layer mask and apply the brush effect to the layer mask.
Under the Layers tab, right click the layer to edit and choose Add Layer Mask. A dialog box will ask you how you want the layer mask to be initialized. Presuming you'll start with a visible image and brush away the part you want transparent, the best choice is White (Full Opacity). Click Add.
Under the Layers tab, you should now see the white thumbnail of the layer mask, next to the thumbnail of the layer image. Click on the thumbnail to edit the layer mask. Choose your brush effect and the color black, and apply the transparancy.
If you switch to the Channels tab, you will see in real time how the alpha channel changes as you paint on the layer mask.
If you prefer to start with a transparent image and brush on the part you want visible, just start with a layer mask which is Black (Full Transparency) and apply your brush effect to the layer mask with the color white.
You can always switch back and forth between black and white paint to add or remove transparency on the layer mask.
When you want to return to editing the layer image instead of the layer mask, go back to the Layers tab and click on the thumbnail of the layer image.
After the layer mask is completed, export the texture to .dds, or export to raw .tga and use AMD's Compressionator. Save the GIMP project file.
For Sins: Rebellion's new skyboxes we also optimized them using AMD's Compressonator tool. It yielded significantly smaller file sizes with fewer compression artifacts/degradation than other tools. -- Yarlen
Environment Cube
A cube map is a series of six textures that are combined together in the shape of a cube to give the illusion of being surrounded by an environment. They are usually made from a series of six texture maps stitched together onto the sides of a cube and behave similarly to standard texture maps.
Remember that SoaSE only uses Environment Cubes for reflections on models in game.
Note: SoaSE environment cubes are attached to the camera in game.
There is a script for GIMP that will cut the above shapes into separate layers and save as a .DDS texture, but will not work on the style Blender creates shown below.
Cubemap Layers Generator
This 6 sided cube map image was created in Blender by placing a cube inside the textured sphere skydome with the spheres normals flipped (flip faces) so the texture points inward and gets projected onto the cube.
You can do any post-production here. It looks like SoaSE upped the brightness/contrast and played with the colour ramp a bit before chopping the images and placing them on the separate 256 x 256 layers.
From Blender, the created cube faces are in the following order.
To test the cube in Blender, the 2 sections with the arrows need the UV's to be rotated 180°.
- Download to edit/customize this Gimp text layout file.
- Download the example Environment Map Gimp file.
- Download the Environment Map Blender scene file.
This is the order in GIMP of the imported skybox03environmentcube.dds from the SoaSE textures directory.
Load the six image clips into GIMP as separate layers.
When everything is setup, you can export the .dds file. Under 'Export As' select .dds and name your file (make sure the file name has the .dds extension). Some pop-up options will be presented if you have the .dds plugin installed correctly.
Inside the Environment Cube in Blender
Blender Skydome and Environment Cube
Note: If you create a new sphere with new UV's in Blender, it will have to be exported (.obj) and imported into Softimage|XSI for export to a SoaSE mesh. The included Blender file will have the 2 types of spheres and the existing SkyboxBackdrop's packed. I recommend copying one of the existing textures and painting the new one, and use the included Blender file to create the skybox environment cube for the in game model reflections.
If you plan on following the video below, note that he uses Blender particles to create stars. SoaSE has assets you can attach to these particles and follow along. Typical install directory.
C:\Program Files (x86)\Steam\steamapps\common\Sins of a Solar Empire Rebellion\Textures
- StarscapeStar0.dds
- StarscapeStar1.dds
Also note that the tutorial saves the images as .PNG which uses compression. Always save the textures as lossless Targa Raw (.TGA), then convert to .DDS for use in game. Always save the original assets in lossless form. BMP is also lossless, but does not allow transparencies.
SkyboxBackdrop.7z
Includes the 7 stock skydomes with textures packed.
Includes the .obj for each type of sphere for use in other 3D programs.
The EnvCube is created but not set-up in the Blender scenes. Follow the steps outlined below.
EnvCube
Select the EnvCube.
Select the materials tab.
Add a new material.
Select the Textures tab.
Add a new texture.
Expand the "Type:" list
Select "Environment Map"
Scroll the properties window down to expand the Environment Map section that is now available.
Set to "Static"
Select the object, in this case the cube called "EnvCube"
Set the Resolution to 256, the same as SoaSE uses.
Press F12 to render.
Go back to the Properties >> Environment Map
Beside the "Image File" button there is a black arrow button. Expand the button and select "Save Environment Map"
Open the new .PNG image in GIMP.
Select 'Rectangle select'.
Hold the left mouse down over the image and make any size selection box.
Make precise adjustments to the size of the selection under the 'Tool Options'.
Copy the selection [ctrl+c], then paste [ctrl+v].
In the Layers tab, right click on the new 'Floating Selection' and select 'To new layer.
Repeat these steps until all 6 sections are copied to a separate layer. Keep the sizes at 256 x 256 and use the positions below to make the cuts. Make sure after creating every new layer, that the main image is selected again under the layers tab before making the copy.
- 0, 0
- 256, 0
- 512, 0
- 0, 256
- 256, 256
- 512, 256
I made a couple test cube models to test the reflections in game. The -da green (Specular) and blue (Chrome) channels are solid white giving it a glass effect.
Env Test mod is coming.
Here you can see that the skydome has no effect on the reflections, but the faces are not lining up.
After some experimentation rotating the faces, the EnvCube matches much better.
After painting, add particles.
HDRI Blender World Backgrounds
Start a new scene and switch to Cycles Render.
Create, import or append one of the skydomes you wish to make a world background for.
In the 3D view port properties window [n], uncheck Grid Floor and check Backface Culling to see inside the skydome.
Under Material, click use nodes and open a Node viewer.
- Texture > Image Texture
- Shader > Emission
Image Texture > Emission > Material Output.
Hide everything except the parts of your scene you want to put in the environment HDR (or put them on separate layers).
This step isn't necessary, but it makes things easier.
Add a new your camera at the the center point, set the rotation and location values to 0.
Make it the active camera (Ctrl+Numpad 0).
In the Camera tab under Lens, set it to Panoramic, and the type to Equirectangular.
I renamed the camera
Camera.HDR
In the Render tab under Output, set the output format to OpenEXR
In the Render tab under Dimensions, the Resolution setting is the size of the image to be saved.
A 1920 x 1080 saved the SkyboxBackdrop3.dds (4 mb) skydome to a 18 mb .EXR file.
In the UV/Image Editor, select
Image > Save As Image [F3]
It should be set on OpenEXR.
Select name and directory, and Save As Image button.
In the World tab under Surface, select Use Nodes and open the Node Editor.
Note: This tutorial is based off of SoaSE skybox 3 set. Rename this World to World.003
Create another world viewer called World.000 and use and RGB to set the colour to solid black.
In the Node Editor, make sure the World button is selected.
Add the following nodes [shift+a]
- Input > Texture Coordinate
- Vector > Mapping
- Texture > Environment Texture
Map the new .EXR image to environment texture of the background.
To see it in the real-time view, in the 3D Viewer, set the view camera to perspective, not orthographic [Numpad 5].
In the 3D Viewer properties [n] under Display, select World Background.
The World renders scenes much faster and is a good scene light source. Add many models into a .EXR. There is no Alpha or Mask, all stars and objects will be in front unless added previously into the .EXR.
The Skydome adds to render time but is more flexible. Use a mask to allow a star field or other objects behind the skydome.
If you wish to switch between the two types of scenes a lot, you may want to line up the skydome with the world background. In this example, rotating the Z rotation -90 degrees in the World's Mapping node.
Open each image below in a new tab [default] and compare.
Skydome
World
Create a cube [shift+a] to show the reflections.
Add a new material node.
Delete [x] the Diffuse shader.
Add a Gloss shader and connect to Material Output.
Set the Gloss shader Roughness to 0.
Before and after applying the mask.
Skydome Mask Off
Skydome Mask On
See also: post 1