# NAME

rt - raytrace an MGED model, giving a shaded picture

# SYNOPSIS

rt [ options ... ] model.g objects ...

# DESCRIPTION

Rt operates on the indicated objects in the input model.g and produces a color shaded image as the output. By default, the output is placed on the current framebuffer as it is computed. The environment variable FB_FILE specifies the current framebuffer, see brlcad(1). Alternatively, the output can be stored in a pixel file (pix(5) format) by specifying -o output.pix in the option list. The orientation of the rays to be fired may be specified by the -a and -e options, in which case the model will be autosized, and the grid will be centered on the centroid of the model, with ray spacing chosen to span the entire set of objects. Alternatively, with the -M option, a transformation matrix may be provided on standard input which maps model-space to view-space. In this case, the grid ranges from -1.0 <= X,Y <= +1.0 in view space, with the size of the grid (number of rays fired) specified with -s. The -M option is most useful when rt is being invoked from a shell script created by an mged(1) saveview command. The following options are recognized:

-a#
  selects auto-sizing, and gives the view azimuth in degrees. Used with -e and conflicts with -M
-b ``# #''
  is sometimes useful for debugging. A single ray is fired at the pixel coordinates specified. This is best when accompanied by debugging options. Note that the standard getopt(3) routine only allows options to have one parameter, so the X and Y pixel coordinates need to be combined into one string parameter by enclosing them in double quotes. This option must follow any viewing parameters.
-c ``script_command''
  is used to supply on the command line any command that can appear in a -M command script. For example, -c ``set'' will print the values of all settable variables.
-e#
  selects auto-sizing, and gives the view elevation in degrees. Used with -a and conflicts with -M
-g#
  is used to set the grid cell width, in millimeters. Ordinarily, the cell width is computed by dividing the view size by the number of pixels of width, so this option need not be used. To obtain exactly 1 inch ray spacing, specify -g25.4. If the grid cell width is specified and the grid cell height is not specified, the grid cell height defaults to be the same as the width.
-i
  enables incremental mode processing. First a single ray is fired. Then, the screen is subdivided into four parts by evenly subdividing in the vertical and horizontal directions. The previously fired ray was the lower left corner; three more rays are fired. This process recurses until full resolution has been reached. Assumes square image. Also assumes fast path between CPU and display hardware.
-l#
  Select lighting model. Default is 0. Model 0 is a full lighting model with the ability to implement Phong shading, transparent and reflective objects, shadow penumbras, texture maps, etc. In addition to ambient light, a small amount of light is supplied from eye position. All objects in the active model space with a material property string of ``light'' represent additional light sources (up to 16 are presently permitted), and shadow computations will be initiated automaticly. (This mechanism is subject to further change). Model 1 is a diffuse-lighting model only, and is intended for debugging. Model 2 displays the surface normals as colors, and is useful for examining curvature and surface orientation. Model 3 is a three-light diffuse-lighting model, and is intended for debugging. Model 4 is a curvature debugging display, showing the inverse radius of curvature. Model 5 is a curvature debugging display, showing the principal direction vector.
-n#
  defines the height of the image as a number of scanlines.
-o
  output.pix Specify the name of a file to store the pix(5) format output. The pix-fb(1) utility can be used later to display ``.pix'' files.
-p#
  Sets the perspective, in degrees, ranging 0 <= # < 180.
-r#
  requests that overlapping regions be reported.
-s#
  specifies the number of rays to fire in the X and Y directions on a square grid. The default size is 512 pixels. There is no maximum size limit.
-w#
  defines the width of each scanline in pixels.
-x#
  sets the librt(3) debug flags to the given hexadecimal bit vector. See librt/debug.h for the bit definitions.
-A#
  sets the ambient light intensity, as a fraction of the total light in the scene in the range of 0.0 to 1.0.
-B
  The ``benchmark'' flag. When specified, all intentional random effects such as ray dither, color dither, etc, are turned off, to allow benchmark timing comparison and benchmark result comparison.
-C#/#/#
  sets the background color to the RGB value #/#/#, where each # is in the range of 0 to 255. All non-background colors will be dithered away from this value.
