Sign in to follow this  
ProfL

is Z linear?

Recommended Posts

from my oldschool days I know, when writing a rasterizer, I could interpolate x and y linearly in screenspace, but z was hyperbolic, so I had to interpolate 1/z and calculate the reciprocal per pixel. Now, working on a homogenous rasterizer, interpolating with 1/z wasn't working properly and I seeked some paper that would explain what I miss and it looks to me like z is interpolated linearly. http://escience.anu.edu.au/lecture/cg/Texture/perspectiveCorrection.en.html http://www-graphics.stanford.edu/courses/cs248-07/lectures/2007.11.06%20CS248-13%20Z-buffer/2007.11.06%20CS248-13%20Z-buffer.ppt (page 18) it sounds logical
Quote:
When projecting a homogenous vector we divide by the homogenous coordinate: (xw/w, yw/w, zw/w, w/w, u/w, v/w, 1/w, R/w, G/w, B/w, A/w)
so you end up with (x, y, z, 1, u/w, v/w, 1/w, R/w, G/w, B/w, A/w) BUT on the other side, I KNOW the ZBuffer on hardware is not linear. what do I miss?

Share this post


Link to post
Share on other sites
z-buffer is just a buffer, it has nothing to do with linear or non-linear.
It's all depend on transformation in vertex stage.
In fact, the hardware will do homogeneous divide, the homogeneous coordinates is linearly interpolated. So if you use perspective projection, depth is non-linear. If orthogonal projection, depth is linear.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this