PDA

View Full Version : How to construct a fast and pretty skybox?



suo_alex
01-20-2003, 07:44 PM
Dear all,

I tried to use a cube but seems the corners are ugly. I am not sure what kind of structure can make it pretty while be fast, since the skybox will take quite a large place of the view port, and I assume even I double the no. of faces the speed concern will be apparent.

And good ideas?

davepermen
01-20-2003, 10:19 PM
you said it yourself: "as it covers the whole screen"
that means its simply a fillrate issue. no mather with what big, or low amount of triangles you draw it, it will still draw say 640x480 or 800x600 pixels, depending on resolution, independend on geometry. and doubling from say 12 triangles (cube) to something with say 24 triangles simply cannot hurt performance actually, as you can draw objects with thousands of triangles....

but anyways, the edge issue is partially solveable due right texture wrapping, or if you take a cubemap and map the vertex coord directly. then geometry would actually be irrelevant..

dorbie
01-20-2003, 11:48 PM
A sky box can look good if you use the right texture on it. Ultimately your goal is to map a sky environment onto some geometry for the sky. Depending on your objectives you might assume that the sky is infinitely distant. If you have good radiometric data then any geometry could be used to map the sky correctly using texture, but for something you're just throwing together with hand painted textures you'll have an easier time using a cylinder or a hemisphere. That way you avoid the corners require a lot of artistic skill to correct for in the textures.

jwatte
01-21-2003, 05:58 PM
Use a ray tracer (bryce, pov-ray, 3ds max, whatever) to render a "sky" environment into 6 square textures, each with 90 degree FOV. This is your sky box. Actually, the textures needed for a sky box, and the textures needed for an environment map, have a whole lot in common.

If your graphics card supports borders, set up the right border texels borrowed from the neighboring textures, and turn on GL_CLAMP_TO_BORDER. Else turn on GL_CLAMP_TO_EDGE. This will hide most of the corners, assuming the textures are correctly generated.

jwatte
01-21-2003, 08:58 PM
Gah. I should know better than to write code when I get home :-)

Anyway, this was yet anoter Frequently Asked FAQ that finally got me to rip out and post some private code on the web:
http://www.mindcontrol.org/~hplus/graphics/skybox.html



[This message has been edited by jwatte (edited 01-21-2003).]