Q:

Alpha interpolation in a pixel shader

How does the interpolation in a fragment shader work when it comes to the alpha parameter?
I'm programming a shader with SharpDX, DirectX11. My idea is to interpolate 2 3d points of a segment, so that I'll have the position interpolated in between in the pixel shader. But I want to know what happens with the alpha parameter when that position is blocked by another polygon.
For instance, if alpha is 1.0 at the left end of my segment and 0.0 at the other one. What is the value of alpha in the middle, 0.5? Or does it depend on the visibility at that point (meaning it could be, for instance, 1.0 OR 0.0 depending on if that part of the segment is hidden by a poolygon?

A:

Alpha has nothing to do with the depth test. All vertex shader outputs just get interpolated across the pixels, and don't change based on per-pixel visibility.  In your example, if an alpha parameter is output from the vertex shader as 0 at one end and 1 at the other end of the rectangle, it will be 0.5 in the center.

