TODO file, enhancements for the hftools toolkit

hftools - a landscape toolkit, contains:

dem2pgm - USGS DEM to ASCII PGM converter
sdts2pgm - USGS DEM in SDTS format to ASCII PGM
gtop2pgm - GTOPO30 DEM to ASCII PGM converter
hfscale - better scaling up of PGM heightfield
hfcrop - manual or auto cropping of zeros off borders
pnmscale - better scaling down of PGM heightfield
erode - er1u/ Beale's erode algorithm, reads 
	PGM heightfield, exports eroded PGM heightfield,
	and PGM river map
hfbeach - adds a realistic beach to landforms
hfwater - adds water texture and color to all water areas
hf2rad - PGM heightfield to Radiance converter - old news
hfcolor - create an imagemap from a PGM heightfield
pgmblob - turn a tree mask into a better tree mask
hfplant - position objects on a heightfield
simplify suite:
   pgm2stm - convert the 16-bit PGM heightfield to STM
   scape - simplify the surface into a triangular mesh
   tin2rad - convert the TIN trimesh file to Radiance
   tinfile
   tinscale

Other packages needed:
   NetPBM - big, need only some progs
   scape-1.2  for surface simplification
   fips123 - for SDTS conversion utilities
   Radiance - for visualization
   er1u - Jon Beale's erosion program


General:

Eventually, there needs to be a script to batch through
one complete run. hfcreate.sh and hfrender.sh will be their
names. hfcreate.sh is nearing completion

Write useful comments in the headers of the PGM/PPMs. And
write a simple program to read the header and dump that
useful information back to the user. Wait, there's a NetPBM
utility for that: pnmfile

Get rid of this -in and -out in the option list. All output 
should be redirected to stdout, and input should be either 
stdin or whatever command-line arg has no '-' in the [0] position




tin2rad - lemme see, could I add a triangle smoothing algo here?
It would be tough, but doable. smooth all convex poly edges under
a threshold angle. It must write a .tmesh file (or .obj) which 
would need to be run through tmesh2rad or obj2rad for the 
conversion to be complete. Reason: I don't know how to calculate
the surface normal interpolation matrix for a triangle.

This smoothing operation would be like so: catalog each unique
vertex, and all of the triangles; loop through the vertexes,
finding all triangles that use it; for all convex-forming 
triangles, compute a shared normal vector direction; for those
triangles forming concave areas, copy the triangle's overall
normal as that corner's normal; save the normal and location
of each vertex of each triangle. (20,000 tri's -> 120,000 doubles)

This smoothing algorithm should have several options:
   the angle limit above which convex triangles should not be smoothed
   the angle limit above which concave triangles should not be smoothed
   the z-value (elevation) above which any triangles should not be smoothed
   import and export of .wav, .tmesh, .tin files


hfcolor - imagemap program

hfcolor is a tool to calculate the surface color of a heightfield,
assuming the hf represents a landform.

Stuff to add to hfcolor:

Also with the slope information, compute the normal facing of the
pixel, detail the snowline with this information.

Possibly add feature to export, in addition to a colormap, a
reflection map of the surface, highlighting water areas.

On that line, write a wave map, an imagemap to overlay the 
ocean and lake areas, that shows waves as short lines of white
among the other blues and greens of water.

Add effects of temperature. Have user input average daily/night temp,
in degrees F. If high (90 or above), move white to higher altitudes.
If low, move white to lower altitudes. Get it?

Allow output of a topographic map, with a base of white/off-white, 
red lines for contours, and darker areas for shading (by normal).
This would really have to be at a higher output resolution...i.e.
you'd need to hfscale -s 10.0 or so.





hfplant - a landscape generation tool

Ideas for hfplant:

Allow reading from either PGM heightfield, or triangle mesh, in wavefront
or another common triangle mesh format (TIN).

Allow rescaling and rotating the plants. Export either Radiance code
or a text file, space delimited, of x, y, z, rotation, and scale data.

Placement can be dependent on altitude (enter a band) or PGM mapping
(enter a filename)

User can input number of objects of each type, or density of each
object.

Store each object's characteristics in a structure. From the command
line, each instance of '-n object.norm' will begin a new object placement
characteristics record. All command-line options up to the next '-n' will
apply to the object named in the most recent -n entry. '-d density' or 
'-q quantity' will be two possible options. '-s min max' will set the
scaling ranges for the object, and '-r' will rotate it a random direction.
'-b min max' will define an elevation band to use, and '-m filename' will
specify a mask.

Possibly do edge-detection algorithm and tilt or shrink trees and shrubs
if they are close to or on that edge.

Scale the mask up to a higher resolution before using?

If the object filename ends in a '.rad' or '.norm', include an xform
command, but if the object's name ends in '.oct', then write an
instance for each object. (This could get big)

Plants, rocks, even buildings could be potential objects to include in
this manner.

Option '-l' will align objects in linear patterns (even rows)
It will be mutually exclusive to '-d dens' for density for random
placement, and '-q quantity' for quantity of randomly-placed objects.
'-l rowspace plantspace angle' will be optional args after '-l', and
will represent the space between the rows, the space witin the rows 
between the plants, and the angle (in degrees) to align the rows.
This will be a tough one to implement.

-in | filename.tri		Read in one of 3 file formats
    | filename.obj
    | filename.pgm

-out | filename.rad		Write either Radiance file or raw text
     | filename.txt		Raw text to stdout is default

-width num			Real, width of scene in world units, adds scale
				to PGM input, rescales trimesh input

-band min max			Sets min and max elevations and resizes PGM input
				Only rescales trimesh input

-n | objectname.rad		Write either xform or instance, based on extension
   | objectname.norm
   | objectname.oct

   | -d density			Use random or pattern placement
   | -q quantity
   | -l rowspace plantspace angle

   | -band min max		Plant in elevation band or by image map
   | -mask filename.p?m

   -scale min max		Min and max scale for the object
   -rotate			Rotate a random angle
   -edge			Smaller objects near edges

have a struct called TREE_TYPE, wherein all this wonderful data is
stored: tree mask for each tree type, elevation max/min, tree data
file name, location, min/max scale, etc.


OK, there will have to be two levels of terrain generation:

landform creation (first heightfield, then triangle mesh)
object creation/placement



