Solar Halos and Sun Dogs, Part 1

leaf graphic In this beautiful photograph taken by A. James Mallmann in the Arctic, we can see some unusual but gorgeous natural phenomena associated with the sun. Two of these have special names: the circle that seems to surround the sun is called a solar halo, and the bright spots at the left and right are called sun dogs.

The atmospheric scientist Robert Greenler developed a technique for computing the basic structures of these effects, as well as many others. His key assumption is that these effects are produced by ice crystals: specifically six-sided prisms. Short prisms (called plates) produce one class of solar effects, and long prisms (called pencils) produce others.

leaf graphic To create a picture generated by these ice crystals, Greenler used an idea that is very familiar to computer graphics people, because it’s a variation on the popular rendering method of ray tracing. But just as ray tracing used in graphics is based on a clever trick (instead of tracing rays forward from the light source, as physicists do, we follow them backwards, from the eye), so too is Greenler’s technique based on a clever trick.

The general technique is based on a starting point where each crystal is given a random orientation. From that, we can compute where in space it would have to be to send light back to our eye. To build a picture, we simply place a dot on the screen in the direction to that crystal. Then we pick a new orientation and repeat, many thousands of times.

Of course, I’m glossing over lots of details, but the article details them all. The result is a picture made up of dots.

leaf graphic On the left is an image I computed that shows sun dogs. In this image, the crystals are of the thin, or plate, variety. This image captures the light at only one wavelength (which I address in part 2). The sun dogs are thicker and more spread-out in the image, because the size and shape of the sun dogs vary with the altitude of the sun. Most of these phenomena generated by ice crystals share this behavior. The sun, not shown, is in the center of the image.

leaf graphic On the right is a set of images that I computed with long, or pencil, crystals. On the far left, the sun is at 11 degrees above the horizon, and we can see bright arcs above and below the sun (again, not shown). In practice, of course, we wouldn’t see the lower arc, as it would be below the horizon. As the sun rises, the arcs start to blend together. The center image shows that when the sun rises to 30 degrees above the horizon, the arcs start to pull together. The rightmost image shows the sun at an elevation at 50 degrees, as the arcs join together, eventually forming circle with an apparent radius of 22 degrees around the sun.

In the implementation section I mentioned that I use a wall-based ray-crystal intersection algorithm. This works fine, but Eric Haines has presented a simpler and faster algorithm in his article, “Fast Ray-Convex Polyhedron Intersection” in Graphics Gems II. According to Eric, the code in the book has a bug, so make sure you use the online version of the implementation.

Ronen Barzel observed that I don’t describe how I rotate the crystals into place, and that different rotation methods will yield different statistical distributions of ice crystals, and thus statistically different types of images. He’s right on all counts. My approach to orienting the crystals was simple: my interface let me pick independent minimum and maximum values for rotation about each of the X, Y, and Z angles. To orient a crystal, I picked uniformly-distributed random numbers in each of these ranges, and rotated the crystal sequentially around the X, Y, and Z axes. This will not generate a really uniform distribution of orientations, but I haven’t seen any artifacts. I doubt that a more sophisticated method would yield images that were visually distinguishable from the ones I made, but if someone implements such a method I’d like to hear about how the results compare.

Errata in the original column (these were fixed when I revised the column for the book): On page 85, towards the end of the second paragraph, the reference to Figure 2 should have been Figure 3. On page 85, I say that the viewing angle in the figures is 180 degrees, and then on page 86 I say it’s 90 degrees. That latter should have been a half-angle of 90 degrees – the images are fisheye views of an entire hemisphere, so it’s 180 degrees across a diameter, and 90 degrees across a radius. Thanks to Eric Haines and John Dill for pointing out these errors.

  • Original publication: “Andrew Glassner’s Notebook”, IEEE Computer Graphics & Applications, January 1996
  • Revised and reprinted in the book “Andrew Glassner’s Notebook