Calculate collision grid for terrain