Mapping Spheres to WF3D


The Map_Sphere utility maps images to spheres. Typically, it is used to convert cylindrical map images of earth (or other spherical bodies) to WFL (WinFrame Language) for viewing in the WinFrame-3D Viewer. It accepts image files in the PNM (ex. .ppm) format, and produces WFL XML format.

The Map_Sphere utility produces a 3D textured image of a sphere, by mapping the source image to the sphere like a skin. It creates a conformant image texture, and is very efficient for viewing.

The Map_Sphere utility accepts an image file name on the command-line. It does nothing with the image, other than embed the name in the generated WFL output file. It does however check that the image is square and that the row and column size is a multiple of two. For example, 512x512, 1024x1024, etc.. (This is a requirement of OpenGL for text rendering.)

By default, this utility writes its output to a file called "out.wfl". Please see the options below for other alternatives.

Note: This utility converts dimensionless images to a 3D sphere. Therefore an assumption must be made about the size-scale of the sphere. By default, a sphere of radius equal to 100 is created. If you wish an alternative size, use the -radius xx command-line option.


Example Map-Sphere output.

Download:
  map_sphere.tgz  (Right-click to save-as)
 (Unpack with: tar xvfz map_sphere.tgz)


Contents:
  Areadme.txt      - This file.
  map_sphere.c     - Source file of Map-Sphere utility.
  map_sphere       - Executable compiled for Linux (2.4)


Compile:
  cc -O map_sphere.c -lm -o map_sphere


Usage:
 map_sphere  image.ppm


View output:
 wf3d out.wfl


Options:
  -v              - Verbose

  -o filename     - Send output to specified file.

  -radius xx     - Set the sphere radius.  Defaults to 100.
		   For example, if units are km, and you are generating a model 
		   of earth, set the radius to 6,378.

  -bands xx	  - Controls the quality of the generated sphere.
		    The sphere is rendered as N lattitude-bands and M longitude-slices.
		    This xx quantity sets the number of lattitude bands.
		    The default is 30.  (Bands 6-degrees north or south of each other).

  -slices xx	  - Controls the quality of the generated sphere.
		    The sphere is rendered as N lattitude-bands and M longitude-slices.
		    This xx quantity sets the number of longitude slices.
		    The default is 48.  (Roughly like half-hour time-zones.)

  -suppresscamera - Normally a nominal camera setting is placed at the top
                    of the output file for direct viewing in WinFrame.
                    However, if you are producing a terrain object for inclusion
                    in an existing model which already has camera set-up, then
                    use this option to avoid inserting it.



For example output, see WF3D Planetary Models.



See also: WF3d