OBJ (.obj)

Background & Context

    • Wavefront OBJ format.
    • 3D geometry format.
    • Used for storage and exchange of 3D geometry definitions.
    • Native format of the Wavefront application.
    • Stores a geometry as a collection of line, point, and polygon primitives and their properties.
    • Can store face color information.
    • ASCII format.
    • Developed by Alias Wavefront.
    • Stores a single geometry.

Import & Export

  • Import["file.obj"] imports an OBJ file as a MeshRegion object representing the surface.
  • Import["file.obj",elem] imports the specified element from an OBJ file.
  • The import format can be specified with Import["file","OBJ"] or Import["file",{"OBJ",elem,}].
  • Export["file.obj",expr] exports a 3D mesh-based geometric region to a binary OBJ file. The expr can be any region that is ConstantRegionQ or a Graphics or Graphics3D object.
  • Export["file.obj",expr,{opt1->val1,}] exports expr with the specified options for the file format.
  • The export format can be specified with Export["file",expr,"OBJ"] or Export["file",expr,{"OBJ",opt1->val1,}].
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the OBJ format.

Import Elements

  • General Import elements:
  • "Elements"list of elements available in this file
    "Rules"list of rules for each element
    "Options"list of options and settings
    "Summary"summary of properties
    "CoordinateTransform"transformation function from OBJ format
  • Data format representation elements:
  • "VertexData"list of vertex coordinates
    "PolygonData"the polygon elements in indexed form
    "VertexNormals"normal vectors corresponding to the vertices
  • Geometry representation elements:
  • "BoundaryMeshRegion"boundary mesh representation of the solid
    "MeshRegion"mesh representation of the surface
  • Graphics representation elements:
  • "Graphics3D"OBJ file represented as a Graphics3D object
    "GraphicsComplex"OBJ file as a GraphicsComplex object
    "PolygonObjects"list of polygon primitives given in absolute coordinates
  • Import and Export use the "MeshRegion" element by default for OBJ files.

Examples

open allclose all

Basic Examples  (2)

Import a 3D model from OBJ as a MeshRegion object:

Summary properties of the model:

Export a 3D model with transparent faces:

Print the raw textual contents of the file:

Scope  (12)

Import  (6)

Import works on an ASCII OBJ file:

Any accessible URL:

Stream:

Import automatically detects OBJ files:

Import provides access to elements in the OBJ file:

Import works on large files:

Export  (6)

Export works on graphics:

Export works on 3D graphics:

Special regions:

Formula regions:

Mesh regions:

ASCII OBJ file:

Import Elements  (10)

"BoundaryMeshRegion"  (1)

Give a boundary mesh region:

"CoordinateTransform"  (1)

The coordinate system used by the OBJ format is identical to the Wolfram Language:

"Graphics3D"  (1)

Give the Graphics3D object:

"GraphicsComplex"  (1)

Give the GraphicsComplex object:

"MeshRegion"  (1)

Give a mesh region:

"PolygonData"  (1)

Give the polygon elements in indexed form:

"PolygonObjects"  (1)

Give the list of Polygon primitives given in absolute coordinates:

"Summary"  (1)

Give the summary of properties:

File size:

"VertexData"  (1)

Give the vertex coordinates:

"VertexNormals"  (1)

Give the vertex normals: