I'm drawing a bunch of fuzzy lines in 3D space, and they can cross and re-cross each other so that it isn't possible to sort them by depth. If one line is drawn closer to the camera, then another line passes behind it, that second line is not drawn properly as it passes underneath the first line. The second line fails the depth test where the fuzzy edges of the first line are.

Is there any way to check the depth values from within the fragment shader? It seems like this should be possible but maybe not, due to the parallel nature of fragment shaders. If I could compare the two depths of the fragments, then I could blend them appropriately. It wouldn't work once you had a lot of overlapping translucent values, but it would probably be good enough.


Click image for larger version. 

Name:	Screen Shot 2017-10-24 at 9.21.08 AM.jpg 
Views:	81 
Size:	7.4 KB 
ID:	2528