View Full Version : Near clipping distance = 0
As we all know, perspective projection is undefined when n=0. However, one day I spent too much time tuning a near clipping distance, and I decided to work out what it would take to actually set n=0 without the whole system exploding. It can be done with a little GLSL. I've written an article on the result. How to Set the Near Clipping Distance to Zero (http://aoeu.snth.net/?p=7)
Some of you are gonna hate this, I know. :) But there it is.
10-07-2007, 02:16 PM
Interesting. Not sure why anyone would hate it, however, it would be interesting to compare such a solution to a regular solution where you just use depth clamping.
Well, I'm as committed to teaching good GL style as anyone. I find that beginning programmers often don't understand the impact that moving the near and far planes has on depth buffer precision. They want to make n as small as possible and not worry about tuning n and f based on scene content.
So this code provides a way to get the effect of n=0, which is desirable to the lazy programmer, but it does so in a fashion that cannot be considered good GL style. That's hateable to someone who deals with GL learners (as do these forums).
Also, the difference between this and depth clamping is that clamped values don't sort.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.