How to Simulate a Rainbow


This article describes how to model a rainbow including water droplets and the sun's blackbody spectrum.

This article is also available in Japanese.


Authored By: Shinichi NAGATA 

INTRODUCTION

This article describes how to model a rainbow using the non-sequential capabilities of Zemax. Non-sequential mode has the ability to model true color sources using several source color models. You can download the associated file from the last page of this article.

This article is also available in Japanese.

Here is the simulated image of a rainbow.

Detector Viewer: Rainbow simulation

In the detector image above, you can see a “primary rainbow” which is the brighter rainbow on the bottom, and a “secondary rainbow” the dimmer rainbow on the top. The darkness between these two bows is the so called the “dark Alexander’s Band”.

As you can see, the secondary rainbow is dark and its color order from red to purple is in the inverse order.
The displayed field angle is ±16 degrees horizontally and ±9 degrees vertically.

The layout for this model is below. It is set to color rays by segments; in other words, the rays are a different color after each refraction and reflection.

3D Layout: Rays reflecting off sphere
The parallel incidents rays are drawn in blue lines, which represent the light from the sun, and the rays refract as they enter the sphere, which represents the spherical raindrop; rays traveling inside of the raindrop are plotted with green lines. As you can see, most of the rays directly emerge from the raindrop as displayed in red lines.

However, some rays entering the upper part of the raindrop reflect at the back of the drop with a Fresnel reflection of 2%, as drawn in brown lines, and they leave the drop close to the bottom, as shown in the yellow line which refracts at the exit. This makes the primary rainbow and the brighter section under it.

In addition, there are some rays entering at the bottom part of the raindrop which reflect twice at the back of the drop. The reflected rays exit the drop on the upper part, as drawn in the purple and create the secondary rainbow and the brighter section above it. Because both of the reflections are Fresnel reflections, the secondary rainbow only has 2% of energy in comparison to the primary. There is a caustic line in the angle of the primary and secondary rainbows and hence the rainbows are in vivid color. Although there are reflected rays under the primary and above the secondary rainbows, all colors are mixed so that no individual colors can be observed. Because there are no reflected rays between the angles of the primary and the secondary rainbows, the dark band is created.



MODELING A RAINBOW

We will now model a rainbow.

First, in order to model a raindrop, we use a "Sphere Object" with a radius of 0.1 mm and water as the material. For the source, we use a “Source Radial” with the X & Y half width of -0.1 mm (negative signs make it circular.) The distribution angle of the source is the same as the apparent angular radius of the sun, which is 0.25 degrees. We then set the source’s spectrum as shown in the object properties dialog below :

Object Properties Sources Tab

For the source color , we use a black body spectrum with a temperature of 6000 K, the temperature of the sun. The wavelengths are from 0.4 to 0.7 microns with 100 discrete wavelengths in between.

We use a “Detector Color” which displays the real color based on the spectral sensitivity of the human eye. We use radiant intensity as the data shown so that we can reproduce a condition that the observer is watching many raindrops from a far distance. Thus, it is unnecessary to model multiple raindrops.

If we are to model only a rainbow, the above 3 objects are sufficient. However, that will create a rainbow in the dark sky. So in this article, we will add a “blue sky”. We use a standard surface to model the blue sky and we add Gaussian Scattering on its surface as shown in the green box below. The material for the object is “mirror”.

Object Properties Coat/Scatter Tab

To reproduce the sky’s blueness we need blue reflected light, so we create a coating called BREF as defined below.

BREF Coating

This coating will give you the following reflection versus wavelength.

BREF Coating: Reflection vs Wavelength

Shorter wavelengths have higher intensity reflection, so the reflected light will be blue in color. This reflection versus wavelength is not the same as the actual air scattering properties; it is simplified to mimic the blue sky.

Once we define all of the necessary objects above, we now trace rays. The number of analysis rays is 50 million and make sure to check the boxes for “split rays” and “scatter rays” when you trace. It takes  few minutes to trace rays on a 4GHz “Core 2 Quad” machine and gives you the result below.

Detector Viewer: Rainbow Simulation



SUMMARY

In this article, we have simulated a rainbow by modeling a droplet (sphere) of water and incident light approximating the sun's properties (0.25 degree angular extent and 6000 K blackbodyt temperature). The detector color enables us to look at the photometric energy incident upon it.





Attachments


How to Simulate a Rainbow.zip How to Simulate a Rainbow.zip (5.25 KB, 5 views)



© All Rights Reserved.