Skip to documentation
DocumentationAll documentsEnglish

G-VRML(1)

NAME

g-vrml - convert a BRL-CAD geometry database to a VRML 2.0 file

On this page

SYNOPSIS

g-vrml [-b | -e] [-v] [-d _calc_dist_tol_] [-a _abs_tess_tol_] [-r _rel_tess_tol_] [-n _norm_tess_tol_] [-u _units_] [-x _librt_debug_flag_] [-X _NMG_debug_flag_] [-o _output.wrl_] _database.g_ _object_ [_object_ ...]

DESCRIPTION

g-vrml converts the named objects from a BRL-CAD geometry database (database.g) into a faceted Virtual Reality Modeling Language (VRML) version 2.0 file. By default each region is tessellated and its Boolean operations are evaluated through the NMG routines, producing a triangulated IndexedFaceSet per region. Region colors and shaders (plastic, glass, texture) are translated into VRML material and texture nodes, and regions using the light shader are emitted as VRML light sources.

The result is written to the file named with -o, or to standard output if -o is not given. Output units default to millimeters; see -u to select a different unit. The conversion is the inverse direction of importers such as vrml-g would be, and complements other geometry exporters such as g-stl(1) and g-obj(1).

OPTIONS

-b

Dump BOT (Bag of Triangles) primitives directly to the VRML file without performing any Boolean evaluation; non-BOT (CSG) primitives are skipped. Mutually exclusive with -e.

-e

Evaluate all geometry, tessellating and performing the Boolean evaluation of both CSG and BOT primitives. Mutually exclusive with -b.

-v

Verbose output; report conversion progress on standard error.

-d calc_dist_tol

Calculational distance tolerance in millimeters, used to distinguish neighboring vertices. The default is 0.005.

-a abs_tess_tol

Absolute tessellation tolerance in millimeters (maximum chord error). Setting this disables the relative tolerance.

-r rel_tess_tol

Relative tessellation tolerance, expressed as a fraction of the bounding box of each primitive. The default is 0.01.

-n norm_tess_tol

Surface normal tessellation tolerance in degrees (maximum allowed angle between approximated and true surface normals). Setting this disables the relative tolerance.

-u units

Units for the resulting VRML file. The default is mm. Any unit name accepted by BRL-CAD (for example m, cm, in, ft) may be used.

-x librt_debug_flag

Set the librt debug flag (hexadecimal). See raytrace.h for bit values.

-X NMG_debug_flag

Set the NMG debug flag (hexadecimal). See nmg.h for bit values.

-o output.wrl

Write output to the named file. If omitted, output is written to standard output.

-h, -?

Print a usage message and exit.

EXAMPLES

Example 1. Convert specific tops objects to a VRML file
g-vrml -o havoc.wrl -u m havoc.g havoc

Tessellates and Boolean-evaluates the havoc object from havoc.g and writes a VRML 2.0 model in meters to havoc.wrl, ready to load in a web or desktop VRML viewer.

Example 2. Export only the triangle meshes from a model
g-vrml -b -o meshes.wrl model.g body wheels

Dumps the BOT meshes contained under the body and wheels objects directly, skipping CSG primitives and the comparatively slow Boolean evaluation. This is useful when a model is already mostly faceted and you want a fast export.

SEE ALSO

brlcad(1), mged(1), g-stl(1), g-obj(1), g-dxf(1)

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