DistanceToNearestSurface not maintaining consistent edges around intersecting objects

It seems to be limited in its precision. However it is possible to use it for foam with high enough range, but with some issues. Dividing distance by 100 should get rid of inconsistent transitions. Also thin or small meshes will not produce good results. Gif