Documentation/Tutorials/Making sky (sky box, sky dome and other methods)

From NeoAxis Engine Wiki

Jump to: navigation, search
Go to higher level
Creating sky29.jpg

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.

Creating sky1.jpg

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.

Creating sky2.jpg

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.

Creating sky3.jpg

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

Creating sky4.jpg

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.

Creating sky5.jpg

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.

Creating sky6.jpg

You can now change the properties of the SkyDome. A complete description of the parameters is available here

Creating sky7.jpg

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.

Creating sky8.jpg

Name the folder as you wish. We will use NewSky. Right-click the newly created folder and click New Resource.

Creating sky9.jpg

In the window that pops up, select the Entity type and click Continue.

Creating sky10.jpg

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.

Creating sky11.jpg

The NewSky.type entity is now created and we can begin to customize it.

Creating sky12.jpg

As this object has to placed in our game using the Map Editor, we set the AllowEditorCreate value to True.

Creating sky13.jpg

We need to add a mesh to the CameraAttachedObject. Press the button "..." in the field of Items.

Creating sky14.jpg

Click Add and select MeshItem to add as a member item.

Creating sky15.jpg

Now choose the file with a mesh by pressing the button "..." in the MeshName.

Creating sky16.jpg

As an example, we can choose an existing mesh in NeoAxis Engine - BlueDaySky. When the mesh is selected, you press the OK button.

Creating sky17.jpg

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.

Creating sky18.jpg

Save the sky created in the Resource Editor

Creating sky19.jpg

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.

Creating sky20.jpg

We now get a real sky in our map editor.

Creating sky21.jpg

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.

Creating sky22.jpg

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.

Creating sky23.jpg

Double-click on the file of material to go into edit mode.

Creating sky24.jpg

We are interested in the Diffuse parameters of the material.

Creating sky25.jpg

You will noticed that the material is assigned two textures. The first texture - Sky.dds, is a panoramic image of the sky.

Creating sky26.jpg

The second texture - Clouds.dds, shows the cloud formation.

Creating sky27.jpg

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.

Creating sky28.jpg

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.

Creating sky29.jpg