# Why we calculate z buffer value from plane equation $AX+BY+CZ+D=0$?

Suppose in perspective projection $$(x, y, z)$$ coordinate projects to point $$(x_p, y_p, z_{vp})$$ in projection plane $$AX+BY+CZ+D=0$$ where projection plane kept at $$z_{vp}$$ position. And the plane $$AX+BY+CZ+D=0$$ is satisfied by every point $$(x_p, y_p, z_{vp})$$ and in whole projection plane $$z_{vp}$$ is constant.

Also we know that Z value(Z buffer value) for an object doesn't come from the z-value $$z_{vp}$$ of the projection plane.

But in many websites I seen Z value(Z buffer value) is calculating by the plane equation $$AX+BY+CZ+D=0$$ of the point (x, y, z) which is the point of space point not the projection plane point. My question is why can we calculate Z value(Z buffer value) from the plane equation $$AX+BY+CZ+D=0$$ of the space point $$(x, y, z)$$ because $$AX+BY+CZ+D=0$$ is only satisfied by the point $$(x_p, y_p, z_{vp})?$$

• Your use of the plane equation with respect to projection sounds... familar. Jan 26, 2022 at 18:34
• ... So you're admitting that this was you. You deleted your account and created a new one so you could keep posting questions. Jan 26, 2022 at 18:42

You are talking about two different planes.

The website is talking about the plane of the quadrilateral being rendered. It uses that plane to compute the Z for a particular X,Y point. Basically, the question being asked is, "what is the Z value for the quad at this X,Y value on the screen?" To compute that, you can use the plane equation for that plane, solve for Z, and plug in appropriate X, Y values.

This is different from the plane of perspective projection.

Now it should be said, this isn't how people compute the Z coordinate in perspective projection for rasterizers. The website in question is meant to explain how depth buffers work. As they require some sort of "depth" data, they present the simplest way to compute a Z value for a polygon as projected on a point on the screen. The depth buffer doesn't care about the exact values involved; so long as the closer values consistently have bigger or smaller values than those farther away, the depth test does what it is meant to do.

So do not take this as "how depth is calculated". It's merely an example meant to illustrate how the depth buffer works: it's a comparative test between the incoming fragment's depth and a stored depth.