rtray — raytrace an mged model, writing a VLD rayfile


rtray [options...] model.g objects... > model.ray


rtray operates on the indicated objects in the input model.g and produces a VLD standard ray(5V) format ray file on standard output. The "ob" field of the ray(5V) file is set to the region id of each intersected region, or to the negative of the aircode for each air region, or to one of five VLD-standard reserved values:


zero-thickness "paint" at ray's first entry into the model.


zero-thickness "paint" at any ray's exit interior to the model RPP.


(unmodeled) air between modeled regions.


zero-thickness "paint" at any ray's entry interior to the model RPP.


zero-thickness "paint" at ray's final exit from the model.

The "rt" ray tag field of the ray(5V) file is a 32-bit value set to a combination of the grid X and grid Y coordinates, plus the recursion/iteration (a_level) value (used mostly for multibounce effects in radar simulation). This allows all ray(5V) records pertaining to the same grid cell to be identified.

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 This option is most useful when rtray is being invoked from a shell script created by an mged(1) saveview command.

The following options are recognized.


Number of rays to fire in X and Y directions (square grid). Default is 512 (512x512).


Select azimuth in degrees. Used with -e and conflicts With -M


Select elevation in degrees. Used with -a and conflicts with -M


Read model2view matrix from standard input. Conflicts with -a and -e

-U #

sets the Boolean variable use_air to the given value. The default for rtray(1) is on, i.e. -U1, but the effect of air regions may be disabled with -U0.


output.ray specifies a named ray file for output. By default, the rays are written to stdout. Note that the VLD standard ray file format ray(5V) is a machine-specific binary format, which means ray files should be moved between machines with care.

As an alternative to the

-s# option, the grid cell sizes can be specified with -g# used to set the grid cell width, and -G# optionally used to set the grid cell height. 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.


Set librt debug flags to (hexadecimal) number.

The rtray program is a simple front-end to librt(3) which is most useful when used with mged(1) and the VLD ray filters. In order to convert a ray file into a minimal monochrome UNIX-plot image for viewing, run:

/vld/bin/rayvect -mMM < file.ray > file.vect

/vld/bin/vectplot -mMM < file.vect > file.plot3

tplot -Tmeg file.plot3 # or other plot filter

plot3-fb < file.plot3


gift(1V), mged(1), raydump(1V), rayplot(1V), rayvect(1V), rt(1), rtpp(1), librt(3), plot3(5), ray(5V)


Numerous error conditions are possible. Descriptive messages are printed on standard error (file descriptor 2).


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




This software is Copyright (c) 1986-2016 United States Government as represented by the U.S. Army Research Laboratory.


Reports of bugs or problems should be submitted via electronic mail to <>.