PDA

View Full Version : How to draw sky in background ?



Javac
10-28-2003, 08: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)

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

Jan

Infanta
07-15-2011, 12:55 AM
Can u pls post the code for this sky project?

BionicBytes
07-15-2011, 10: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....

mhagain
07-15-2011, 12:15 PM
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.