Soap Bubbles

Have you ever wondered about the rainbows on CDs, gasoline puddles or soap bubbles? All of these have the same cause: The interference of light on thin surfaces. Today, we’ll try to render something that looks like a soap bubble.

Some Physics

When a ray of light hits the surface of the soap bubble, it is either instantly reflected, or it enters the soap film and is refracted. When it is refracted, it can then be reflected off the other end of the soap, and then leave it again at a slightly different spot. There are countless other possiblities for the ray to bounce around, but these are the two that we will focus on here.

Thin film optics Two different paths that a beam of light can take through the soap film.

Because the width of the soap layer is comparable to the wavelength of visible light. Therefore, depending on the color of the

Finished visualization

Putting it all together, we get this nice little interactive visualization.

If you’re interested in the source code, you can find it here.

Konrad Heidler

Konrad Heidler

My name is Konrad. I will write here occasionally about stuff I consider interesting.