PDA

View Full Version : Razor's edge and near clip plane



Zeno
07-16-2004, 09:05 AM
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?

cass
07-16-2004, 09:45 AM
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

Zeno
07-16-2004, 10:49 AM
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. :)