def chequers(material1, material2):
  """Alternate between materials (in all directions)."""
  def f(point):
    if (point.x+point.y+point.z) % 2 == 0:
      return material1
    else:
      return material2
  return f