• entries
    169
  • comments
    54
  • views
    130669

Skybox

Sign in to follow this  
VBStrider

996 views

A skybox is used to add a background to a 3D scene. Things which are so far in the distance that they can be drawn into a 2D texture, such as the sun, distant mountains, and unmoving clouds, are part of the background. It is literally a box with the camera at its center. As the camera moves, the skybox follows it. Because the background doesn't move as you move, it appears to be very far away. The skybox doesn't rotate with the camera though. Picture a cardboard box ontop of your character's head and you have about the right idea.

Using a skybox is pretty easy. Making the texture for it is a bit difficult, but fortunately us programmers can leave that to the artists. To use a skybox, you first need a cube which has the sky texture applied to its inside. You could create this in the game, or get the artist to create it as a model and load it in along with the other models.

There are two ways you can render a skybox. The first is to render it last, which requires a skybox large enough to enclose all of the visible geometry. The second is to render it first and then render the rest of the scene ontop of it. This method allows you to use a smaller skybox (just big enough to fully enclose the camera should be fine) but can be slower since there is more overdraw. When rendering the skybox first, you need to disable writing to the z-buffer so that the rest of the scene can be drawn ontop of it. For either method, make sure to disable lighting before rendering the skybox, otherwise the edges will be much more visible.

Reposted from http://invisiblegdev.blogspot.com/
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now