title: Z Buffer Algorithm-Visible Surface Determination
body: <p>I have the following explanation of Z-Buffer Algorithm </p>
  
  <p><a href="https://i.stack.imgur.com/hVNck.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hVNck.png" alt="enter image description here"></a></p>
  
  <p>There is a pseudocode for the algorithm from the same source </p>
  
  <p><a href="https://i.stack.imgur.com/tfZJQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tfZJQ.png" alt="enter image description here"></a></p>
  
  <p>In the explanation they are saying that - if the z value in the image space is greater, then replace the corresponding z-buffer value but when it comes to the pseudo code they are doing the reverse.</p>
  
  <p>Can some one tell me if i'm wrong?</p>
  
  <p>Im reffering <a href="http://www.idav.ucdavis.edu/education/GraphicsNotes/Z-Buffer-Algorithm.pdf" rel="nofollow noreferrer">http://www.idav.ucdavis.edu/education/GraphicsNotes/Z-Buffer-Algorithm.pdf</a> </p>