G-OBJ(1)
π G-OBJ(1) β bestie's guide to the BRL-CAD OBJ exporter β¨
okay so real talk, this is a page from the BRL-CAD manual set, and it's all about g-obj, the little icon that takes your gorgeous BRL-CAD geometry and drops it into Wavefront OBJ format. no cap, it's a whole vibe.
β¨ NAME β¨
g-obj β convert BRL-CAD geometry to a Wavefront OBJ file π¦
π SYNOPSIS π
g-obj [-h|-?] [-m] [-v] [-i] [-u] [-x rt_debug] [-X nmg_debug]
[-a abs_tol] [-r rel_tol] [-n norm_tol] [-D dist_tol]
[-P ncpu] [-e error_file] [-o output.obj] database.g object(s)
like, that's the whole shape of the thing, bestie. flags first, then your database.g, then whichever object(s) you're obsessed with π
πΈ DESCRIPTION πΈ
g-obj converts the specified object(s) from a BRL-CAD database.g file over to the Wavefront OBJ format. literally its whole job, and it ate π
so here's the tea on how it works: each region gets tessellated into an NMG, evaluated, and triangulated β which means the resulting OBJ contains only triangular faces. no quads, no n-gons, no chaos. just triangles, periodt πΊ
OBJ output goes to output.obj when you pass the -o option. if you don't? it goes to standard output instead. and the coordinates are emitted in millimeters by default, or in inches with -i.
π«Ά little heads-up that's actually kind of important: when you're writing to a named OBJ file,g-objalso writes a companion.mtlmaterial file with the same base name. that material file preserves effective BRL-CAD colors β and by "effective" we mean colors set on geometry, colors inherited from combinations, or colors supplied by region color-id mappings. all of it, slay π
but if the OBJ output goes to standard output, then no companion .mtl file can be created β and therefore BRL-CAD colors are not exported. π that's just how it is, bestie.
also go look at g-stl(1) and g-ply(1) for related polygonal exporters, they're the sibling energy π
π₯ OPTIONS π₯
okay this is the part where we go through literally every single flag, so buckle up π
-h,-?β print a usage summary and exit. the "wait, how does this work again" button π-iβ write output coordinates in inches instead of the default millimeters.-mβ emitusemtlstatements. and when a companion.mtlfile is written, the generated material names preserve the BRL-CAD GIFT material id, LOS, and aircode, with a color suffix appended when needed to distinguish different RGB assignments. iconic behavior honestly π-uβ write vertex normals (vn) and reference them from the face records.-vβ verbose output, reporting progress for each region processed. perfect for when you need to see it working β¨-aabs_tol β set the absolute tessellation tolerance: the maximum allowable distance (in millimeters) between a tessellated face and the true surface. note that setting this clears the relative tolerance. π-rrel_tol β set the relative tessellation tolerance as a fraction of the bounding box size. the default is0.01.-nnorm_tol β set the surface-normal tessellation tolerance: the maximum allowable angle (in degrees) between adjacent face normals. setting this clears the relative tolerance too, just so you know.-Ddist_tol β set the calculational distance tolerance, in millimeters. vertices closer together than this distance are treated as the same vertex. two-for-one deal fr fr.-Pncpu β request use ofncpuprocessors during processing. multiprocessor main character energy π₯-eerror_file β write diagnostics toerror_file. by default diagnostics go to standard error.-ooutput.obj β write OBJ output tooutput.obj, and a companion.mtlfile with the same base name. the one that unlocks colors π-xrt_debug β set the librt debug flags to the given hexadecimal value.-Xnmg_debug β set the libnmg debug flags to the given hexadecimal value.
π EXAMPLES π
π Example 1. Export a region to OBJ with materials
g-obj -o havoc.obj havoc.g havoc
Tessellate the havoc region from havoc.g and write havoc.obj along with a companion havoc.mtl that captures the model's BRL-CAD colors. chef's kiss π
π Example 2. Export with vertex normals and material codes
g-obj -m -u -a 0.5 -o tank.obj tank.g turret hull
Convert the turret and hull objects with a 0.5 mm absolute tessellation tolerance, emitting vertex normals and usemtl statements whose names encode GIFT material, LOS, and aircode values. look at her go π₯
π Example 3. Pipe OBJ output in inches to standard output
g-obj -i sample.g sample_object > sample.obj
Write the geometry in inches to standard output, redirected into sample.obj. Because no named OBJ file is opened, no companion .mtl file is produced and colors are not exported. sad but true π
π¦ SEE ALSO π¦
brlcad(1), g-stl(1), g-ply(1), obj-g(1), mged(1)
(the whole friend group, honestly π )
π§ 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
found something cursed? tell the devs, don't suffer in silence bestie π«Ά
and that's the whole page! brought to you by BRL-CAD (the G-OBJ(1) manual, no less), with the copyright window running 1989-2026 β so like, she's been serving since before most of us were born ππ
π¦ 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