View Full Version : clipping problem

04-11-2004, 08:19 AM
Hi all, I would like to ask how can I make the clipping plane "invisible" from the player in the game world? As the game world is surrounded by a texture skybox... there is always a "visble" clipping plane.......

04-11-2004, 08:53 AM
If you are refering to the "far" clipping plane, the one along the z-axis, there are a number of solutions to making it "invisible". The easiest is to simply increase the distance to the plane.
This requires you to setup your projection matrix appropriately. For example,
glMatrixMode( GL_PROJECTION );
glFrustum( -1, 1, -1, 1, near, far );
the +/- 1 assumes a 90 degree field of view as an example. The idea is to increase the "far" value to extend beyond the most distant object.
Admittedly, this is a brute force solution, and care should be taken in not letting "near" get too small, or letting "far" get too large, as this can lead to depth precision problems. It really depends on how you scale your world.
Now, for a skybox, however, this should not be an issue, unless you are actually scaling the sky to physically surround the world. The prefered method to deal with a sky is to simply move the sky to the camera position, and then draw it, disabling depth testing, and the depth mask:
glDepthFunc( GL_ALWAYS );
glDepthMask( false );
glMatrixMode( GL_MODELVIEW );
glTranslatef( eyePos.x, eyePos.y, eyePos.z );
where the sky is scaled as to not interact with the far plane at all, say a 128x128x128 box, or so. It doesn't need to be very large at all. It should also be noted that the sky should be the very first thing that you draw in the world, and if it occupies the entire screen, there is no need for a glClear(COLOR_BIT), which can save a little time...

04-11-2004, 10:08 AM
Candy if you mean a visible gap between your landscape and the skybox I sugesst fogging where the fog color blends into the skybox texture.