3d flood fill algorithm