Creating Skyboxes with Terragen
From Multiverse
| Multiverse Tools |
|
Overview • Installing |
| Tools UI References |
| Working with Terrain |
|
About Terrain • Using L3DT Pro • Using EarthSculptor • Using PnP TerrainCreator • Importing Heightmap Terrain • Using Mosaic Creator |
| Other Tools |
|
Third-Party Tools • Creating Skyboxes with Terragen |
by Christopher Schenck
Art Director, The Multiverse Network
Contents |
Overview
Skyboxes are one of the main tools in creating mood and—dare I say it—atmosphere in a world. Once you have successfully created a skybox and put it into your world, you will be able to change lighting and fog settings to create a seamless environment. This short tutorial explains how to create a great-looking skybox and use it in your world.
Because of the nature of the 3D environment in a virtual world, the camera (player character) position is always at the center of a cube. This places the horizon at the midpoint between the top and bottom of the cube at all times. Normally, as you move your PC in the game, this would not matter. However in some situations, the location of the horizon becomes an issue. For instance, if a player is following a quest to go to the top of a large volcano to save a human sacrifice from horrible liquid-fleshed zombies, at the top of the volcano he might turn and look out at the vast panorama of the game world. He would then see a horizon that has moved vertically as he moved up the side of the mountain. He would still be able to see the 3D terrain below, and the two would not match. At this point as a game designer you have committed the biggest sin of all: breaking the immersion of the player in the gameworld.
By taking the sky and reversing it to create a limitless, waveless ocean beneath, you can minimize the effect of this immersion-breaking moment. The discerning viewer will still be able to see that the ground and far horizon do not match, but it will be much less noticeable. If, say, you had a red Martian desert landscape below the horizon in your skybox, and you looked out from that mountaintop you would see the ground fade off to two different horizons. There are other strategies to deal with horizons and distant terrain features, but in the interests of saving space I will discuss these in a subsequent article.
Introducing Terragen
| For this tutorial, you are going to use Terragen, a scenery generator tool that is free for personal non-commercial use. You are going to use Terragen to create a seamless sky and seamless flat reflective ocean that diminishes into infinity. First, download and install Terragen from the Terragen website. For complete documentation, see the Terragen User Guide. Open Terragen and explore the interface. Notice the set of buttons down the left side of the window. Each of these opens a dialog box controlling one aspect of the scene you are creating. The appearance of the skybox is affected by the ones shown at left in bold. |
Creating a skybox
To create a skybox for a Multiverse world with Terragen, follow this procedure:
- Set water properties
- Set lighting condition properties
- Set atmosphere properties
- Set cloudscape properties
- Set rendering control properties
- Render the skybox
Set water properties
-
Click on the Water button to open the Water dialog box. Use this dialog box to create a flat waveless mirror-like surface for your ocean:
- Click on the Waves tab, and set the following values:
- Water level: 0. m
- Wave Properties: roughness: 0, wave size: 0, Visibility Effect: 200
- Click on the Reflections tab, and set the following values:
- Overall Reflection Properties: Max Reflectivity: 100%, Reflectivity Curve: 100
- Reflection of Lightsources: Direct sunlight 100%; Reflection spread: 10
- Ignore the Sub-surface and Shore tabs for now. The important thing is to keep the water level correct and the reflectivity high.
- Click the close [X] button in the upper right of the dialog box to accept your changes.
- Save your world file to a directory on your desktop; Terragen defaults to a directory in the Terragen folder of your program files directory.
Set lighting condition properties
- Click on the Lighting Conditions button to open the Lighting Conditions dialog box:
- Make the following changes:
- Set the Sun Heading to 90 and the Sun Altitude to 45. This will place the sun at an approximate 10 AM location. In this dialog box, you can place the sun anywhere in the sky, so it is important to consider direction and time of day. Using the default orientation of "north is up," as on a map, keep the sun heading close to either 90 (East) or 270 (west), and you can vary this according to whether you want to reflect a position either north or south of the equator. Of course, these conditions mimic Earth's, and you may want to deviate completely from this for your gameworld.
- Set sunlight strength to 150%
- Set effect of atmosphere at 100 %
- Keep Base Sun Color RGB values at 256. This will give you a normal daylight color under the Realistic Sunlight Penetration System radio button.
- Although you're not going to make any changes right now, you can select the Specify Sunlight Color radio button and click Colour of Sunlight to change the color of the light.
Set atmosphere properties
-
Click the Atmosphere button to open the Atmosphere dialog box:
- For the sake of simplicity, keep the atmospheric global haze effects settings: all 20% density and 2048 m half-height. Later you can go back and experiment with different haze effects and get some interesting other-worldly efects.
- Click the close [X] button in the upper right of the dialog box to accept your changes.
Set cloudscape properties
- Click on the Cloudscape button to open the Cloudscape dialog box:
This dialog box enables you to determine the extent and size of the clouds. You can't control individual clouds, but rather the general parameters of the cloud cover. - Click Generate Clouds to open the Cloud Genesis dialog box:
Move the Largest Cloud Size slider to determine the size and frequency of the clouds within their random distribution, then click Generate Clouds to display an example preview of the cloud distribution. Pick a value that looks good to you. - Click the close [X] button in the upper right of the dialog box to accept your changes.
Set rendering control properties
- Click the Rendering Control button to display the Rendering Control dialog box:
Use this dialog box to see small previews of your sky. The preview window is small, so you really are just looking at color, to see if what you set in the controls reflects what you want for your sky. If this is too small, you can always do a render to see how it will look, saving time by setting the render size to a manageable 256dpi. Most of the time, the preview window is good enough if you set the slider under the window to its highest detail setting. - To get a good preview, use all the default settings except for the Camera settings.
- Click Camera Settings to display the Camera Settings dialog box:
- The Zoom/Magnification setting shows the default value of 1.414, which causes the images to line up incorrectly. Change the value to 1.
- Click Close to accept your change and close the Camera Settings dialog box.
- Click Render Settings to dislplay the Render Settings dialog box:
- Make these changes:
- In the Quality tab, move the Atmosphere and Cloud Shading sliders all the way up to high.
- Check the option for Fast Sub-Pixel Smoothing. If you are using the registered version of Terragen, also check the Ultra and Extra Blended Detail checkboxes.
- Click the Options tab and make sure the defaults are selected: back-face culling enabled, and the Gamma Correction is set to 2.
- Click the Image tab, and set the aspect ratio to a square (height and width the same), and check on the Lock Aspect Ratio checkbox. This is important because the default size is 640x480, a rectangle, and rectangles do not make good skyboxes. The bigger you can make your skybox, the better it will look in the game. 2048 x 2048 works well, but may be too big for some purposes. Rendering a 2048 square image will take 15 to 30 minutes, depending on the speed of your computer. During the conversion process, you will take your rendered images and reformat them to .dds, which reduces the file sizes significantly. Rendering time on some machines may take a while at a larger size, but it is worth it. In any case, don’t go below 512 x 512 to maintain reasonable quality.
- Quicker Rendering Tip: 512 X 512 looks fine in most situations. Also, deselect the land rendering box since it will be hidden anyway by your terrain and the rendering will go almost twice as fast - LightninBoy
- Click Close to save your changes and close the Render Settings dialog box.
- Click the Render Preview button to see how your sky looks. If you like what you see, then it is time to render your skybox.
- First, though, save your Terragen world file: Choose World File | Save World.
Render the skybox
- In the Rendering Control dialog box, set the Camera Orientation for five different shots, one for each compass direction and one for directly above. If needed, you can also set and render a shot for the bottom of your skybox, but this is generally unnecessary.
Set the following values for the Camera Orientation fields:Direction Head Pitch Bank North 0 0 0 East 90 0 0 South 180 0 0 West 270 0 0 Top 0 90 0 - For each direction, click Render Image. The images should look something like those shown below.
- After Terragen finishes rendering, save the image by clicking on the Save button in the upper left corner of the rendering window. You have only one option: saving as a bitmap (.bmp) file. Save each image for the five different directions needed to build your skybox with a meaningful name, such as "test_sky_north," "test_sky_east," and so on.
Importing the skybox
Now that you've created your skybox images, you obviously want to be able to use the skybox in your world. To do this, you have to make it available to Multiverse World Editor.
- First, optimize and test the skybox images. Open your skybox bitmap files with Adobe Photoshop or other digital imaging software. If you don't have Photoshop, GIMP (http://www.gimp.org/) is a good free software alternative. However, it can't save .dds files, only .tga (which will work with Multiverse). There is a plug-in for saving DDS textures, which can be found here: http://registry.gimp.org/plugin?id=4816.
- Look at the images side by side to see if the edges line up. Now re-save these files as .dds or .tga files and you are ready to import skybox into your world. Let's say we saved them as North.tga, South.tga, West.tga East.tga and Top.tga.
-
Now you are going to create a material file for the skybox. To do that, create a text file, named
MySkyBox.materialin the same directory where you saved the skybox .tga files. Replace MySkyBox with the name you want to use for the skybox. -
Now, copy and paste the following into the text file:
material Multiverse/MySkyBox { technique { pass { lighting off depth_write off fog_override true texture_unit { cubic_texture North.tga South.tga West.tga East.tga Top.tga Blank.dds separateUV tex_address_mode clamp } } } }NOTE: the "cubic_texture" texture line is shown above on two lines for readability, but must be on a single line.
- Edit the file and replace
North-texturewith the name of the .tga or .dds file for the north sky image,South-texturewith the name of the .tga or .dds file for the south sky image, and so on. Unless you have a bottom image, leave Blank.dds as the final image name (just before "separateUV"). In most cases, this should remain as Blank.dds (a file that is in the Multiverse sample asset repository) to use an empty image for the "bottom" of the skybox. - In the first line, replace "MySkyBox" with the name of your skybox. This must match the file name.
-
Now, open Multiverse Asset Importer tool and do the following:
- Choose Material in the Type dropdown and Skybox in the Category dropdown.
- Enter a description in the Decription field.
- Click on "Browse..." next to Material, browse to the directory where you saved the material file, and select it. Asset Importer will display all the files in that directory in the file list, and set a default name for the material asset definition.
- Drag the five skybox image .tga files from the file list to the Optional Textures field.
- When you are done, Asset Importer will look like the figure. Click Save to save the asset definition to your asset repository.
-
In the
AssetDefinitionsdirectory of your asset repository, edit the asset definition file,MySkybox_Material.asset. Add the following lines just after the <Type> tag and just before the <Files> tag:<Category>Skybox</Category> <Properties> <Property name="AssetName" value="Multiverse/MySkybox" /> </Properties>Change the name after Multiverse/ to your skybox name in your materials folder. When you are done, the beginning of the file should look like this (except with the name of your skybox):
<?xml version="1.0" encoding="utf-8"?> <AssetDefinition> <Name>MySkybox_Material</Name> <Description>Skybox for tutorial</Description> <Type>Material</Type> <Category>Skybox</Category> <Properties> <Property name="AssetName" value="Multiverse/MySkybox" /> </Properties> <Files> ... -
When you run World Editor:
- In the object browser, click World.
- Then click Skybox.
- In the properties sheet, the name of your skybox will appear in the SkyboxName dropdown list. When you choose it, World Editor will display the sky.

