More work and fixes to visibility-2d, not working yet.