rtxray — compute a pseudo X-Ray image of a model.


rtxray [options...] model.g objects...


rtxray operates on the indicated objects in the input model.g and produces a simulated X-Ray image. At present, all materials are treated as having the same density. The total path length of each ray through solid material is computed and the result is divided by the "viewsize" (the length of the diagonal of the bounding box of the model, which represents the longest possible path). This relative thickness is then converted to gray scale where black (1) is the greatest possible thickness, through white (255) which represents a very thin region. The color 0 is reserved for rays which pass through no material at all. This provides good contrast for the object (which would not usually be the case if 255 were chosen) and allows the background to be easily replaced.

Most models do not fill their bounding volume (a box which just encloses the model) so the "safe" scaling described above usually results in very low contrast (mostly white) objects. Because of this, a default contrast boost of 2.0 is applied before the path lengths are converted to gray scale. This value can be changed with the -A# flag. This value must 1.0 or greater. Larger values provide higher contrast but may result in clipping values to black (actually 1).

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 rtxray 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


Contrast enhance the output image by the given factor. Default value is 2.0. See discussion above.

-o specifies a named BW(5) file for output. By default, the output is displayed on a frame buffer.


use the alternate "lighting model". In this mode, double precision floating point numbers are written (-o must be used). Each number is the actual solid material path length for that ray. This allows for post processing and scaling.

See the rt manual page for additional arguments that can be used with this program.


rt(1), rtray(1)


This program should do something about material properties (X-Ray density) in order to provide a more realistic result.


Phillip Dykstra


This software is Copyright (c) 1990-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 <>.