Jump to content
  • Advertisement
Sign in to follow this  
ProfL

is Z linear?

This topic is 3035 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!