Documentation for the "render" Program
Overview
The render program is a high quality ray-cast terrain renderer for
producing "flyover" animations of topographic data sets. It is the
same renderer which is used by the
Surveyor program for its high quality rendering. The render
program is needed when you want to have fine control over various
parameters to which you do not have access in Surveyor. Typically, you
will create a flight path using Surveyor, then use the program
surv2rend to convert the flight path to a render parameter
file (see PARMFILE below). You must then
write a script file to sequentially render all the frames in the
path file.
Command line
The command line for render on Unix systems is as follows:
render inp out outsize [dimg] [pimg]
where inp is the input file list, out is out output file
list, outsize is the name of your output file(s), and
dimg and pimg are the names of your output distance and
percent images respectively. These are each described below.
- inp
- This parameter is the list of your input files, separated by
commas. The first file must be the elevation map (topography). The
following file(s) are the corresponding image data set(s). Either one
image file (for grey scale) or three image files (for color) may be
given. The number of output files given must match the number of
image files given here. All file are VICAR images, and may be either
BYTE or HALF format. See examples.
- out
- This parameter specifies the output images to be computed. The
same number of files must be specified as input image files (the
elevation file does not count here). The output files will be VICAR
images, unless the NOLABELS option (described below) is given.
- outsize
- This parameter gives the size of the output images to be
computed. It is given as number of lines then number of smaples,
separated by a comma. (Do not use parentheses). See
examples.
- dimg
- This optional parameter is the name of the distance image to be
output if desired. The distance image is a VICAR image in REAL (32
bit floating point) format, where each pixel represents the distance
from the eye to the ground for that location.
- pimg
- This optional parameter specifies the name of the percent image
to be output if desired. The percent image is a VICAR image in BYTE
format, where each pixel represents the percentage of the pixel which
is terrain (as opposed to sky, or background). For example, if 4 rays
were cast for that pixel, and only three hit the terrain, the pixel
value in the percent image would be 75.
Examples:
render la.ele,la.bw frame.img 480,512 - renders a 480 line by
512 sample black and white frame.
render la.ele,la.red,la.grn,la.blu f.red,f.grn,f.blu 200,200
dist.img per.img - render a 200 square color frame, and also
generates the distance and percent images.
Options
The options for render are given with Unix environment variables,
which in the C shell (csh) are specified with the setenv command. For
example, to specify the option FOOBAR as ON, you would
enter:
setenv FOOBAR ON
Remember Unix is case sensitive, so case must be given as specified.
To make life easier, all options are upper case only.
To make the descriptions simpler, each variable is described as integer,
float, string, or keyword. Integer variables may take only integers,
float variables may take any real number, string variables may take
strings (valid values will also be given) and keyword variables take
nothing. For example:
Command Type
setenv FOOBAR 3 integer
setenv FOOBAR 4.55 float
setenv FOOBAR ON string
setenv FOOBAR keyword
Required Options
The following options must be specified for render to run.
- PARMFILE
- (string) This option specifies the name of the parameter file for
render to use. The parameter file will be either the file output from the
VICAR program PATH2TEXT, which will convert your path file from
3DI, or output from the program surv2rend, which will convert
your Surveyor flight path to a parmfile that render can read.
Each line in the parmfile contains the viewing parameters for a single
frame, which is selected when rendering with the FRAME parameter.
The parameters which appear on the line are (in order of appearance):
AZLOOK, AZMUTH, DIST, ELEV, FOV, PITCH, XYRES, ZRES, SL, SS, NL, NS,
ROLL. The SL, SS, NL, and NS parameters are integers and describe
the SIZE field. All the other parameters are described below.
SL, SS, NL, NS, and ROLL are optional.
- FRAME
- (integer) This option specifies which frame in the parmfile to
render. The first frame is 1.
Recommended Options
- FIELD
- (string, valid values: EVEN, ODD, BOTH.
Default: BOTH) Specifies which lines should be rendered.
Using EVEN or ODD will result in a half-height image, with only even
or odd lines rendered. This option is used when recording on video
tape, where the odd and even lines are interlaced. When generating
the parameter file with PATH2TEXT, generate twice as many frames
(i.e., 60 frames per second instead of 30). Then render ODD fields
for the odd frames, and EVEN fields for the even frames, and use the
program weave to combine the two into a single frame for
recording.
- MINELEV
- (integer, default 0) Specifies the minimum elevation to be found
in the elevation data set, in pixel value (DN) units. Specifying
MINELEV and MAXELEV can greatly speed up the rendering process.
- MAXELEV
- (integer, default 255 for byte data, 32767 for halfword data)
Specifies the maximum elevation to be found in the elevation data set,
in pixel value (DN) units. Specifying MINELEV and MAXELEV can greatly
speed up the rendering process.
- PYRAMID
- (integer, default 1) Specifies the number of levels that are
present in the image pyramid from which the terrain is to be rendered.
Highly recommended for all but the smallest of data sets, because
processing time is greatly reduced and rendering quality is greatly
enhanced. A pyramid can be made with the makepyr command on
the DIAL Unix machines.
- RAYS
- (integer) Specifies the number of rays to be cast per pixel. When
generating a high quality still frame or animation, using multiple
rays per pixel is highly recommended; it does, however, take longer to
compute. When possible, 9 or 16 rays per pixel are recommended. For
tests, use only one ray per pixel.
- SIZE
- (keyword, or set of 4 integers). When used as a keyword,
SIZE specifies that the SIZE field in the parameter file
should be ignored, and that the inputs should be mapped to virtual
memory. When working with large data sets, this is recommended, and
often necessary. When used as a set of four integers, SIZE
specifies the area in the input from which data is to be fetched.
This option is not currently recommended and will not be discussed
further here.
Viewing Parameters
These parameters are generally specified in the path file, but they
may be overridden with these variables. There are no default values
listed because the default is always what is in the path file.
- AZLOOK
- (float) Specifies the clockwise angle in degrees from the center
of the input image to which the camera view is rotated. If
AZLOOK is 0.0 or 360.0, then the camera will look directly at
the center of the image.
- AZMUTH
- (float) Specifies the clockwise angle in degrees around the
center of the input image at which the camera position is located.
Due north is 0.0, east is 90.0.
- DIST
- (float) Specifies the distance in pixels from the center of the
input image of the camera position. If your input image was 100
lines, an AZMUTH of 0 and a DIST of 50 would place your
camera in the center of the top line.
- ELEV
- (float) Specifies the elevation of the camera above 0 in the
elevation image.
- FOV
- (float) Specifies the field of view of the camera. The wider of
the image dimensions of the output frames will subtend this angle.
- PITCH
- (float) Specifies vertical angle of the camera view direction. A
pitch of 0.0 will look horizontally at the horizon; a pitch of -90.0
will look straight down.
- ROLL
- (float) Specifies camera roll. The camera will be rolled ROLL
degrees counter-clockwise about the view direction (the image will
appear to rotate clockwise). A roll of 0.0 is upright, 180.0 is upside
down. NOTE: because of the algorithm used to speed up
the ray-casting, large values for roll (> 20 degrees) can sometimes
develop artifacts, so check your frames carefully when using roll,
especially if you have very tall (spiky) mountains and/or a very wide
(> 120 degree) field of view.
- XYRES
- (float) Specifies a scaling to be applied to the input image in
the plane of the image. This parameter is usually set to the
resolution in meters (or some other unit) of the data.
- ZRES
- (float) Specifies a scaling to be applied to the elevation. For
a vertical scale of 1 (no exaggeration), ZRES is normally set
to the units of the pixels in the elevation image in meters (or some
other unit). To double the vertical exaggeration, you can double
ZRES.
Other Options
- ASPECT
- (float, default is calculated) Specifies the aspect ratio
of the device you will use to display the final image, width:height.
For NTSC video, ASPECT should be set to 1.33333, assuming you are
filling your frame buffer. For example, for an Abekas video disk,
you would use an output size of 486 lines by 720 samples, with
ASPECT set to 1.3333. The image will then be warped so that after
reshaping your image to the ASPECT ratio, you will get square pixels.
So for the Abekas case just described, if you display the image
on your workstation screen instead of an Abekas the image will look
short and fat.
- BACKGRND
- (set of 3 integers, default 0,0,0 [black]) Specifies a color
(R,G,B) for the background in the rendered scene. Any pixel which has
no data (sky) will be set to this color, unless HAZE is also set.
- BLUR
- (keyword) If blur is turned on, stochastic sampling is used
to apply motion blur to the animation. Each ray cast randomly assigned
to one of the cells within its pixel on the view plane (each ray gets
its own cell; that is, they are shuffled), and is jittered in time
between the current frame and the next frame in the path file. Blur
works best with many rays per pixel (RAYS) to
obtain good results.
- CAMERA
- (string, valid values: ABOVE, BELOW. No set
default.) This option specifies whether you want to render the top or
bottom of the terrain data. If the camera is ABOVE, the top is
rendered, and if the camera is BELOW, the bottom is rendered.
By default, this parameter is determined by the actual position of the
camera relative to the terrain.
- EMINLEVEL
- (integer, default 0) Specifies the minimum level in the pyramid
of elevation images that is present. This option allows you to delete
the highest resolution level(s) of your pyramid when they are not
needed. For example, if your image data is 28.5 meter resolution, and
your original elevation data was 100 meter resolution, part of your
preprocessing would be to resample the elevation data to be the same
resolution as the image data, making the file 3.5 times the resolution
of the actual data. Once the image pyramid is created, you could
remove the original image and set EMINLEVEL to 1 with no
degradation in rendered image quality. You could also remove the next
level of the pyramid and set EMINLEVEL to 2 with only slight
degradation (probably not noticeable) in rendered image quality.
- GAMMA
- (float, default 1.0) Specifies that gamma correction be applied
to the rendered image as it is rendered. Gamma correction is like a
stretch which compensates for non-linearity in video monitor response.
A typical monitor has a gamma of about 2.2. A gamma of 1.0 applies no
correction. For most image data, gamma correction is not needed,
because it is processed on monitors and the correction is generally
built into the image.
- HAZE
- (set of 3 integers, default same color as BACKGRND) Specifies a
color (R,G,B) for haze. If HAZEDIST is zero, the effect of HAZE is to
provide a horizon (zero pitch) color, which then blends smoothly going
up until at vertical (+90 deg. pitch) it is the BACKGRND color.
- HAZEDIST
- (float, default 0.0) Specifies a distance from the eye at which
a horizontal ray (pitch=0) would become purely the HAZE color. The haze
as a function of distance is modulated the the function of height; so
as a ray looks up more (positive pitch), the effect of haze is less. Thus,
the sky looks the same whether HAZEDIST is used or not. A value of zero
turns off haze over the terrain.
- JITTER
- (float, default 0.5) JITTER randomly varies the position of a ray
within its viewplane cell. A value of 0.0 would mean the ray is fixed
in the center of the cell, and a value of 1.0 would mean the ray will
be randomly cast somewhere within the cell. JITTER is used to replace
some of the aliasing which occurs when rendering with some noise, to
break up artifacts and make the aliasing less visible.
- NOLABELS
- (keyword) Specifies that the output image file(s) should not
have any VICAR labels on them. The resultant images will be
raw raster image files with no header.
- NOSPREAD
- (keyword) Specifies that when a ray intersects the surface, the
pyramid level currently being used in the elevation be used for the image
data directly. The default is to recalculate the level of detail for the
image pyramid based on the angle of incidence with the surface, to allow
some smoothing for anti-aliasing.
- SMEAR
- (float, default 1.0) Specifies a scaling to be applied to
pyramid transition distances. A scaling of 2.0 causes lower
resolution levels of the pyramid to be accessed at half the normal
distance; 3.0 at a third, etc. For most intermediate distances, a
value of SMEAR greater than 1.0 will cause the resultant image
to look a little blurrier; but when close to the data the full
resolution is still there (unsmeared).
Dan Stanfill (dan@tone.jpl.nasa.gov), modified 12/5/94.
Original HTML formatting done by
Elizabeth.D.Duxbury@jpl.nasa.gov,
October 17, 1994.