Near clipping plane issues.

Started by
4 comments, last by DarkMessiaH 18 years, 7 months ago
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.
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?"
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.
"I must not fear. Fear is the mindkiller. Fear is the little death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past me I will turn to see fear's path. Where the fear has gone there will be nothing. Only I will remain." ~Frank Herbert, DuneMy slice of the web
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.
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).
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.

This topic is closed to new replies.

Advertisement