What selective pressures caused caterpillars to be bright and pretty?
These guys are not hiding, as they are poisonous or very bad to eat and are advertising that fact. A population of caterpillars that were just slightly poisonous and colored would be among the test population that birds would soon learn to avoid. Then bright warning colors and stronger poisons would be naturally selected. Simplified version. Some caterpillars are mimics. Tent caterpillars are not brightly colored. Many are just green. Sexual selection can also drive color and pattern. Red, or a color like that ( yellow ) is a warning, usually. Other colors can be sexual selective in nature. Flowers are advertising too, but for pollinators.