-D#
  The "desired frame" flag, specifies frame number to start with. Specify the desired ending (kill-after) frame with -K#
-E#
  sets the distance from the eye point to the center of the model RPP. Only useful with auto-sizing, conflicts with -M
-F framebuffer
  indicates that the output should be sent to the indicated framebuffer. See libfb(3) for more details on the specification of a framebuffer.
-G#
  sets the grid cell height, in millimeters.
-H#
  The "hypersample" flag, specifies number of extra rays to fire for each pixel, to obtain more accurate results without needing to store the extra pixels. Causes -J1 to be set. The final colors of all rays are averaged together. Better results can be obtained by simply increasing the resolution, and decimating the results with a filter such as pixhalve(1). -I Turns on interactive mode. If this flag is off, and your image is "large" (>= 256x256) it will lower the priority of the rt process.
-J#
  The "jitter" flag, is a bit vector. If one (-J1), randomizes the point from which each ray is fired by +/- one half of the pixel size. Useful if doing your own post filtering for antialiasing, or to eliminate systematic errors. This has been useful in obtaining more accurate results in a volume-calculating raytraces as well. If two (-J2), shifts the origin of the output frame once for each frame. The shift is along a circular path in the plane of the frame, with a period of ten seconds, and a radius of +/- 1/4 pixel width. If three (-J3), performs both operations.
-K#
  sets the final (kill-after) frame number. Used with animation scripts in conjunction with -D#
-M
  Read animation matrix or animation script from standard input. Conflicts with -a and -e
-O
  output.dpix Specify the name of a file to store the double-precision floating-point version of the image. dpix-pix(1) can be used to later convert the file to pix(5) format output. (Deferred implementation).
-P#
  Specify the maximum number of processors (in a multi-processor system) to be used for this execution. The default is system dependent. On ``dedicated'' multi-processors, such as workstations and super-minis, the default is usually set for the maximum number of processors, while on shared multi-processors, such as SuperComputers, usually just one processor is used by default.
-S
  Turns on stereo viewing. The left-eye image is drawn in red, and the right-eye image is drawn in blue.
-T#
  or -T#,# or -T#/# Sets the calculation tolerances used by librt(3). If only one number is given, it specifies the distance tolerance. Any two entities closer than this distance are considered to be the same. The default distance tolerance is 0.005mm. If the second number is given, it specifies the value of the dot product below which two lines are to be considered perpendicular. This number should be near zero, but in any case should be less than 1. The default perpendicular tolerance is 1e-6. If both calculation tolerances are provided, they shall be separated by either a slash ("/") or a comma (","), with no white space between them. For example, the default tolerances would be specified as -T0.005/1e-6 on the command line.
-U#
  Sets the "use_air" value. Default is 0, which ignores regions that have non-zero aircode values.
-V#
  Sets the view aspect. This is the ratio of width over height and can be specified as either a fraction or a colon-separated ratio. For example, the NTSC aspect ratio can be specified by either -V1.33 or V4:3
-X#
  Turns on the rt (1) program debugging flags. See rt/rdebug.h for the meaning of these bits.

The rt program is a simple front-end to librt(3) which can be invoked directly, or via the rt command in mged(1).

# "SEE ALSO"

brlcad(1), mged(1), lgt(1), pix-fb(1), rtray(1), rtpp(1), librt(3), ray(5V), pix(5).

# DIAGNOSTICS

Numerous error conditions are possible. Descriptive messages are printed on standard error.

# AUTHOR

Michael John Muuss

# SOURCE

SECAD/VLD Computing Consortium, Bldg 394
The U. S. Army Research Laboratory
Aberdeen Proving Ground, Maryland 21005

# COPYRIGHT

This software is Copyright (c) 1985-2011 United States Government as represented by the U.S. Army Research Laboratory. All rights reserved.

# BUGS

Most deficiencies observed while using the rt program are usually with the librt(3) package instead.

# "BUG REPORTS"

Reports of bugs or problems should be submitted via electronic mail to <devs@brlcad.org>, or via the "cadbug.sh" script.