Representing star fields

Includes projections onto spherical and cylindrical maps

Written by Paul Bourke
June 2001


Creating good star fields is not as simple as it might seem. One approach (the physically elegant one) is to place some geometric object at the right location, generally a sphere at some fixed large distance from the center of the model. This has the problem of what primitive to use and how big should that primitive be. If the star object is too small then it will be missed by the raytracer, even with a high level of antialiasing. If the primitive is too large then the stars won't look like point sources. The same arguments apply to the distance the stars are placed from the center of the model. If it's too close then the stars will look large, if too far away then the stars will be missed by the raytracer. Fiddling the characteristics of the star positions depending on the typical camera position is tedious.

One way around the above problem is to create a large sphere around the model and map a high resolution texture onto that sphere. This immediately solves the problem with the size of the stars, they will appear the same size irrespective of the radius of the sphere the texture is mapped onto. One implication is that the size of the stars will vary depending on the dimensions of the rendered image, so a different texture size may be required for small rendered images compared to large images.

The following image 8192x4096.png has been created as a star map to be applied as a texture to a sphere using standard spherical texture coordinates. It is based upon real star positions. The magnitude, and therefore apparent brightness, is mapped onto the size of the dots. To assist with antialising, the stars are blurred. Note also the distortion (stretching) of the stars towards the top and bottom, this exactly compensates for the distortion introduced by the spherical (polar) texture mapping. The appropriate texture size depends on the resolution of the final images, a few different sizes are provided: 1024x512.png, 2048x1024.png, 4096x2048.png.


[ Click for high resolution version (8192 x 4096) ]

PovRay description

The following illustrates how this might be applied as a texture map star sphere in PovRay. The exact settings for the finish {} may vary depending on other aspects of the model environment.

/* Star field */
sphere {
   <0,0,0>, 1
   hollow
   pigment {
      image_map {
         png "starmap.png"
         map_type 1 /* Spherical */
         once
      }
   }
   finish {
      ambient 2 /* Inverse of earlier global ambient level */
      diffuse 0
   }
   scale 1000000 /* Depends on model units */
}
Other issues
New: Oct 2011

The following higher resolution spherical maps were generated for a project in conjunction with Chris Brooks. A different algorithm was used whereby stars, from the same catalog, are placed on the image plane with a Gaussian spread and magnitude related to the star brightness. A selection of images are provided below, they are each 16 bit tifs (for enough dynamic range), provided at 16K and 32K resolution, the last number in the file name relates to the maximum standard deviation of the Gaussian.

16K
32K
16384 x 8192 x std30
32768 x 16384 x std30
16384 x 8192 x std60
32768 x 16384 x std60
16384 x 8192 x std120
32768 x 16384 x std120




Star Positions

Collated by Paul Bourke
Based on tables in the "Bright Star Catalogue, 5th Revised Ed."
January 2000


Ever wanted to include real star positions in your models or renderings? The data here will let you do that, it provides the positions in both polar and cartesian coordinates, it also gives the visual magnitude. It contains all the stars that are brighter than magnitude 6.5, stars visible to the human eye have a magnitude around 4 (depending on the lighting conditions from where you're viewing). There are over 9100 stars listed.

This file gives the positions of the 9000 brightest stars. The 6 columns are labeled as follows
  • RA (Right ascension) The Star's east-west location on Earth's celestial sphere west of the Equinox Line. In degrees ranging from 0 to 360.

  • Dec (Declination) Declination is the star's angle north or south of Earth's celestial equator, ranging from -90 degrees at the south celestial pole to +90 degrees at the north celestial pole. In degrees.

  • Mag (Magnitude) The apparent visual magnitude (brightness to an observer on Earth) this star would have if it were at a distance of exactly 10 parsecs (32.64 light-years). The sun has an absolute visual magnitude of +4.85. Note that the magnitude scale decreases with brightness; a star of magnitude +6.0 would be 100 times dimmer than a star of magnitude +1.0.

  • x, y, z coordinates of the stars projected onto a unit sphere centered at the origin. Simply multiply these coordinates to scale the sphere up to whatever "infinity" is in your application.

The original tables and documentation can be found here.

A useful include for C applications is: stars.c.




Projection onto Cylinder and North/South poles

Collated by Paul Bourke
January 2008


The following is the mapping onto a cylinder, including the top and bottom caps. The cylinder covers -50 to 50 degrees vertically, the planar caps being therefore 50 to 90 degrees (north pole) and -50 to -90 degrees (south pole).

North cap
Plane (inscribed circle) above 50 degree declination
PNG

South cap
Plane (inscribed circle) below -50 degree declination
PNG

Cylinder, -50 degrees to 50 degrees vertically, 360 degrees horizontally
PNG

It was originally intended to be used as a physical star projector, namely to be printed and stuck together to form a real cylinder with a bright light source on the interior. To this end there are alignment points, a red star at the north pole, a blue point at the south pole, green points spaced at 1 degree intervals across the boundaries and also showing positive right ascension at the equator. It is expected that these alignment markings would be removed with a physical marker or digitally once the alignment is understood.