G-VOXEL(1)

πŸ“¦
version 7.44.0 Β· 2 versions
, in nixpkgs unstable

✨ G-VOXEL(1) ✨ β€” the BRL-CAD cutie that turns your geometry into a voxel list πŸ’…

okay so bestie, welcome to g-voxel, part of the BRL-CAD family (that's the manual name btw, in case the header vibe wasn't clear πŸŽ€). Sit down, grab a strawberry drink πŸ“, and let's get you voxelized.


🌈 NAME 🌈

g-voxel β€” voxelize BRL-CAD geometry into a list of occupied voxels. literally that's the whole job and it ate fr fr πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

g-voxel [-s "_dx dy dz_"] [-d _n_] [-t _f_] _model.g_ _object_...

yes that's it, three little flags and then your model and your objects, slay ✨


πŸ’– DESCRIPTION πŸ’–

So here's the tea β˜•: g-voxel raytraces the object(s) you name in a BRL-CAD database model.g, and then samples the geometry onto a regular three-dimensional grid of voxels. It's giving "graph paper but make it 3D" 🧚

Each voxel gets sampled by firing a grid of rays straight through it. That gives you a fill fraction β€” the portion of the voxel that's actually occupied by geometry, and yes it runs from 0.0 to 1.0, no cap πŸ“. Then that fill fraction gets compared against a threshold.

Every voxel whose fill fraction meets or exceeds the threshold gets written out, one per line, into the file voxels1.txt in the current directory. πŸ‘‘ And here's the important bit, bestie, do not skip this: the output is appended. So an existing voxels1.txt gets added to, not replaced. Not me learning that the hard way πŸ™ˆ

Each output line has three things: the voxel center coordinates (in millimeters, relative to the model bounding box), the name of the region occupying that voxel, and the fill fraction:

(x, y, z)        region_name        fill

iconic format, no notes πŸ’…


✨ OPTIONS ✨

  • -s "dx dy dz" β€” sets the voxel dimensions along the X, Y, and Z axes, in millimeters. ⚠️ The three values must be given as a single quoted argument β€” all three, one string, that's the vibe check. Default is 1.0 1.0 1.0.
  • -d n β€” sets the level of detail, i.e. the number of rays fired per voxel edge (so it's n x n rays sampling each voxel face πŸŽ€). Higher values give you more accurate fill fractions, but at greater cost β€” more rays, more work, you know how it is. Default is 4.
  • -t f β€” sets the fill threshold in the range 0.0 to 1.0. A voxel only gets written when its fill fraction is greater than or equal to f. Default is 0.5.

🌸 EXAMPLES 🌸

Example 1. Voxelize at a coarse resolution and inspect the result 🫢

rm -f voxels1.txt
g-voxel -s "5 5 5" -d 8 -t 0.5 havoc.g havoc
wc -l voxels1.txt

This removes any stale output first, then voxelizes the havoc object using 5mm cubic voxels and 8x8 rays per voxel, keeping the voxels that are at least half full. Counting the lines of voxels1.txt tells you how many voxels were occupied. πŸ”₯

And the rm is genuinely important, bestie β€” remember, g-voxel appends to the output file. Skip it and you're counting last week's voxels too 😭

Example 2. Capture only nearly solid voxels at fine resolution πŸ’€

rm -f voxels1.txt
g-voxel -s "1 1 1" -d 16 -t 0.95 engine.g block

Uses 1mm voxels with dense 16x16 sampling and a high threshold, so that only voxels almost entirely filled with material get recorded β€” producing a tight solid-core approximation of the block region. That's the "only the real ones" filter, periodt πŸ’…


⭐ SEE ALSO ⭐

brlcad(1), rt(1), g-raw(1), rtcheck(1) β€” go read those too, iykyk πŸ“š


πŸŽ€ AUTHOR πŸŽ€

BRL-CAD Team β€” kings, honestly πŸ‘‘


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 β€” tell them everything, they're nice about it 🫢


and that's the whole page, bestie β€” no cap, you're now a voxel girlie πŸ’…βœ¨

signing off from the BRL-CAD source tree 🌈 β€” this is G-VOXEL(1), brought to you by BRL-CAD, copyright 1989-2026, and yes the year range is literally in the page so we're keeping it πŸŽ€

πŸ“¦ where this page comes from