Game Development Reference
In-Depth Information
Adding a skybox
Looking into infinite blackness isn't very exciting; Sandbox.CreateSkyBox allows us
to create a skybox defined by the six textures specified in the Ogre material ( media/ma-
terials/skybox.material ). If you're unfamiliar with skyboxes, they are essentially
six-sided boxes with a different texture on each face of the box. As the camera moves
around the sandbox, the skybox moves accordingly in order to give the illusion of an actual
sky.
Tip
The sandbox comes with multiple skybox materials. Take a peek at the sky-
box.material file in any text editor to see other available skybox textures and how to
create your own brand new skybox material.
Our Sandbox.CreateSkyBox function takes in three parameters: the sandbox itself,
the name of the Ogre material, as well as a rotation vector. The rotation vector is represen-
ted in degrees and allows us to add an initial offset to our skybox. In this case, we can ro-
tate the initial skybox by 180 degrees to have the sky textures match the directional light
we created previously:
Sandbox.lua :
function Sandbox_Initialize(sandbox)
...
Sandbox.CreateSkyBox(
sandbox,
"ThickCloudsWaterSkyBox",
Vector.new(0, 180, 0));
end
Running the sandbox now will show a cloudy sky and a lit environment.
Search WWH ::




Custom Search