Skybox

From FreeSpace Wiki
Jump to: navigation, search

A skybox is an invisible sphere on which a texture can be applied, which will be the background of the actual mission.

To create a skybox you must create a *.POF that will represent the sky. The normals of the skybox must be pointing inwards so the player will be able to see the textures on the skybox. You can use as many textures as needed (2 to 6 are recommended). Additional textures will prevent streching of the map across the sky, but it will render slower. Recommended texture sizes for skyboxes are 512x512, 512x1024, 1024x512, or 1024x1024. It is possible to create animated textures that will display flickering stars or random comets.

Creating a Scene to Render

The first thing you want to do is to create a scene. Usually it's going to be space. Though you can download plugins that can generate terrain based on a bitmap. The good news is that you really don't need to do much point editing. You can make an interesting scene with simple primitives. You do not need to convert anything to pof. So splurge on your polycount as much as possible. When working with renders, more is better.

TrueSpace defaults the render backdrop to grey, to make it black (the normal color of space), right-click on the Render button and some options should pop up. Right-click on Color and set it to black. The background should follow suit.

Now go to your primitives window and pull up the sphere icon. Right-click on it and enter some high numbers into the boxes, for most planets 64x64 is ok. Click on it to create your sphere. For a texture you may use the axion planet shader. This creates random planet features and lets you define a planet's colors. Using this shader can save you lots of time. To gain access to it, right-click on the paint object button, then click on the upper right sphere in the material editor, select axion planet shader from the list. Right-click on the sphere to open the shader options. Click on various colors, a color selector will pop up. Defining different colors will create different looking planets. You can adjust the various sliders to alter the texture appearance. When you are satisfied you can hit the paint button. The only problem with the shader is that it seems you can only use one set of variables in a scene.

If you want to add an atmosphere, hit control+c to copy your sphere then right click on the arrow button, then it the keyin box to slightly increase the size of the sphere. You can use the clouds shader along with filter transparency. Select the shader by clicking on the top left sphere then selecting clouds from the list. The upper right sphere controls transparency right click on it and select filter. set both the cloud back color and transparency filter color to black. cloud color can be changed for different effects. now paint the outer sphere. if you were to render the scene right now you would have a nice looking planet.

To render nebulas, you want to use filter transparency (set the color to the same color you want to be transparent, usually black). I prefer to use texture map as my shader. you also want to change your reflectance (lower left sphere) to constant, otherwise you will see the edges of the primitive you texture. You can apply the material to an object with the paint button, such as a plane or sphere. Then place it off in the distance somewhere. To create large wrap around nebulas you can make a really big sphere and flip the normals and apply your material.

Play around with various stuff, you can add rings and background nebulas and distant asteroid belts, but I'm not going to go into that in too much detail. Realistically, you will want to make an elaborate scene. There are plenty of filters to choose from. Play around with the material editor as much as possible. It is very easy to make cool stuff with it.

Rendering the Textures

Once your scene is complete, pick a central location to render from. In that spot, create 6 cameras. It is critical that they have the same origin. rotate the cameras with the numeric key-in window. Make it so that a camera points in each directin. Each camera must be perfectly parallel to whatever axis it is pointing down. Now the default camera angles are too narrow to render the box correctly. Changing the size value of the z axis of the camera essentially changes its zoom. Setting that number to exactly 0.4 will make a seamless box (at least it did for me).

Go back into the Render options. Set quality to high, visibility to raycast, anti-aliasing is optional, but I use adaptive. Make sure the ratrace toggle button is down. Double check to make sure your background color is black. Select a camera and then click the view from object button in the view group. Click on render scene to file. In the Resolution section of the Render dialog, select other and key-in whatever resolution you want to use. It should be square. Give the image a name and choose a format. If you use .tga be sure you render to 24 bit. If you pick 32bit, it will include an alpha channel that FreeSpace probably won't appreciate. Repeat for each camera. I'd advise the use of a naming convention to identify the set of bitmaps, such as skyname_front.

Texturing the Box

Start a new scene and create a plain cube with a resolution of 1. Now the first thing you must do is UV map the box. Click on UV Projection, select cubic UV projection. In order to eliminate the lines that apear at the edge of the texture, you must slightly scale up the projection cube. I find that increasing its size from 2.0 cubic meters to about 2.003 cubic meters is about enough to get rid of the lines without being able to detect the seams. When you are done, hit apply. Now get into the material editor and select texture map and pull up one of the images you just rendered. Using the paint face tool, paint the corasponding side on the cube. do that with each of your textures so that they line up. You may find that the top and/or bottom textures are not properly oriented. The best way to fix that is to open those textures in a paint program and rotate them so they line up with the others. once your box is seamless, scale it up to about 1400 cubic meters and flip the normals. glue it to a light and save the scene. Run it through PCS with a conversion factor of 20 and save the mode. If necessary, convert your textures to a format supported by FreeSpace.

Alternative to this process

If you don't want to do all of the above, you can easily create your skybox textures in Photoshop, Paint Shop Pro, GIMP, MS Paint, or whatever floats your boat. You would then apply your maps in trueSpace and convert the COB into a POF.

Adding Skyboxes to Missions

Put your skybox model into the models folder and your textures in the maps folder. In FRED, open up the Background Editor dialog. Near the bottom, there is an edit box where you can type in the name of your skybox. The file extension *.POF is optional. It is not recommended to use standard bitmap nebulas in addition to the skybox.

In order to add the standard upgraded skybox, write starfield.pof.