Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / Simple Portal Near Z Clip Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Mike Taylor

July 25, 1999, 03:00 AM

This may seem an easy one for you pros, but I have been playing with this 3d portal engine for a while and it looks mighty fine. The only problem is sectors will not draw at all if the camera is too close to the portal. I figured this was due to a near-clipping plane problem and Adrian Perez's article confirmed it. So now I use no near clip. This is bad. There must be some way of culling negative z's and checking for z==0 without leaving out my beloved portals and screwing up scenes. What methods do you guys use?


Mike Taylor

 
tangent

July 25, 1999, 03:03 PM

Mike Taylor wrote:
>>This may seem an easy one for you pros, but I have been playing with this 3d portal engine for a while and it looks mighty fine. The only problem is sectors will not draw at all if the camera is too close to the portal. I figured this was due to a near-clipping plane problem and Adrian Perez's article confirmed it. So now I use no near clip. This is bad. There must be some way of culling negative z's and checking for z==0 without leaving out my beloved portals and screwing up scenes. What methods do you guys use?

I used to have that problem in my portal engine. I used to clip at the near plane - the plane
of the viewport. That caused the problem you described. The reason for it is that portals can
intersect the viewport but must not be clipped there, since a small portion of the portal may
still be visible between the viewport and the eye. Since it is a portal, you still must be
able to "look" thru that small piece behind the viewport otherwise sectors will not be seen in
those areas.

This means you must perform a near clip at z=0. At least, this must be done for portals. If
you are worried about rendering problems at z=0 then clip all non-portals to your viewscreen
plane. For my test portal engine I am using OpenGL. I simply clip all polys at z=0. My near
clipping plane for my viewing frustum is at z=1. This fix has eliminated the problem for me.

 
Raven

July 25, 1999, 04:30 PM

>>This means you must perform a near clip at z=0. At least, this must be done for portals. If
>>you are worried about rendering problems at z=0 then clip all non-portals to your viewscreen
>>plane.

The simplest way to solve the z=0 problem is when you project(it's fine everywhere else in most cases, otherwise move this step up in the pipeline), check if the vertex is at z=0 and if it is jitter it. Jitter means move a little. This works:

if (Vertex->z==0)
Vertex->z==0.01;

That is what i have in my engine, and i clip at the eye instead of at the viewport. Works fine, no visibile speed decrease because of the extra space, and the jitter solves z==0. Can't think of anything simpler

Hope this helps,
- Raven

 
This thread contains 3 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.