keckcaves:adding_additional_3d_geometry_to_vrui_applications_using_scene_graphs

Vrui applications usually focus on visualizing one particular kind of 3D data. LiDAR Viewer only deals with 3D point clouds, Crusta only deals with global digital elevation models, and 3D Visualizer only deals with gridded volumetric data.

It is possible to add additional 3D geometry, outside the original scope, to any application using so-called scene graphs. A scene graph is a description of 3D geometry written in the Virtual Reality Markup Language (VRML, usually pronounced “vermel”). Just like HTML (HyperText Markup Language) describes the complete layout of a web page in a textual form, so does VRML describe complete 3D scenes. For example, scene graphs can be used to add tectonic plate boundaries or plume location markers to Vrui's Earthquake Viewer, or to add earthquake hypocenter locations and 3D fault geometries to Crusta, or to add coordinate axes and labels to 3D Visualizer, etc. Some Vrui applications, such as LiDAR Viewer and 3D Visualizer, have built-in support for user-created scene graphs; in applications that don't, scene graphs can be added via the SceneGraphViewer vislet. To add the scene graph described in VRML file Foo.wrl:

`> 3DVisualizer <other arguments> -sceneGraph Foo.wrl`

`> LidarViewer <other arguments> -sceneGraph Foo.wrl`

`> OtherVruiApp <other arguments> -vislet SceneGraphViewer Foo.wrl`

Vrui's scene graph is modeled after the VRML97 Internet standard. The main idea behind VRML is that scene graphs can be created using no tools other than a text editor; while possible, it is not necessary to use a 3D design application. Being an Internet standard (albeit an old and almost forgotten one), VRML is extensively documented:

- In hardcopy: The Annotated VRML 2.0 Reference Manual

Vrui's scene graph does not currently implement all features of the VRML97 standard, especially not its dynamic and behavioral components, and it contains several extensions to VRML97 that simplify including scientific data encountered in common geoscience problems. For example, standard VRML expects all 3D data in a Cartesian coordinate system. One of Vrui's extensions is a transformation node that converts several geodetic coordinate systems to Earth-centered Cartesian space, so that, for example, 3D positions compatible with Crusta or the Earthquake Viewer can be expressed in the VRML file as latitude/longitude/elevation.

List of Vrui's extensions to existing VRML97 nodes:

- New pointTransform field in Geometry nodes, linking to a transformation node that is applied to all 3D point coordinates
- New pointSize field in PointSet nodes
- New lineWidth field in IndexedLineSet nodes
- New colorMap, heightUrl, heightUrlFormat, removeInvalids, invalidHeight fields in ElevationGrid nodes

List of new node types:

- ColorMap: defines mappings from scalar values to RGB colors
- ReferenceEllipsoid: defines the reference ellipsoid (geoid) to use for geodetic transformation. Defaults to WGS84 ellipsoid in km if no fields are specified. Fields:
- radius: Radius of ellipsoid in meters (default: 6378137.0 for WGS84)
- flattening: Flattening factor (default: 1.0/298.257223563 for WGS84)
- scale: Scale factor from meters to desired display size (default: 0.001 to render in km)

- GeodeticToCartesianTransform: transforms its child nodes to a particular position on a reference ellipsoid. Resulting coordinate frame has its origin at the specified position in geodetic coordinates, the X axis pointing east, the Y axis pointing north, and the Z axis pointing up. Fields:
- referenceEllipsoid: Node defining the used reference ellipsoid (default: WGS84 ellipsoid)
- longitudeFirst: TRUE if geodetic field's X coordinate maps to longitude, FALSE if geodetic field's X coordinate maps to latitude (default: TRUE)
- degrees: TRUE if latitude/longitude are specified in degrees, FALSE if radians (default: FALSE)
- colatitude: TRUE if latitude coordinate is actually colatitude (default: FALSE)
- geodetic: Origin position for all child nodes in geodetic coordinates (default: 0.0 0.0 0.0)

- GeodeticToCartesianPointTransform: transforms 3D points used inside a Geometry node from geodetic to Cartesian space. Fields:
- referenceEllipsoid: Node defining the used reference ellipsoid (default: WGS84 ellipsoid)
- longitude: One of “X”, “Y”, or “Z” to pick which source point coordinate is longitude (default: “X”)
- latitude: One of “X”, “Y”, or “Z” to pick which source point coordinate is latitude (default: “Y”)
- elevation:One of “X”, “Y”, or “Z” to pick which source point coordinate is elevation (default: “Z”)
- degrees: TRUE if latitude/longitude are specified in degrees, FALSE if radians (default: FALSE)
- colatitude: TRUE if latitude coordinate is actually colatitude (default: FALSE)
- elevationScale: Scale factor for elevation values (default: 1.0)

- LabelSet: draws a set of text labels at specified 3D positions
- QuadSet: draws a set of four-sided polygons from a set of specified 3D positions
- ArcInfoExportFile: loads points, lines, and polygons from an ARC/INFO export file
- ESRIShapeFile: loads points, lines, and polygons from an ESRI shape file
- TSurfFile: loads triangles from a GoCAD TSurf file

keckcaves/adding_additional_3d_geometry_to_vrui_applications_using_scene_graphs.txt · Last modified: 2012/11/28 00:41 by okreylos