Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Lews

OpenGL OpenGL "Jaggies"

This topic is 5899 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, This is surely a newbie question, as I am new to OpenGL and it seems relatively straight forward. Here we go: I have a quad, that I''m using to represent the ground, and a grey cube, a corner of which is poking up above the plane, making a little hill. This works great when the camera is right up close to the hill, but as it moves further away, the edges of the hill get rather jaggy. Here is a small screen shot: http://www.stanford.edu/~jjshed/jaggies.gif. I assume that there''s probably some depth-testing command that I can use to smooth these jaggies out. Can anyone lend me a hand? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Always push the near clipping plane as far out as is acceptable (it''s the penultimate parameter in gluPerspective). Try increasing it to 1.0f, or perhaps more. A good trick would be to increase it more the further away the camera is. For example, you could calculate the how close to the camera the nearest object is, and make the near clipping plane just a bit before that.

Share this post


Link to post
Share on other sites
"Antiaiasing Polygons"...

glEnable(GL_POLYGON_SMOOTH);
edit
Oops, I made the above post before I actually looked at that picture. It does seem like your cube is disapppering, meaning leaving the viewing volume (what you can see at any given time)
edit


[edited by - Shadow1234567890 on August 27, 2002 4:29:23 PM]

Share this post


Link to post
Share on other sites
No, it''s not leaving the view volume. This is definitely a Z-fighting issue caused by the imprecision of the Z-buffer, as suggested by Sibbo. Once again, you can fix it by making the near clipping plane as far from you as possible.

Btw, Sibbo, it''s been ages since I''ve heard anyone use the word ''penultimate.'' You just made my day

Later,
ZE.

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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I think another way to do it is increase the precision of your z-buffer. I assume you have it at 16. you can change it to 32 and see if that helps.

Share this post


Link to post
Share on other sites
This may be a really dumb question, but how do I can the precision of my Z-buffer?

Thanks for all the help guys!

Share this post


Link to post
Share on other sites
There's probably no need to change the z-buffer precision, it can be overriden in the video driver settings anyway



What is the third value in your gluPerspective call (assuming you're using gluPerspective)?

If it's 0, you will have problems, if it's 0.1 you might have problems

Try setting it to 10 and if that works, reduce it until you get problems

I am no expert so please correct if I'm wrong



[edited by - bluecat on August 28, 2002 12:32:53 PM]

Share this post


Link to post
Share on other sites
Z-buffer precision will affect it, yeah, but I don''t know how many modern cards support a 32-bit Z-buffer in hardware (I''ll wager most do). Specifying it when it''s not available may cause your pixel format selection and updating to fail; I don''t know what fallbacks there are. Anyway, you''ll just set the 19th member (cDepthBits) of your PIXELFORMATDESCRIPTOR to 32.

BlueCat had a good suggestion. Just set your near clipping plane to a high value and decrement it until you notice artifacts. Choosing a reasonable number will balance the appearance of distance artifcacts and penetration of close surfaces.

Later,
ZE.

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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!