Getting to know the Irrlicht 3D engine - Skybox

Dec 11th, 2009 by mcasperson

In this tutorial we add a sky box to an outdoor scene.

DOWNLOAD THE DEMO AND SOURCE CODE

RETURN TO THE TUTORIAL INDEX

Sky boxes are used to surround a 3D scene with a distant vista. The camera can never reach the edge of the sky box, making it look like it is infinitely far away. Sky boxes are used to give the “sky” in a 3D scene a nice appearance, rather than being a solid colour or having to enclose a world with solid walls.

Sky boxes are made up of 6 textures. The Irrlicht SDK comes with some sample sky box textures, or you can make your own with programs like Terragen. Hazel Whorley has created a number of beautiful sky box textures with Terragen, which you can download from her site.

Adding a sky box to an Irrlicht 3D scene is very easy. To demonstrate we will add a sky box to the terrain that was created in a previous tutorial that can be found here.

The ISceneManager addSkyBoxSceneNode function takes 6 parameters, one texture for each side of the cube that makes up a sky box.

ENGINEMANAGER.GetSceneManager()->addSkyBoxSceneNode(

ENGINEMANAGER.GetVideoDriver()->getTexture ("../../media/up.jpg"),

ENGINEMANAGER.GetVideoDriver()->getTexture ( "../../media/down.jpg" ),

ENGINEMANAGER.GetVideoDriver()->getTexture ("../../media/west.jpg"),

ENGINEMANAGER.GetVideoDriver()->getTexture ("../../media/east.jpg"),

ENGINEMANAGER.GetVideoDriver()->getTexture ("../../media/north.jpg"),

ENGINEMANAGER.GetVideoDriver()->getTexture ("../../media/south.jpg"));

And that’s it. With that one function call you have added a sky box to the scene. As you can see a good looking skybox can add a huge amount of depth to a scene.

In addition to the sky box textures on Hazel Whorelys site, a Google image search for sky box will also pull up a few nice textures that you can use.

mcasperson

Written by mcasperson

Rate this Article:

Rating: 5.0/5 (1 votes cast)

Add new comment

* You must be logged in order to leave comments, please Sign in or join us.

Comments

No comments yet, be the first to comment on this article.

Related Content