XNA Essentials

Game Programming for Xbox 360, PC + Windows Phone



Hi Chad,

In your Microsoft XNA Game Studio 3.0 Unleashed book, you used an image, skybox.tga, as the skybox image. I am trying to create a new .tga image to replace it, but I am not sure of what are the requirements for it. I have created a new .tga image with the six sides in correct order but upon loading of the game itself, the skybox does not appear, and there are no errors upon compile time.

Any assistance rendered would be greatly appreciated. Thank you!

earthling - Monday, March 1, 2010 @ 4:00 AM

Re: Skybox

1024x512 - where it says (in the code): width=1024 and height=512, the cellsize=256.

This allows for technically 8 possible squares that are 256x256. We only use 6 for a Cube.

for one square it goes (0,0) to (256,256). next square would be (256, 0) to (512, 256), third (512, 0) to (768, 256), fourth (768, 0) to (1024, 256)

fifth (0, 256) to (256, 512) - and finally the sixth is (256, 256), (512, 512).

slooksterpsv - Thursday, March 4, 2010 @ 3:49 AM

Re: Skybox

Hi, another question: how do we define the size of the skybox that is generated?

earthling - Saturday, March 6, 2010 @ 11:10 AM

Re: Skybox

Check the Using the Skybox section in Chapter 8.  The skybox will be created at unit scale (1.0) and you can scale it up or down to fit your world needs.

world = Matrix.CreateScale(5000.0f);
skybox.Draw(camera.View, camera.Projection, world);


Hope this helps!



Chad Carter - Sunday, March 7, 2010 @ 2:55 PM