compute density and potential lens planes