I'm rendering sphere's as billboards using the cpu.
They are being rendered to the screen in a loop that basically interpolates the x and y position over the sphere using center and radius like this:
const int width2 = Width / 2;
float center_X = ScreenX*width2 + width2;
float center_Y = ScreenY*width2 + width2;
float RX = Radius_SS*width2;
float RY = Radius_SS*width2;
for(int x = center_X-RX*2; x <= center_X+RX*2; ++x)
{
for(int y = center_Y-RY*2; y <= center_Y+RY*2; y++)
{
const unsigned int index = x + y * Width;
...
What I now want to do is emulate a kind of z-Buffer so that it eliminates overdraw.
I've been trying for a while now but I have no clue how to calculate the actual depth for each interpolated pixel value. The only thing I have is the SS depth of the center of the sphere.