SaVi - live dynamic coverage texturemaps in Geomview
Lloyd Wood, January 2004.

$Id $

USING DYNAMIC COVERAGE TEXTUREMAPPING
=====================================

Launch from geomview with:
savi -largemap -dynamic-texturemap <filename>
to introduce dynamic texturemapping of large cylindrical coverage map to
Geomview's Earth sphere.

This requires the coverage panel open, as we're reusing the map
area that the coverage panel sets up; the texturemap must also
be a cylindrical projection and of the right size for Geomview.

Open now-large coverage panel. Press >> play. Turn on the
texturemapping option in SaVi's Rendering menu.


TECHNICAL DETAILS
=================

Mapping is horribly convenient because the Tcl coverage image is
effectively already a raw RGB ppm file, which we write to a scratch
file we tell Geomview to read in. (Must handle .Z somehow.)

Opening the coverage window and turning on texturemapping starts copying
coverage maps to Geomview via a $SAVI/scratch.ppm file. This is slow, can
be slightly out of sync, and can occasionally break when things get busy;
a much better method than 'appearance $FILE' and the whole horrendously
inefficient kludgy scratchfile thing is needed.

This method also presumes that $SAVI is a writable directory; if
we're sticking with a scratchfile rather than piping, need to specify
dir or use /tmp with tmpfile() -- tricky to do for the existing static
name in oogl/earth_texture.oogl without including large amounts of oogl
in C fprintf statements.

Large coverage panel exists because 1024x512 is the only size that
Geomview seems willing to texturemap, which is why -large-map (good
for megapixel displays) is suggested. In the absence of -large-map,
the standard Earth.ppm.Z texturemap should appear as a fallback
in Geomview even when the scratchfile is being read and written
when -dynamic-texture is specified in SaVi.

To cope with failure of dynamic texturemapping and displaying the static
texturemap correctly, rotation of the cylindrical map by 90 degrees to
place the Americas central has been corrected to match Geomview and
conventional projections.

Changing Image_Width/Height and having everything rescale is jolly handy.
We're reusing the cylindrical projection of the coverage map (rather than
building a separate image, which would require clearer image/grid handling
in src/coverage_vis.c and would be even more of a slowdown since we're
rendering two separate maps). Texturemapping of non-cylindrical projections
has been disabled as inconvenient for viewing in Geomview.

Interval decay is turned on because white shows up in Geomview lighting
as gold, and blue is cooler.

Correct image/grid handling probably requires pointer to image stored
in grid structure we're passing around, checking that the Tcl image
referenced exists, etc.

The cylindrical projection requirement means that commonly-available
unprojected maps of that size (e.g. Living Earth samples) cannot be
used correctly; the geometry is wrong, the poles become overly large,
continents are pushed towards the equator, so don't use them.


NOTES ON MAP CREATION
=====================

1024x512 sinusoidal pbm map was created from the 600x300 map
(scaled in gimp, made 1-bit as greyscale indexed colour, saved
as xbm, run through xbmtopbm). Cylindrical map created from same-size
Earth.ppm.Z, by using threshold in gimp before going 1-bit and xbm.

New unprojected equirectangular maps were created from maps generated
by Versamap, then screenshots had colours altered, were run through gimp's
various filters, resized and saved similarly.
	http://www.versamap.com/

Lloyd Wood (L.Wood@ee.surrey.ac.uk)
