Razor's edge and near clip plane

I’m doing some global illumination stuff. For my final gather, I place a camera at various points in my scene and do a render.

Here’s the problem: The placement of my camera can be arbitrarily close to a corner (define for now as anywhere two planes meet at a right angle). Say I put the camera at the top of a wall. If it is close enough to the roof, the roof will be clipped by the near frustum plane and almost half my render will be black (incorrect, as the wall should pick up lighting from the roof and not see the black void beyond the roof).

Question: Given a point on a planar surface and it’s normal, is there a mathematical formula for exactly where I would have to place the camera and exactly what the near clip plane value should be to avoid having any of the ceiling clipped out? Is there some other trick to get around a problem like this? Can I put the near clip plane slightly behind the camera?

Hi Zeno,

On NVIDIA hardware (GeForce 3 and beyond), you can use NV_depth_clamp to avoid clipping stuff at the near plane.

Other solutions would be a bit messier.

Thanks -
Cass

Originally posted by cass:
On NVIDIA hardware (GeForce 3 and beyond), you can use NV_depth_clamp to avoid clipping stuff at the near plane.

Thanks Cass, that extension is exactly what I was looking for. :slight_smile: