A strategy for fabrication of controllable 3D pattern containing clusters and nanoparticles inside a solid material.