POV Ray sky_sphere Notes

Some comments on the use of the sky_sphere.

For realistic implementation of sky color on a sky dome, or sky_sphere in this case, a color gradient on the vertical (or y axis) is typically applied. This works quite well since the surface of the sky_sphere is eqidistant and perpendicular everywhere from the view point - i.e. there are no perspective or forshortening effects to the pigments applied to it.

There are some nuances to consider when applying a vertical color gradient to the sky_sphere. A color gradient linearly indexed from 0 to 1 will work OK if consideration is taken for the effect of distortion at the zenith. However, if it becomes necessary to apply the gradient in a linear manner (i.e. mapped to the sphere), an index based on the sine of the elevation angle (i.e. latitude) will serve. A possible implementation would be to modifying the index values of the color map with sin(index*pi/2). Alternatively, MegaPOV makes available the polarical pattern which basically accomplishes the same thing. The images below attempt to illustrate the difference between a linear y gradient and a one scaled to a sine wave (or based on the elevation angle) to compensate for the curvature of the sphere. The red line shows the respective mid point in the gradient. A sample POV file is also available (sky_sph_map.pov).

index proportional to y index proportional to
elevation angle (sin(y))

The POV-Ray documents give good treatment to the proper scaling and translation of the the gradient pattern for the necessary effect. I would only add a couple of additional points here in regards to patterns for the application of sky color which I believe are necessary.

Typically the gradient pattern is scaled by 2 and translated <0,-1,0> in order to cover the sphere from nadir to zenith in the color_map index range from 0.0 to 1.0 and at the same time avoid pattern repititions. The region of primary interest (above the horizon) falls in the index range of 0.5 to 1.0. However, it is advisable to treat the region below the horizontal (xz plane) with due consideration also since, depending on the scene geometry, these areas may become visable. That said, it sometimes becomes practical to work within an index range of 0.0 to 1.0 above the horizon (e.g. in order to make use of the waveform modifier). Of the various solutions possible, here are two examples:

Solution #1
sky_sphere {
    pigment {
      gradient y
      pigment_map {
         [0.5 color HorizonColor]
         [0.5 gradient y 
            color_map{SkyColorMap }
            translate 1 scale .5
         ]
      }
      scale 2  translate -1
    }
  }
Solution #2 (requires MegPOV or POV 3.5)
sky_sphere {
    pigment {
      function{min(1,max(0,y))}
      color_map{SkyColorMap}
    }
  }
sky_sph_test.pov

 

Created by Abe Madey
bullfrog@taconic.net
Reproduction not permitted without express permission.
Updated Oct 12, '02