Mapping a firmament

Abstract : The spherical mapping is not well suited for mapping stars onto a sphere. Decaling the stars is a preferred method but special care must be taken when flattening the sphere in order to produce an undistorted sky at render time.

Introduction

The spherical mapping method is useful when comes the time to apply a normal bitmap onto a sphere provided that the texture is already produced in in such a wat that it compensates for the pinching effect at the poles of the sphere. However, mapping a starry night sky using the spherical mapping method is not the best approach especially when the star map is produced with the help of an application that was not designed for this type of compensation. Even painting a spherical stars map can be taxing since the hand painted compensation the is required to get stars the same size at the poles as at the equator. is not obvious.

As seen in the illustration to the right, the effect of applying the spherical mapping with a regular star pattern will produce a map where the stars at the poles are smaller and more stretched than those at the equator which also appear rounder. The effect is so severe as to make the poles stars almost disappear. This is due to the fact that each map pixels occupy a much smaller area at the poles. The nearer the pole, the smaller the area is occupied by each star.

When the bitmap is produced by hand, it is possible to pre compensate for this effect while painting it but this will require numerous trials and errors before getting it right.

In this tutorial, the application used for producing the stars is "Red Shift v2.0". An application designed for displaying astronomically correct skies as seen from any given date, time and location.

This application can produce rectangular maps (which are called Mercator maps but they are really rectangular) and polar maps. However, even though the rectangular maps are actually compatible with the spherical mapping, the software does not compensate for the spherical mapping pinching at the poles.

The way I produced the bitmaps is through high resolution (1600x1200) screen captures.

Four bitmaps were produced : two rectangular maps covering the western and eastern hemisphere from 60° north to 60° south and two circular maps covering the 30° left of the polar caps.

Manual flattening

When decaling a regularly distributed pattern like a starry sky onto a sphere. it is important that the flattened grid be regular not only for the patches that is decaled but also for surrounding patches. The automatic flattening will not produce the proper grid. It needs to be done manually.

Manual flatening is not only a valid and usefull method of preparing models for decaling stars maps. It can also be used for any decaling jobs. However flatening so to get regular flattened patch sizes is usually not recommended especially in organic models such as faces. In these models, it is recommended to try to keep the relative patch sizes as much as possible otherwise, some visible change in stretching can be visible between patches when the model is rendered. In the case of a starry map, this is not such an issue since the mapped pattern is highly irregular anyway.

The first step (not illustrated) is to unfold the sphere into a cylinder. Then scale down the cylinder along the X axis. This gives a flattened cylinder as illustrated to the right (assuming north-south is oriented along the Y axis.

The next step, and the most important, is to bring the two next back longitudinal splines (from the surface to be decaled point of view) in front as also illustrated to the right and then, stretch the flatened CP so as to produce a regularly spaced grid. Failure to bring those splines in front will produce a decaling that is severely distorted (stretched) at the seams or juncture of the decals when rendered.

As illustrated to the right, the grid must be regularly flattened also for the patches that immediately surround the decal. This is why the back longitudinal splines immediately next to the side splines, are brought in front.  The regularity of the grid in the case of the stars map is important in order to avoid distortions when rendering the decals.

There are two flattening operation to perform this way. One for the western part and the other from the eastern part. Using 3 frames in an action to do that is preferable. The frame 2 holds the flattened cylinder without the back splines brought on one side or another (it is a security blanket to keep this intermediary step here). Frame 1 holds the western flattening and frame 3, the eastern one.

Decaling

Note the regularity of the grid. Unfortunately, in the action window, the "snap to grid" function is not active so it is necessary to use the property panel and enter specific CP positions. However, when planned appropriately, with judicious use of grouping and then shift-selecting one CP in each group to se their coordinates and with the help of the scale function to zero on X and Z, it is possible to obtain this regularity by using a minimum number of coordinate editions.

From the right or left view, depending on which side of the globe is being decaled, select the inner patches and hide the rest. Then apply the decal. It is preferable to adjust the decal by entering precise top, bottom, left and right positions.

The polar caps may be decaled in the modeling window by selecting the polar caps and hiding the rest and then apply the decal on them from the top and bottom view without any further flattening.

 

 

 

 

 

Conclusion

Here is the result (click on illustration to view a larger image).

Even though there is some distortions due to a slight pinching of the rectangular maps at the 60° latitude which is 50% shorter that the equator, the pinching is much less severe than when using a simple spherical mapping.

 
 
  • Mapping a firmament