Skip to main content

Using OBJ for Scene Geometry

When we first started on the DIRSIG model in the late 1980s, 3D computer graphics was still in its infancy. At the time, standard file formats for 3D geometry were still being established. In addition, the DIRSIG model had the need for a specific set of per-facet attributes (material ID, thickness, override temperature, etc.) that are still somewhat unique in the 3D modeling community. As a result, the DIRSIG specific Geometric Database (GDB) format was created and is still used to this day.

In the mean time, a variety of 3D geometry file formats have become widely used. Although the GDB format serves our needs well, it requires the user to translate the 3D geometry assets from other formats in order to use them with DIRSIG. Lately we have been experimenting with using the Alias/Wavefront OBJ file format as a possible replacement for GDB.

The important features of the OBJ format are:
  • It is widely supported by 3D geometry authoring tools (Rhino, SketchUp, Blender, etc.).
  • It supports per-facet material attribution.
  • It supports a single level of facet grouping (comparable to the GDB "parts" concept).
  • It uses "shared vertex lists" which cut down on file size, memory usage, and precision issues that lead to gaps at vertexes and along edges.
  • It supports "texture vertexes" which is a texture coordinate system tied to the object coordinate system (rather than the global coordinate system) and allows for "wrapping" material, texture, etc. maps onto/around objects.
  • It supports "vertex normals" which allows an otherwise flat facet to appear to have curvature by spatially interpolating normals defined at the vertexes.
In DIRSIG-4.4.0 we improved the support for input geometry in the OBJ format. Many of the demos and new scenes under construction are using OBJ geometry as the primary object format. DIRSIG's support for OBJ includes the following:
  • Only "facet" constructs ("f" entries) are currently supported (not "points", "lines", "curves", etc.).
  • Facets are assumed to have either 3 or 4 sides/vertexes.
  • The material tag (the "usemtl" entries) is assumed to have a DIRSIG material ID associated with it.
  • Texture vertexes (the "vt" entries) are read and used with any mappings applied to the geometry.
  • Vertex normals (the "vn" entries) are read and automatically used to compute the normal across a facet.
  • The use of "groups" (the "g" entries) is allowed and even encouraged to help users organize the components of the geometry. However, internally DIRSIG doesn't leverage them in any way.
  • Shading groups (the "s" entries) are not relevant to DIRSIG since all modeling is controlled via material descriptions.
  • In general, any element that DIRSIG doesn't support is simply ignored, so you don't need to filter out unsupported features in the OBJ file.
In the coming months, we will attempt to document some more details about how we have been using OBJ files in our scene construction workflow. In the meantime, check out some of the demos that are already using OBJ files. These include:
  • Movement1
  • UvMapping1
  • VehicleGlint1
  • VertexNormals1
  • Water1
The "UvMapping1" demo employs two different objects described by OBJ files. The cube shaped object uses "texture vertexes" which is why the texture rotates with the titled cube on the right.

The "VertexNormals1" demo features a crude model of a monkey head. The version on the left is modeled with constant normals across each facet. The version on the right uses vertex normals which allows DIRSIG to interpolate the normal across each facet and create the illusion of curvature (note that the computed normal is used by all radiometric calculations).

When using OBJ instead of GDB you gain nearly seamless inter-operability with most CAD tools. In some cases those tools might preserve the material assignments, which means an OBJ can be moved back and forth without the need to re-attribute. Plus, you get support for numerous features (texture vertexes, vertex normals, smaller files, etc.) that the GDB format doesn't have. What you give up when using OBJ is the options for per-facet thickness and per-facet override temperatures. If you have not been using either of these features of the GDB format, then the OBJ format might be right for you.

Comments

Popular posts from this blog

LIDAR Point Cloud Visualization

A common question we get asked is how to visualize the point cloud data produced by either the Linear-mode or Geiger-mode LIDAR simulations. First, you should remember that the point cloud files produced by the "APD Processor" are simple ASCII/text files. Each line is the entry for a single return or "point" in the point cloud, including the point location and some attributes that vary depending on whether you modeled a Linear-mode or Geiger-mode system. For a Linear-mode system, a point cloud file will generally look like the example below: 12.7388 -45.3612 -0.0256 5.0290 0 0 0 0 12.8169 -45.3612 -0.0264 4.8362 0 1 0 0 12.8950 -45.3612 -0.0271 4.8362 0 2 0 0 ... 32.4008 -25.5446 10.5945 4.6783 0 65533 0 0 32.4781 -25.5446 10.5953 5.8959 0 65534 0 0 32.5360 -25.5640 12.5408 5.9185 0 65535 0 0 The first three columns are the X/Y/Z location of the point return. The 4th column is the intensity (in photons). Since Linear mode can support multiple returns per pulse, t

Viewing and Importing DIRSIG Output Images

We are often asked what programs can view DIRSIG's image outputs and how to import the raw DIRSIG image data files into other tools for further processing. For basic image viewing, DIRSIG-4.4.0 now includes a very simple viewing tool. Launch it from the main simulation editor window by selecting the "Start image viewer" option from the "Tools" menu. If you run your simulation from the GUI simulation editor, new image files are automatically added to the list in the image viewer as they are generated. If you want to manually add files to the list, simply select the "Open" item from the "File" menu or the toolbar. Here is a screenshot of the main image viewer window. The top part contains the list of currently opened files and the bands within those image files. To view a single band as a gray-scale image, choose "Single Band Display" from the combo box and then click on the image band that you want. Finally, click "Load Band

Using MODTRAN6 with DIRSIG

It has been a pretty exciting year for the team at Spectral Sciences, Inc.  with the release of MODTRAN6 . This latest version marks a major milestone in the continued development of one of the most popular and trusted codes for simulating radiative transfer in the atmosphere. In addition to important science related advancements, this latest code also includes significant improvements to the general usability of the software. This includes a new graphical user interface (GUI) and the introduction of a formal application programmer interface (API), which let's codes like DIRSIG interact with MODTRAN in a far more robust way than previous versions allowed. New MODTRAN, new interfaces The major development in the interface area is a shift from the old "tape5" style inputs to a new JSON (JavaScript Object Notation) style input. In addition to improving the general readability of the input, the JSON document format is much easier to read in, modify and write back out. The