Original Post
I don't know what's wrong with me. My mind doesn't seem to want to work. I am making a mini software renderer and I have successfully implemented a triangle rasterizer. Now I need to find the depth values of each pixel in the triangle so I can implement a Z-Buffer. Problem is, I can't seem to get the interpolation to work. It's such standard math, but here I am, asking for help. So, to my knowledge, the formula for finding the z value of a point on one of the edges of the triangle is: float z0 = 1.0 / ((1.0 / z1) + s * ((1.0 / z2) - (1.0 / z1)))); Now, one of the issues was what exactly is the s value? Is it the position on the line segment relative to the start point? And these reciprocals, are they correct? Thanks in advance for the help. And if anyone has any examples of this interpolation in either C/C++ or Java, I would greatly appreciate a glance :)