Confined Etching within 2D and 3D Colloidal Crystals for Tunable Nanostructured Templates: Local Environment Matters.