Camouflage, like any other animal trait, is built up slowly by natural selection.
People looking to disagree with this often point to a stick insect, for instance, and ask “what’s the point of looking one per cent like a stick?” This is easy to answer. If you look one per cent like a stick, you’ll make slightly more descendants than animals that look nought per cent like a stick. This is because you might not be seen by a predator at dawn or dusk, in a shadow, or through greenery. Of the baby stick insects you make, some of them may look two per cent like a stick, and so on.
Once an animal begins to evolve on a route towards an effective form of camouflage, each mutation pointing towards that particular form of camouflage is more likely to survive. The animal is then likely to stick with that strategy. For instance, no stick insect would suddenly start to evolve a pair of butterfly “eyes”, because if you already look say seventy per cent like a stick, looking one per cent like eyes makes you more vulnerable, not less. This is why you don’t see animals with two different camouflage strategies.
Of course, avoiding predators by camouflage is not the only evolutionary pressure animals work under. They need to be visible to potential mates, for instance, and perhaps to put on a display once they have met one. Thus we see features such as the peacock’s tail. They may also have a defence strategy which requires visibility, as wasps do. Because wasps have an effective defence against larger predators, they advertise themselves to the world in wasp colours. Predators evolve to be able to recognise wasp colours. Other insects then evolve to look like wasps, another form of camouflage. Although they have no sting, because predators ignore them as if they had the strategy still works.
The important point about camouflage is that it depends on context. If you live in a desert, it’s no use looking like a bit of a meadow. If wasps were purple and orange, it would be pointless being black and yellow. Natural selection, rather than being an orderly progression towards a goal, is an arbitrary melee of pressure and counter pressure, as animals respond to changes in their environment, whether through climate change or evolutionary changes in the other organisms around them. And if that asteroid hits, it’s all probably futile anyway.