RTXRAY(1)
π rtxray β the BRL-CAD one, bestie
okay so this is rtxray(1), the BRL-CAD tool that ray traces your model and spits out a pseudo X-ray image. literally radiography but make it code. let's go β¨
π¦ SYNOPSIS
rtxray [options] model.g [objects...]
πΈ DESCRIPTION
rtxray uses librt(3) to ray trace the objects you list in the database model.g, all from a single view direction, and produces a simulated X-ray image. no cap, that's the whole vibe.
So here's how the math goes, and it's actually kind of iconic: every material is treated as having the same density. For each ray, the total path length through solid material gets accumulated, then divided by the viewsize (that's the diagonal of the model bounding box, i.e. the longest possible path), and then mapped to an 8-bit gray value. thick regions come out dark (toward 1) and thin regions come out bright (toward 255). and the value 0 is reserved for rays that hit no material at all β so the background can be keyed out super easily while the object still keeps good contrast. periodt. π
If you don't list any objects, rtxray uses the same automatic default-object selection described in rt(1). and if no single usable default can be resolved? it aborts before rendering. no half-sends, we don't do that here.
here's the tea though: most models do not fill their bounding volume, so that safe scaling above gives you very low, mostly-white contrast. π so to compensate, a contrast boost of 2.0 is applied before path lengths get mapped to gray. you can adjust it with-Aβ the value must be1.0or greater, and larger values give you more contrast but may clip thick regions to black (1). so like, use it with intention bestie.
The view gets selected with the -a (azimuth) and -e (elevation) options β in which case the model is auto-sized and the grid is centered on the model so the rays span the selected object set. alternatively, with -M a model-to-view matrix is read from standard input (with the grid covering -1.0 <= X,Y <= +1.0 in view space). that form is honestly so convenient when rtxray is being driven by a script produced by the mged(1) saveview command. iykyk π
By default the image goes to a framebuffer. use -o to write a pix(5) or png(5) image instead (a .bw extension yields an 8-bit grayscale bw(5) file β cute). with the alternate lighting model (-l 1) rtxray writes raw double-precision path lengths instead of gray pixels; this mode requires -o (it cannot drive a framebuffer, sorry bestie) and appends a .los extension when the output name looks like an image, producing data suitable for custom post-processing and scaling. π§
Because the output pixels must be emitted in order, rtxray always runs on a single CPU regardless of -P. yes, even if you ask politely. π
Most of the camera, grid, and debugging options accepted by rt(1) are also honored β see that manual page for the complete list, bestie.
β¨ OPTIONS β¨
-aazimuth β set the view azimuth in degrees and enable auto-sizing. use with-e; conflicts with-M.-eelevation β set the view elevation in degrees and enable auto-sizing. use with-a; conflicts with-M.-Mβ read a model-to-view transformation matrix (and optional animation script) from standard input instead of using-a/-e.-A# β contrast boost factor applied before the path-length-to-gray mapping (default2.0, must be>= 1.0). higher values increase contrast but may clip thick regions to black.-s# β set the square grid size to # rays on a side (default512, i.e. a512x512image).-w# β set the image width in pixels.-n# β set the image height in scanlines.-gmm β set the grid cell width in millimeters. if set without-G, cell height defaults to the same value.-Gmm β set the grid cell height in millimeters.-pdeg β set the perspective angle in degrees (0 <= deg < 180;0is orthographic, which is the default).-V#[:#] β set the view aspect ratio width/height (e.g.1.33or4:3).-l# β select the lighting (output) model:-l 0(default) writes a line-buffered grayscale image;-l 1writes raw double-precision solid path lengths (requires-o).-ofile β write the image to file instead of a framebuffer. the format follows the extension (e.g..pix,.png, or.bwfor grayscale); with-l 1a.losextension of doubles is produced.-Ofile β write a double-precision.dpixfile for full-resolution post-processing.-Fframebuffer β render to the named framebuffer (see theFB_FILEenvironment variable).-iβ use incremental (progressive-style) rendering.-tβ render top-to-bottom (the default is bottom-up).-uunits β set the display units;-u modeluses the database's local units.-P# β requested processor count. accepted for compatibility, butrtxrayalways renders with a single CPU. π-x# β setlibrtdebug flags as a hexadecimal bit vector (seeraytrace.h).-X# β set rt program/optical debug flags as a hexadecimal bit vector.-?or-hβ print a usage summary and exit.
See rt(1) for the remaining shared options (e.g. -T tolerances, -c script commands, -U air handling). the -C and -W background options of rt(1) are disabled in rtxray. π«Ά
π₯ EXAMPLES
Example 1. Pseudo X-ray from a three-quarter view
rtxray -a 35 -e 25 -s 1024 -A 4.0 -o xray.png model.g all
Ray traces the group all in model.g from azimuth 35, elevation 25 degrees on a 1024x1024 grid and writes a grayscale PNG with a contrast boost of 4.0. thicker portions of the model appear darker, the empty background is pure black (value 0), and the boosted contrast keeps a sparse model from washing out to white. slay. π
Example 2. Raw path lengths for post-processing
rtxray -M -l 1 -o paths.los model.g component < component.rt
Reuses the camera from an mged(1) saveview script (the matrix is read from standard input via -M) and, with the alternate lighting model, writes one double-precision solid path length per ray to paths.los instead of gray pixels. the resulting array can be scaled or analyzed externally to apply true material densities. big main character energy. π
π SEE ALSO
brlcad(1), mged(1), rt(1), rtdepth(1), rthide(1), bw-fb(1), bw(5), librt(3)
π«Ά AUTHOR
BRL-CAD Team
π COPYRIGHT
This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.
π BUG REPORTS
Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org
okay that's the whole page bestie, go make some gorgeous X-rays π this was RTXRAY(1) from BRL-CAD, mwah, bye! π¦β¨
π¦ where this page comes from
- nixpkgs unstable: brlcad 7.44.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms