modify 3DGrid to fit the boudningbox