You could get a good approximation of depth in alpha just by calculating the right depth for each vertex in software or a vertex program and storing that in the alpha component of the frame buffer. This will give subtly different results though, since there is perspective in the values stored in the depth buffer so that there is more distance between distant adjacent depth values than close adjacent depth values, just as there is more distance between distant pixels and close pixels. Interpolating alpha from the vertices will be pretty much linear from the near plane to the far plane, while using the depth values will vary more rapidly for pixels closer to the camera and taper off as you get further away.



