Advertisement

view distance

Started by July 23, 2003 02:57 PM
5 comments, last by Simoyd_ 21 years, 7 months ago
how do i change the draw dinctance? (aka stuff that will be drawn from the camera.
gluPerspective(FOV,aspect, NEAR_CLIP_PLANE, FAR_CLIP_PLANE );

Change NEAR_CLIP_PLANE and FAR_CLIP_PLANE to desired values. ( usualy NEAR_CLIP_PLANE >= 1.0 and FAR_CLIP_PLANE >= 100.0 )

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
Advertisement
Make shure that you have the near clip plane pretty close to you.
at least NEAR_CLIP_PLANE = 0.1 or lower, if you have it around 1, there is an hightend risk that it would be making some rather ugly clipping if your to close to a wall or something
The above response doesn't take into account the other factors of determining an appropriate near clipping plane, primarily the limited precision of the Z Buffer. Depth space, as it were, is not linear in scale: closer values are stored with greater precision than farther values. Granted, if the near clipping plane is too far out, you may clip into objects to which you are near, but if it's made too small, you will get horrible z-fighting artifacts in the distance, caused by the unavailability of sufficient values to describe distance. It's generally a good idea, when using a 16-bit Z Buffer, to ensure that the near/far clipping plane distance ratio isn't much greater than 1000. Certain applications might be able to get away with anything between 100 and 10000, so you'll want to experiment, but in any case, setting the near plane to a low, low value without accounting for the precision will have unpleasant results.

EDIT : GRAMMAR!

Later,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links


[edited by - zealouselixir on July 23, 2003 4:49:44 PM]

[twitter]warrenm[/twitter]

The z buffer dosn''t realy have anything to do with z-fighting,

Z-fighting is caused by a roundoff error when you have two polygons ocupying the same plane, but have different sizes.

normaly a FPS game has near/far set to somewhere in between 0.1/100 and 0.1/1000 if the unit size is 1m.
Much depending on what type of maps you have.

Rule of thumb: If you get z-fighting then the z buffer is the last place to look.
quote:
Original post by lc_overlord
The z buffer dosn''t realy have anything to do with z-fighting,

Z-fighting is caused by a roundoff error when you have two polygons ocupying the same plane, but have different sizes.

Rule of thumb: If you get z-fighting then the z buffer is the last place to look.


The round off comes from when there is too little precision in the depth-buffer. And usually you can get higher precision by making the ratio between the Znear and Zfar plane lower...
So that would be the first place to look, unless you''re up to remodelling your whole world, because of a few artifacts which could easily be taken away otherwise...
Advertisement
im making a game that is in 3d but on a 2d plane, so i dont think ill have a problem with the zbuffer thing (thanks for the info tho)
/me changes it to 0.1/1000
(I need draw distance cause of zooming)

This topic is closed to new replies.

Advertisement