Sunday 15 January 2012

Adding a skybox

So far the game area has consisted of my 3d objects floating in a void of blue space. This doesn't look overly impressive for a game and I don't want to have to build an infinite 3D model of a city so it looks more realistic.

Most 3D games suffer from this issue of having to give the impression of a real world environment without having to build the full visible area (unless you're building a flight sim or something!)

The common solution to this problem is called adding a skybox.

A skybox is just another 3D object (usually a cube or a sphere) with the textures on the inside and then you ensure it moves according to your camera and all of your play area is located within the skybox object.

Then your textures applied to the skybox are of the background landscape and it seems as if there is a game world past the actual game world.

This technique was actually used in many Hollywood films, where a large matte painting would be hung behind the set to give the impression of a city or a large hanger bay full of X-Wings.

So to create my skybox, all I've done is to create a 3D object in 3D Studio Max made out of 6 planes with textures applied to. Load this object into my game and scale it up so it engulfs the game area. All I need to do is make sure the camera can never leave the skybox object and it all seems to work just nicely.

There are many other tutorials on how to create skyboxes in XNA and probably better, more efficient ways than what I've done, but this works for me and for this game so no need to tinker.

No comments:

Post a Comment