Why is object 3 (at the bottom) drawing over object 1 (at the top)? And why isn’t it drawing over object 2? Am I doing something wrong or is this a genuine bug?
I managed to fix this in Blender’s source code! The problem was that the surface closest to the target object always won (which is desirable for AO but not displacement/normals). I’ve changed the logic so that the object above the plane always wins instead. I’ve also ensured that surfaces intersecting the plane/maxdist are picked up.