Rendering Skybox

A skybox is a panoramic view representing a sky or any other scenery. It is a simple way to add realism to a game with minimal performance cost. A skybox is generated from a cube. Each face of the cube contains a texture representing a visible view (up, down, front, back, left, right) of the scenery.

Skybox Example

image

The Untold Engine represents a skybox as a U4DEngine::U4DSkybox object and initializes the skybox with the U4DEngine::U4DSkybox::initSkyBox method.

Step 1. Create a Skybox instance

To instantiate a skybox, you must create an instance of the U4DEngine::U4DSkybox as shown below:

U4DEngine::U4DSkybox *skybox=new U4DEngine::U4DSkybox();

Step 2. Initialize a Skybox

Once the skybox has been instantiated, you initialize the skybox with the images representing the scenery and the size of the skybox.

//initialize the skybox
skybox->initSkyBox(20.0,"LeftImage.png","RightImage.png","TopImage.png","BottomImage.png","FrontImage.png", "BackImage.png");

//add the skybox to the scenegraph with a z-depth of -1
addChild(skybox,-1);

Here is an example of a Skybox added to represent a space scenery:

image

Tip

  • All skyboxes images need to be inverted (flipped) verticaly.
  • The images representing Top and Bottom must be rotate 180 degrees and then inverted vertically.