This iridescent insect is Entimus imperialis, Brazil's diamond weevil, and scientists have now discovered that it's because of three dimensional photonic crystals that it has this incredible color. As you can see from the photograph above, and other photographs of the critter, it's marked by a black shell with brilliant pits of color.
Now researchers have delved into those pits, and discovered an incredible camouflage system that not only functions to hide the weevil, but also identify it.
The reason some insects change color depending on the angle you look at them is due to the structure of their pigmentation — specifically the number of dimensions and shape of photonic crystals on their exoskeleton. Entimus imperialis has three-dimensional photonic crystals in these pits, arranged in a diamond-type structure. The functional effect of this is that depending on your distance and the lighting, the insect can look remarkably different.
In fact, from a distance, all you'll see of the weevil is a diffuse green-yellow shape, that's as reflective as the foliage around it — it's only once you get much closer that the brilliant pattern resolves. Since the crystals sit inside these tiny pits, they're also protected against wear, preserving the effect better.
The researchers believe that this distance-based optical effect serves a two-fold purpose. From a far away, it functions as camouflage from predators, and up close it serves for sexual recognition between members of the species.
Image by Ettore Balocchi on Wikipedia