It is a simple (and slow) 4x8 depthmap sample comparision. It adds or sustracts from a starting 0.5 value without taking account of depth difference. Since the camera angle mantaines the polygon depth into a small range, it works good and looks plausible. I have to improve the algorithm in order to reduce the depthmap samples, something like the pixel coord based vector election of your SSAO shader
edited. I move the samples center in sun light direction for each step too.