Jump to content
  • Advertisement
Sign in to follow this  
DarkMessiaH

Near clipping plane issues.

This topic is 4812 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

Hi. I've tryed to code some sort of portal optimisation algorithm,and I've faced a really weird problem. Clipping code work generally right,but clipping against NEAR_PLANE is not always right.When I get close to the portal,the portal is identified as invisible,and when I move away,the portal is identified as visible.Usage of gluPerspective doesn't do the trick. Frustum generation & boxInFrustum test are coded correctly for sure. Has anyone ever encountered this sort of near-plane clipping issues?I would really appreciate any kind of advice.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by DarkMessiaH
When I get close to the portal,the portal is identified as invisible,and when I move away,the portal is identified as visible.
Close as in the portal is in front of the near plane (between the camera and the near plane)? If that's the case, then it's working perfectly because the portal isn't inside the frustum. If that's what's happening but you still want the portal to be "visible" for that, run a modified frustum test to ignore the near plane. If that's not the problem, I can't think of what it could be so maybe post some more info? Such as what do you mean when you say "Usage of gluPerspective doesn't do the trick?"

Share this post


Link to post
Share on other sites
I take it you are using OpenGL's culling/clipping routines? I have always been under the impression that a more suitable way to attack this is to perform your own clipping routines & treat OpenGL as merely a tool to display the results. This way you have complete control over what will be defined as visible (from a data point of view) instead of leaving it up to OpenGL.

That may not answer your question of course.

Share this post


Link to post
Share on other sites
I've always thought that gluPerspective should make the near clipping plane closer to the camera(in OpenGl).I extracted frustum data from projection*modelview matrix.

Share this post


Link to post
Share on other sites
Quote:
Original post by DarkMessiaH
I've always thought that gluPerspective should make the near clipping plane closer to the camera(in OpenGl)[...]
Only if you set the near parameter to a number less than what you previously used (same goes for glFrustum, glOrtho, and gluOrtho2D).

Share this post


Link to post
Share on other sites
This sometimes causes unpredictable rendering artefacts(especially if i set the value to something about 0),but doesn't make my clipping code work correctly.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!