0
$\begingroup$

I'm trying to write a program that can simulate a rainbow. So far I've got figured out how to determine the change in the refractive index depending on the wavelength, the angular deviation of the scattered ray depending on the number of reflexions inside the water droplet, and so on. The only thing I'm still uncertain of is how I can plot the rainbow using this info. I'm thinking about using something like sin and cosine of the angle of the scattered ray, but then I don't know what determines the radius of the rainbow in the sky. Any help is welcome.

Please keep in mind I have simple knowledge of programming and overall optics (bachelor's degree in physics level).

$\endgroup$
2
  • 1
    $\begingroup$ Would Computational Science be a better home for this question? $\endgroup$
    – Qmechanic
    Commented Sep 30, 2021 at 16:28
  • $\begingroup$ @Qmechanic I'll write it there too, thanks. I just thought it would be a better suit here because my problem is not on the code itself, but how to transform the information I have into the information I need to actually make the plot $\endgroup$
    – Jeff
    Commented Sep 30, 2021 at 16:43

3 Answers 3

1
$\begingroup$

then I don't know what determines the radius of the rainbow in the sky

The angular radius of the rainbow depends only of the refractive index of rain water. Regardless of where you are, it's always about 42° for primary bow and about 51° for secondary bow. Exact values of radii depend on frequency of light.

The center of the rainbow is opposite to the Sun.

Also, don't forget that the Sun itself has an angular diameter of about 0.5°, which results in smearing of the rainbow by half a degree.

$\endgroup$
0
$\begingroup$

Are any of these 18 acceptable?

enter image description here

The 30 lines of code is written by Fabrice Neyret on Shadertoy

$\endgroup$
1
  • $\begingroup$ It's not even close to a rainbow, just a sequence of somewhat saturated sRGB colors. $\endgroup$
    – Ruslan
    Commented Sep 30, 2021 at 21:03
0
$\begingroup$

A rainbow forms an arc which is part of a circle. When viewing a rainbow, if you face the center of the rainbow, the sun will be at your back. A beam of sunlight which goes past your head goes to the center of the circle. Other beams, parallel to that one, go into the rain and are reflected back to your eye. For each color, there is a particular angle of reflection which enhances that reflection. That angle is generally calculated between an incident parallel ray and the one that reflects back to your eye, and it determines the observed angular size of the circle. (Do a side view sketch.) The apparent actual size of the circle will depend on your distance to the rain.

$\endgroup$
1
  • $\begingroup$ Actually, the apparent size (i.e. angular radius) of the circle will be the same for any rain. It only depends on refractive index of rain water. The dependence of refractive index will define actual size of the circle for each frequency of light. Also, there's easily visible secondary bow, which is at another angle, depending on the same parameters, but takes two internal reflections, rather than one for the primary bow. $\endgroup$
    – Ruslan
    Commented Sep 30, 2021 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.