Skyboxes and backgrounds

Skyboxes are backgrounds that create the illusion of space and distance. Typical skybox backgrounds include skies, clouds, mountains, and other scenery. As skyboxes are prerendered, they require little GPU and CPU.

You can use cubemaps or 360° panoramic textures as skyboxes. You can also use them to light the scene.

Note

Currently, Xenko doesn't support skydomes or local skyboxes.

Alternatively, you can display a 2D background, which is often useful for 2D games.

A cubemap is a six-sided texture. When these textures are assembled in a cube around the scene, the cubemap simulates spacious 3D surroundings.

Merged skybox

Currently, Game Studio can't convert image files to cuebemaps ( files). Use another application to create a cubemap from separate image files, such as:

You can capture a cubemap from a position in your scene.

  • In the scene editor, position the camera at the point where you want to capture the cubemap. The direction the camera faces doesn't matter, only the position.

    Typically, you should capture cubemaps at the center of your scene to create the best all-round view.

  • In the scene editor toolbar, open the Lighting options menu.

  • Browse to the location on disk you want to save the cubemap, specify a name, and click Save.

Tip

We recommend you save the cubemap in your project Resources folder. For more information, see .

Game Studio creates a cubemap .dds file in the location you specified.

360° panoramic textures

Instead of using a cubemap, you can use a 360° panoramic texture as a 3D background.

Image courtesy of Texturify

Note

Remember that affect the appearance of your skybox. If it doesn't look how you expect, try changing your post effect settings.

You add these like other color textures.

  • In the Asset View, click , select Textures > Color texture, and browse to the file.

Select texture as asset type

  • Alternatively, drag and drop the file from Windows Explorer to the Asset View, then select Color texture.

To create a skybox, add a cubemap or 360° panoramic texture to a background component.

Xenko includes an entity with a background component in the project by default. Only one background can be active in a scene at a time. If there are multiple backgrounds, Xenko only loads the first.

Add a background entity

  • In the Scene view, select the entity you want to add the component to.

    This can be an empty entity. Its position in the scene doesn't matter.

  • In the Property Grid (on the right by default), click Add component and select Background.

Add background component

  • Under Texture, select the cubemap or 360° panoramic texture you want to use in the skybox.

Use a skybox as a light source

You can use a skybox to light the scene. Xenko analyzes the skybox texture and generates lighting using image-based lighting (Wikipedia). For more information, see .

The following code changes the cubemap in a background:

Various tools exist to convert a panoramas to cubemaps and vice versa, including:

Set a 2D background

Instead of using a 3D skybox, you can display the texture as a static background. This displays the texture as a flat image that stays static no matter how you move the camera. This is often useful for 2D games.

To do this, in the Background component properties, select 2D background.

Background component properties

If you enable this with a cubemap, Xenko uses the first face of the cubemap as the background.

See also