Optical properties and impurity states in nanostructured materials