If sunlight catches a rain shower at just the right moment, shimmering colors arc across the horizon. Although the most common rainbow is a single crescent containing every color from red through violet, if you pay close attention, you will discover that rainbows come in a surprising variety of colors and shapes. And scientists are finally figuring out why.

Rainbows can be just red, missing violet and blue or completely white. Multiple bows can be stacked on top of one another like a deck of cards or two can spring from the same pot of gold. Stand on top of a mountain with the sun at your back and a storm up ahead and you might even witness a full 360-degree circle of glittering multicolored light.

Rainbows can arise whenever there are water droplets in the air and light to interact with them. Sunlight enters a drop, gets both refracted and reflected, then exits again, splayed out like a fan into a rainbow’s well-known hues. The drop acts much like a prism and a lens; the prism separates the white light into its constituent colors while the lens (the drop’s curvy surface) focuses them into a rainbow’s intense crescents.

But the rainbow contains all the colors of the visible spectrum only if the incoming light contains the same. “Anything that modifies the light before it hits the water drops will impact the colors in a rainbow,” says Wojciech Jarosz, a researcher at Dartmouth College who simulates how light interacts with water and other materials to create real-looking images for animated films and video games. “If it was a particularly polluted day with a yellow sky, you would get a more yellow rainbow,” Jarosz says. The additional pollution particles change how the air scatters and absorbs different colors of light. Catch a rainbow near sunset and blue, green, yellow and even orange can be missing, with only red making it through the atmosphere without being scattered away.

Light isn’t the only factor that can alter a bow. The drops themselves are equally important. Small raindrops form near-perfect spheres whereas larger drops take on a burgerlike shape as they fall and flatten because of air resistance. “If you don't have a perfectly spherical water drop, the rainbow arc no longer has perfect symmetry,” Jarosz says. Rainbows from larger drops sit closer to the horizon, looking more squashed than perfectly circular, and their colors can appear more vibrant than the wispier, broader rainbows formed by smaller drops.

Mix two rain showers with different-size raindrops and the exotic twinned rainbow may come in to view. Each shower produces its own unique rainbow, which arcs along divergent paths, but the two appear joined at the bottom. “They're not very common,” says Jarosz, who was among the first to unravel the puzzle of how twinned bows form. “You need all the conditions for a rainbow in the first place and two sets of water drops different enough in size that you can distinctly see each of those individual rainbows.” If instead the showers have a broad distribution of drop sizes, the two rainbows blur into one.

Although rainbows cannot appear without light and drops, these ingredients do not have to come from the sun and a rain cloud. Jeroen van Beeck, a physicist at The Von Karman Institute for Fluid Dynamics in Belgium creates red bows in the lab with a laser and a droplet spray. “Monochromatic rainbows aren’t as romantic but they are much purer,” van Beeck says. “You can get enormous amounts of information from them.” Every liquid droplet has its own unique rainbow fingerprint. Form that rainbow under controlled conditions and you can precisely determine a drop’s shape, size, composition and even temperature.

Out in the natural world most of the variations come from the sun’s elevation and not how warm the air is or how squashed the drops are. The middle of a rainbow’s circle lies directly opposite the sun. At dawn, this central point is on the horizon—exactly half of the circle is visible and the rainbow rides high in the sky. (The rest is hidden below the horizon and can only be seen if you stand on top of a mountain or are aloft in a plane.) As the sun rises, this central point sinks and the rainbow slowly disappears from sight. If it is raining at midday in the height of summer, the sky will be empty.” The rays are coming from directly above you, the rainbow is underground,” van Beeck explains.

Katherine Wright is a science writer and journal editor working for the American Physical Society in Long Island, N.Y.