Documentation/Tutorials/Making sky (sky box, sky dome and other methods)
From NeoAxis Engine Wiki
| Language: | Status: | Approved |
Contents |
Introduction
In this article, we will explain how to create sky maps for your game.
In the NeoAxis Engine there are several ways to create sky, using:
- Sky Box type - An entity type that is in the shape a cube, with the sky texture superimposed on its walls.
- Sky Dome type = An entity type that is in the shape of a hemisphere, with the texture of the sky and floating clouds.
- CameraAttachedObject object - An object that draws the sky based on the mesh and the materials assigned to it.
We will explain each method in the sections below, whereby you can notice the results and identify which method is suitable for you.
We will use a map that consists of a Water Plane in the Map Editor to demonstrate the different methods.
Using a Sky Box
The first way to create a sky in the Map Editor - is to use the Sky Box. The world of the map will be placed inside a cubic structure and the walls of the structure will be superimposed with the sky texture. Choose SkyBox in the list of types Types -> Base. After SkyBox is selected, click on the Editor where it says Click here to create.
The sky box is now created and you can start to configure it. Select the SkyBox by clicking the check-box near it in the Map Entities window.
In the Properties window, you can adjust the brightness, color and other properties of the Sky Box. More information about the parameters of Sky Box can be found here
Using a Sky Dome
The second way to create the sky is to create a Sky Dome or, otherwise known as the celestial dome. In contrast to the Sky Box, Sky Dome is the shape of a hemisphere. Important features of the Sky Dome are:
- The support for an animated sky
- The use of up to four textures
- A separate structure to adjust smoothly blending of the horizon line
Choose SkyDome in the list of types Types -> Base. After SkyDome is selected, click on the Editor where it says Click here to create.
The sky dome is now created and you can start to configure it. Select the SkyDome by clicking the check-box near it in the Map Entities window.
You can now change the properties of the SkyDome. A complete description of the parameters is available here
Using a CameraAttachedObject
Description
The third way of creating the sky is to use a CameraAttachedObject. It is an object that is attached to the camera and follows the camera in the game world.
An example of such an object is present in the SDK on the TankDemo map. See folder \ Data \ Types \ Sky \ BlueDaySky \ in the resource editor.
Details
First you need to create a type in the resource editor. To begin we will create a directory for our sky. Right-click on the folder Types -> Sky and click on New Directory.
Name the folder as you wish. We will use NewSky. Right-click the newly created folder and click New Resource.
In the window that pops up, select the Entity type and click Continue.
In the New Entity Type Wizard, we will name the type, for example, NewSky, and select the class of object to create. CameraAttachedObject. Then click Next.
The NewSky.type entity is now created and we can begin to customize it.
As this object has to placed in our game using the Map Editor, we set the AllowEditorCreate value to True.
We need to add a mesh to the CameraAttachedObject. Press the button "..." in the field of Items.
Click Add and select MeshItem to add as a member item.
Now choose the file with a mesh by pressing the button "..." in the MeshName.
As an example, we can choose an existing mesh in NeoAxis Engine - BlueDaySky. When the mesh is selected, you press the OK button.
We must set three options for our MeshItem. First, set AllowFrustumGlobalClipPlaining to False, because the sky does not need a clipping plane. Secondly, set RenderQueueGroup parameter to SkiesEarly, to let the engine know in which queue to paint the sky. Thirdly, set ThisIsSkyGeometry to True, so the engine understands that this mesh item should be treated as sky. Then click OK.
Save the sky created in the Resource Editor
Now we shall place the sky in the Map Editor. Open the Map Editor and add theNewSky entity type and click on the Preview Window to create the entity.
We now get a real sky in our map editor.
Now take a step back, you might be aware that we used the ready-made mesh, BlueDaySky.mesh, for our CameraAttachedObject. Open it in the editor (the directory Data \ Types \ Sky) to see how it looks.
As you can see, the mesh is the internal portion of a hemisphere with a texture assigned to it. Open the BlueDaySky.highMaterial which is assigned to the mesh.
Double-click on the file of material to go into edit mode.
We are interested in the Diffuse parameters of the material.
You will noticed that the material is assigned two textures. The first texture - Sky.dds, is a panoramic image of the sky.
The second texture - Clouds.dds, shows the cloud formation.
Open the Diffuse2Map property and notice the option: Transform. The parameter named Animation has a sub-parameter ScrollSpeed that defines the speed of the clouds moving across the sky.
Note that the CameraAttachedObject no parameters such as Color and Power akin to the other methods of creating the sky.
The same effects of the Color and Power parameters provided by the Sky Box & Sky Dome can be achieved with a CameraAttachedObject by changing the settings assigned to the mesh & material.
Summary
We learned how to create a sky in three different ways:
- by Sky Box,
- by Sky Dome, and
- using an object based on CameraAttachedObject.
In your projects, you can use any of these ways. In NeoAxis Engine SDK you will the standard material for Sky Box and Sky Dome, and the type BlueDaySky - an animated sky on CameraAttachedObject. You can change the texture, setting materials, and even use their three-dimensional model for CameraAttachedObject. Also, do not forget about configuring Sky Box and Sky Dome, which you can use to create the effects of day or night and even a beautiful sunset.


















