Programming 3, Skybox
|
This week we have been creating a skybox in our 3D-project. Tho create a skybox there are two things you must keep in mind; that you always is in the skybox (important for culling) and that a skybox isn’t an object in the traditional meaning. Let’s compare the skybox to our box. A box has several sides built up from vertices, in this aspect the box and skybox is almost identical, only thing that separates them are that the skybox does not have a bottom side, well there are a bottom side but it should never be seen so how you handle it’s textures does not have great importance. But we want our skybox not to be seen as a barrier that is obvious to the player’s eye, right? Well we are creating the skybox from the texture seen beneath. But the texture itself has white boxes in the corners. These boxes are there because it is nearly impossible to make a round object flat and not have distance errors and scale errors. By adding the white boxes we can keep the scale and distances but it also complicates the creation of the skybox, well mainly the texturizing of it.
The texture used. To calculate the position of the boxes we can either make an estimation of where they start and end in our normalized vectors. For this example you can go with the real texture starting ¼ in to the texture file. But if you really want an accurate projection of the texture you can check on the pixel where the sky texture starts and then add it into vectors and then use them as referral points for the other sides of the skybox. One thing I have not written about is that the skybox does not need to have a normal vector or a world position since we do not want the “sun” to reflect on the surface and we want the skybox to act omnipresent. And here’s how the box looks in its current state.
|

