skybox

Started by
8 comments, last by THACO 19 years, 4 months ago
ive looked all over here in the forums and google and havent founda decent skybox tutorial. However i have managed to make my own but its rly wierd when it doesnt render something when im far away especially the corners... how do i solve this? ive read something about disabling the z-buffer.. how do i do this someone have an example?
Advertisement
What does it not render?
Sounds like you didn't turn off lighting and/or z-buffering before rendering it.

If you didn't turn off lighting then the corners could be so far away from a light source that they are black. And if you don't turn off z-buffering than your corners could be outside of your far-plane, in which case they won't render.

Don't be afraid to be yourself. Nobody else ever will be.
"A bit weird" is not very descriptive, but obviously you should disable fog and lighting when rendering a skybox. Disabling depth-writing is a good idea (see glDepthMask); and depth testing serves no purpose either (glDisable(GL_DEPTH_TEST)). And render the skybox before everything else.

I posted a more detailed answer to a similar question yesterday, so look through my history if you're interested.

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

Not sure but what are your near and far planes set to? The volume of area of the view area might be to small and when you rotate the view its clipping the edges...
Quote:Original post by MARS_999
Not sure but what are your near and far planes set to? The volume of area of the view area might be to small and when you rotate the view its clipping the edges...


To elaborate on this point, with depth writing disabled, there's no need to use a stupidly large skybox, so it's only necessary to make sure it's large enough to clear the near clip plane.

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

www.falconclan.org/image/skybox.bmp

thats how it looks.. but they go togheter if i get closer... how do i fix it?
It looks like you're hitting the far clipping plane. It also sounds like you're moving the skybox with the camera. You should always leave the skybox centered on the camera. The terrain moves relative to the skybox, this is what makes it a skybox. Once you've fixed that all you need to do is change the scale of your skybox. Since it doesn't move the scale is unimportant, except that it must never be clipped by the near and far clipping planes. So pick a value halfway between the two. Then disable depth writing when rendering the sky box (since it doesn't have depth - it's treated as being infinitely far away) by using glDepthMast(GL_FALSE); (and the opposite when you render your terrain to reenable depth writing).

Enigma
Refering to the initial post in this thread, i feel obliged to point out a few skybox tutorials:

http://www.gametutorials.com/Tutorials/opengl/OpenGL_Pg2.htm#TextureMapping
http://www.imm.dtu.dk/~mw/OpenGL_Skybox.php
http://texel3d.free.fr/opengl/skybox.htm
http://www.levp.de/3d/skybox.html
http://home.planet.nl/~monstrous/skybox.html
I agree with WeakSod, i really liked the tutorial at http://www.gametutorials.com/Tutorials/opengl/OpenGL_Pg2.htm#TextureMapping it was very helpful and easy to reference to help me create mine.

-THACO

This topic is closed to new replies.

Advertisement