View Full Version : How to draw sky in background ?

10-28-2003, 07:33 PM
I'm using glFrustum(..) to create 3D scene.
I'd like to draw the sky (with blue gradient ) in the background ,so I turned out the depth buffer and draw some big polygon some where in sphere,but gradient for color looks bad because that polygon is not exactly calculated. I don't know how to calculate the size of polygon to fill all the screen in the end of frustum.
How it's depends from eye coordinates ?( my eye x is always in 0(middle),but height and depth are changing,so the sky visible size is changing too)

10-29-2003, 01:52 AM
a standard solution would be a sky dome, have a look at www.vterrain.org (http://www.vterrain.org)


07-14-2011, 11:55 PM
Can u pls post the code for this sky project?

07-15-2011, 09:49 AM
Sky dome or sky box.
The priniciple is the same, just draw a cube (skybox) - that is 6 textured quads - around the camera. The trick to this is that the sky box/dome is always drawn arround the camera's position so when moving the camera around it never reaches the edges because the box is moving along with the camera.
You can disable depth test to save a few fps and even forget about clearing the colour buffer as the dome/box will completely fill the view fustrum. That's the advice from a few years back anyway....

07-15-2011, 11:15 AM
Another trick is that you can draw it with - say - 10 unit dimensions and use glDepthRange (1, 1) so that you don't have to worry about your far clipping plane. Don't forget to set depthrange back to 0, 1 when you're done though.