The last step of Z-Buffering I just dont get the point! :(


for a student-project I have to implement the Z-Buffer method to create a depth map.
Now I dont get the last step done. I already calculated the cell-coordinates and distances for every vertex.

For every cell of the final image I have to map the minimum distance of all the distances of all the points, that are mapped to this cell.
The problem is, that I’m not able write a kernel that does this job without risk of write-after-write errors or something like this… I even tried atomic functions but they are for integers only and I got floating point distances.

Has anyone of you already work on this topic? Perhaps I’m looking for the false words but google didn’t help much yet.

Thanks! Would be very nice if one could help me here.