4
$\begingroup$

Would it be, at least theoretically, possible to render without a near clipping plane? Could raytracing ignore this perchance?

Quite many budding 3d artists have a WTF moment the first time they encounter the clipping plane. If this could be avoided then it would be a big win for usability of 3D authoring apps. Its not one of those things a normal artist would think about until explained.

$\endgroup$
  • $\begingroup$ Imagine having a 3d object INSIDE your eye. How would that look like in your opinion? What do your buddies think? $\endgroup$ – Andreas Apr 17 '16 at 11:06
  • $\begingroup$ @Andreas yes but that only how the linear algebra trick works we could use numerous other tricks. $\endgroup$ – joojaa Apr 17 '16 at 11:17
  • $\begingroup$ What other tricks? $\endgroup$ – Andreas Apr 17 '16 at 11:21
  • 1
    $\begingroup$ @Andreas we could do spherical projections for example. Just because we have one mathematical model that works does not mean there are no other ways to solve problems. $\endgroup$ – joojaa Apr 17 '16 at 11:50
  • $\begingroup$ Removed my answer $\endgroup$ – Andreas Apr 17 '16 at 14:59
4
$\begingroup$

The near clipping plane is a fundamental feature of projective rasterization. To borrow a diagram from Eric Lengyel's Projection Matrix Tricks presentation:

Diagram of camera space to NDC transform

The displayed region of clip space (that you can think of rasterization as happening in) is a box which has a "near" face. This is associated with the near clip plane. But we can push the far clip plane out to infinity, so can we pull the near clip plane in to zero?

Mathematically, you absolutely can! The only point that presents a problem is the eye itself: you can get infinitely close to the eye and still resolve to a single point in clip space. However, if you have a triangle that passes through the eye, you still need to clip it, and to clip it you need an actual plane, not a concept like "infinitely close to the eye."

More critically for the current rasterization pipeline, the perspective divide does fun things with numerical precision. See the line at NDC 0 in the diagram above? It's halfway through the viewing volume in clip space, but not at all near halfway through the view frustum in camera space. In fact, its position depends on the near clip plane's distance to the eye! This means that over half of the depth range in clip space is in that region near the eye. As you get the near clip plane closer and closer to the eye, that plane pulls in even closer and you waste more and more depth range. This isn't necessarily fundamental—you don't have to store z/w in the depth buffer—but it is convenient. Here's an article from Nathan Reed about depth precision, and a few notes about why the projected z/w depth is useful from Emil Persson.

Finally, I'll plug a post in the excellent "A trip through the Graphics Pipeline" series, which is very interesting and references homogeneous rasterization algorithms which, in theory, could avoid the need to do clipping in projected clip space, which would totally avoid some of these traps.

$\endgroup$
  • $\begingroup$ Ok now we are getting somewhere. I am not really concerned in how most rasterizers work but rather if there is a novel way to do it that does not have this problem. I am thinking of accepting this answer as it hints at the answer, and would avoid me having to show that in fact one can do this by approaching the problem differently than how current pipelines do it. Its not a feature of projection but rather the matrix operations and how we read the data in the projection. $\endgroup$ – joojaa Apr 18 '16 at 7:18
5
$\begingroup$

The near clipping plane in rasterizing setups with perspective projection is there to avoid a divide by 0 and bound the possible depths for orthogonal projection.

With a bit of extra math you can make the depth stored in the depth buffer linear again. However you still need the guard against the divide by 0.

In raytracing the near plane can be at 0 no problem. There is nothing technical stopping you from putting it at -10 however (besides that it would be very odd).

$\endgroup$
  • $\begingroup$ Yes i know this, but wondering if there could be a alternate strategy to avoid division by 0. $\endgroup$ – joojaa Apr 14 '16 at 10:37
  • $\begingroup$ You could avoid divide by zero by pushing in or out values that would cause one. $\endgroup$ – Alan Wolfe Apr 17 '16 at 0:24
  • $\begingroup$ @joojaa Raytracing does not divide by zero. $\endgroup$ – Andreas Apr 17 '16 at 15:01
  • $\begingroup$ @Andreas Yes i know that neither does reality ;) $\endgroup$ – joojaa Apr 17 '16 at 15:01
  • $\begingroup$ @joojaa But have you ever tried looking at something that's been pushed through your eyeball? :-) $\endgroup$ – Simon F May 4 '16 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.