A little background: Sky sphere

The sky sphere is a more complex form of background. You can use it when you want to simplify your scene: it allows you to place a pigment pattern into the scene, at an infinite distance, wherever nothing is. Often, you’ll use it to place a sky in your image or to place a star field.

Any pigment that you can place on an object, you can place on the sky sphere. There are some commonly-used pigments in the skies.inc include file for creating cloudy skies. We’d like to have a starry night, however, so we’ll need to make our own up.

A web search is often useful when you’re looking for some patterns for a specific purpose. A search on “povray starfield sky_sphere” found a couple of nice options: one using the crackle pattern and one galaxy include file. Because crackle is a very complex pattern to describe, I’m going to pretend we didn’t find anything useful, however, and go with what we know. The bozo pattern makes for a nice distribution of values that might work out well as a star field. Since we want the stars to be tiny points on a mostly black background, our color map will be a tiny section of white near one end, and the rest all black.

sky_sphere {

pigment {

bozo

color_map {

[0.0 White*3]

[0.2 Black]

[1.0 Black]

}

scale .006

}

}

As you can see above, pigments can be scaled just like objects can. We scaled it down so that there are many more white points in view. That is, so that more stars are visible. Play around with the scale, bringing it up towards 1, to see what happens as the scale effect is reduced. You can get some interesting effects that way.

Another interesting line above is in the color map. Our first color is White, multiplied by 3. Remember that the color names are just textual representations of the rgb colors. For white, the rgb colors are <1, 1, 1>. When you multiply it by 3, you get <3, 3, 3>. Didn’t I write earlier that color numbers go from zero to one? I did, and it’s true. But that doesn’t stop you from using higher numbers when necessary. It is often possible to tell POV-Ray to go outside its normal bounds to achieve a special, unnatural result. In this case, we’re trying to get bozo dots to look like stars. Making them ultra-bright helps.

It is important to remember that even when you are using a sky sphere, the sky sphere is just another background, and it is still what gets shown when there is nothing in the scene. If you turn on the alpha channel, for example, you won’t see the sky sphere.

As an example of that, I took the same image, turned the alpha channel on, and brought it into GIMP as a layer on top of a picture of a pond in Michigan.

GIMP recognized the alpha channel automatically, and all I had to do was drag the planet to where in the photograph I wanted it. The sky (because it is in a lower layer in GIMP) shows through everywhere that the POV-Ray image has nothing in it.