SkyBoxes and stuff

Anyone have any idea how I can make a skybox, or even have a background image like in doom? I dont want to have to make a massize texturemapped quad, im looking for a pretty fast method.


Well, the massive textured quad (cube actually) is probably the fastest way.

i’m not an expert, but i think that it’s possible to draw a dome instead of a box,
but i don’t think it will be faster…

the draw of a big square is as slow as that?


Dont you incure penalties for drawing a massize cube and texturing it? cant i just turn off depth testing, and draw a +z facing quad the size of the viewport, just -1z into the screen, then turn on depth testing and draw the scene?

Yes you can, but only if you want the background to be static and not a 360 degree skybox. Of course you could adjust the texture coordinates to simulate motion, but that creates problems of its own. When drawing the cube, you’d only be drawing no more than 3 sides. And if you draw it last with depth testing turned on, you would not even be updating all of the pixels.

[This message has been edited by DFrey (edited 09-02-2001).]

the fact that most FPS games quake/UT etc use a skybox generally means it prolly is the best method. it certainly is the simplist (which is good)

also what DFrey said is a good point, u may of heard before draw the skybox first to wipe the depthbuffer (ie u dont need to clear it, most games do it ths way quake etc)
but ive found its best to clear the depth/colour/buffer draw the scene and then draw the background last.
filling the whole screen with a texture is far slower than clearing the buffers esp now when cards are becoming optimized for fast clears.

though this of course depends on what your scene looks like eg if a lot of the skybox is showing then the first method might be the best.


i also want to do a sky"box" and was actually thinking about a dome.
now, do you think a cube is sufficient enough regarding “realism”. i haven’t tried it out, so i am asking first


Well a box is definetly sufficient as far as realism, if you think about a static background.

I’ve used It and if you remember to use GL_CLAMP for textures it looks good, at the right texture resolution.

I’ve seen games with a cool skybox, visually interresting, and some others games with a bad skybox where you see the edges of the cube, like serious sam.

someone has taken before of a programm to generate the sky textures, i don’t remenber the name.


Yes, your textures for the sybox must be made with a 90 degree fov or else the seams of the skybox will likely be visible. Many people have used Bryce and Terragen for making skybox textures (easier to do with Bryce I think).

My dynamic cube mapping demo on uses an nvidia cube map as a sky box.

I just draw a cube with no z writing on, before anything else. Works fine. There are probably slightly faster methods, as I’m doing a full screen write, every frame.


It’s interesting how different people use different methods. I played around with the source code of an N64 emulator and looks like Mario 64 is using a projected texture onto a background of QUADS. Looks very nice.

Sky boxes look too cheap I think. A dome would be better or using a projected texture.


A skybox with proper textures looks fine and does not look like a box. Regardless of the method you choose, the goal is the same, to produce an illusion of a far away horizon. All methods mentioned so far can do that equally well, just at varying speeds.

How about a single quad, drawn before anything else. You could just have a texture which is 4 times the width of the quad. On rotating the scene, shift the texture coordinates. Which of the techniques mentioned in this thread do you thing would be the quickest.

Im doing a sort of FPS, where you can look out windows and see ‘outside’.

It basically all depends on what you want. That would not be a good idea if you wanted to be able to look up and see clouds or stars for example (unless you were projecting multiple textures). Also remember that the maximum texture size implementation dependent, so your sky texture may end up being too big and you’ll have to either split it and the sky quad or else scale down the texture and in the process make it blurry.

guan shui

haiiii sa!