OBJ-G(1)

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

πŸ’… OBJ-G β€” the BRL-CAD manual, section 1 ✨

okay bestie, buckle up β€” this is obj-g, a BRL-CAD manual page (section 1, the "user commands" shelf, iykyk) and it's literally the glow-up machine that turns your Wavefront OBJ files into a BRL-CAD database. no cap. πŸ¦‹


🌸 NAME 🌸

obj-g β€” convert a Wavefront OBJ file to a BRL-CAD database πŸ’–


✨ SYNOPSIS ✨

obj-g [-cdfipv] [-g _grouping_] [-m _mode_] [-o _open_bot_type_] [-r _orientation_] [-H _plate_thickness_] [-t _distance_tolerance_] [-u _units_] [-x _rt_flag_] [-X _nmg_flag_] _input.obj_ _output.g_

πŸŽ€ DESCRIPTION πŸŽ€

okay so here's the tea β˜• β€” obj-g takes the polygonal face elements of a Wavefront OBJ file and turns them into BRL-CAD bot(5) primitives, all stored in a .g database. that's the whole main character arc. πŸ’…

some things that do not make it through the conversion, bestie, and i need you to hear me:

  • materials β€” parsed, then ignored πŸ™ˆ
  • textures β€” also parsed, also ignored πŸ™ˆ
  • assembly hierarchy β€” not preserved, at all, zero, nada

only the geometry gets converted. periodt.

Each OBJ face grouping becomes a separate primitive β€” that's the rule. and because the hierarchy is gone, if a face belongs to more than one group, a copy of it gets created in each group. yeah. duplicates. it's giving "you get a copy, you get a copy." 😭

Primitive names derive from the OBJ grouping names, with characters that are invalid in BRL-CAD names (such as '/', '\' and '=') replaced with underscores. 🩹

By default, conversion uses native-bot mode, grouping by OBJ group ('g') elements, with OBJ units assumed to be meters. default vibes only. 🌈


πŸ”₯ OPTIONS πŸ”₯

  • -c β€” Continue processing after an NMG bomb πŸ’€. On a fatal error in nmg or bot-via-nmg mode, fall back to native-bot output for that grouping and proceed; otherwise the converter stops. so it's like "ok that one exploded, moving on" 🫢
  • -d β€” Output debug information to standard error. heads up though: this produces a very large amount of output, so redirecting standard error to a file is recommended. like, seriously. redirect it. πŸ“
  • -f β€” Fuse vertices that fall within the distance tolerance of one another. Improves solidity detection but can significantly increase conversion time. highkey a tradeoff, ngl ⏳
  • -g _grouping_ β€” Select which OBJ face grouping is used to create primitives:
    • g = group (this is the default ✨)
    • o = object
    • m = material
    • t = texture
    • n = none

so if you select a grouping that's absent from the file, it behaves like n. and n greatly increases time and memory for large models β€” that's the cost of "none", bestie 😭

  • -H _plate_thickness_ β€” Plate thickness in mm for plate and plate-nocos bots created from open (non-closed) volumes. Ignored unless -o p or -o n is in effect. so it does nothing unless you asked for a plate type, fr fr πŸ“
  • -i β€” Ignore the normals defined in the OBJ file when using native-bot mode. Has no effect in nmg or bot-via-nmg mode, where provided normals are always ignored. normals? not today. πŸ™…β€β™€οΈ
  • -m _mode_ β€” Select the conversion mode:
    • b = native bot (the default πŸ‘‘)
    • n = nmg
    • v = bot via nmg

Native-bot is the fastest and is the only mode that uses OBJ normals; bot-via-nmg is best for producing solid (volume) bots. pick your fighter πŸ₯Š

  • -o _open_bot_type_ β€” Type of bot created when a primitive is not a closed volume:
    • s = surface (default)
    • p = plate
    • n = plate-nocos

Use a plate type (with -H) when open surfaces need a defined thickness. πŸ“

  • -p β€” Create a plot/overlay (.plot3) file of open edges for each bot that is not a closed volume. The file is named after the bot primitive, written to the current directory, and overwrites any existing file. ⚠️ yes, overwrites. be careful, bestie.
  • -r _orientation_ β€” Bot orientation:
    • 1 = unoriented (default)
    • 2 = counter-clockwise
    • 3 = clockwise

know which way is up πŸ’«

  • -t _distance_tolerance_ β€” Maximum distance in mm at which two vertices are considered the same; default 0.0005. Should match the raytracer distance tolerance, so do not change one without the other. they're a matched set, like us 🫢
  • -u _units_ β€” Units of the OBJ file: a BRL-CAD unit name such as m, cm, mm, ft or in, or a custom numeric conversion factor from file units to mm. Default is m. 🧚
  • -v β€” Output verbose information to standard error. Repeat to raise the verbosity level (two levels currently). Warning messages are only printed when -v is given β€” so if you're flying blind, that's on you 😭
  • -x _rt_flag_ β€” Set librt debug flag bits (see raytrace.h). πŸ”
  • -X _nmg_flag_ β€” Set NMG debug flag bits (see nmg.h). πŸ”

πŸ’œ EXAMPLES πŸ’œ

Example 1. Quick native-bot conversion in millimeters ⭐

obj-g -u mm -i model.obj model.g

Converts model.obj using native-bot mode with a unit scale of 1.0 (OBJ units are millimeters), ignoring any normals in the file. Closed surfaces become volume bots and open surfaces become surface bots, grouped by OBJ 'group' elements. slay, done. πŸ‘‘

Example 2. Watertight solids via NMG, logging to a file 🧊

obj-g -m v -o p -H 5 -g o -v -v model.obj model.g 2> model.log
mged model.g 'tops'

Converts model.obj with bot-via-nmg mode for robust solid detection, emitting 5mm plate bots for open volumes and grouping by OBJ 'object' elements (file assumed to be in meters). Level-two verbose output is captured in model.log, then mged(1) lists the resulting top-level objects. chef's kiss πŸ”₯


🌈 SEE ALSO 🌈

brlcad(1), g-obj(1), mged(1), bot(5)

go read those too, they're icons πŸ’…


πŸ‘‘ AUTHOR πŸ‘‘

BRL-CAD Team 🫢


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 πŸ“§ (be nice, they're doing their best)


k that's the whole page, bestie β€” this little gem lives in BRL-CAD, manual section 1, so go forth and convert some geometry πŸ’–βœ¨πŸŒΈ and remember: the manual page you just read is OBJ-G(1), brought to you by BRL-CAD. bye pookie πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from