This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
Mathematica Import/Export Format

OBJ (.obj)

Wavefront OBJ format.
3D geometry format.
Used for storage and exchange of 3D geometry definitions.
Native format of the Wavefront application.
Developed by Alias Wavefront.
ASCII format.
An OBJ file stores a single object.
  • Import["file.obj", elem] imports the specified element from an OBJ file.
  • Import["file.obj", {elem, suba, subb, ...}] imports a subelement.
  • Import["file.obj", {{elem1, elem2, ...}}] imports multiple elements.
  • The import format can be specified with Import["file", "OBJ"] or Import["file", {"OBJ", elem, ...}].
  • Export["file.obj", expr, elem] creates an OBJ file by treating expr as specifying element elem.
  • Export["file.obj", {expr1, expr2, ...}, {{elem1, elem2, ...}}] treats each expri as specifying the corresponding elemi.
  • Export["file.obj", expr, opt1->val1, ...] exports expr with the specified option elements taken to have the specified values.
  • Export["file.obj", {elem1->expr1, elem2->expr2, ...}, "Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
"Elements"list of elements and options available in this file
"Rules"full list of rules for each element and option
"Options"list of rules for options, properties, and settings
  • Data representation elements:
"Graphics3D"OBJ file represented as a Graphics3D object
"GraphicsComplex"GraphicsComplex object, representing the geometry stored in the file
"LineData"lines represented as lists of indices, referencing the vertices as given by the "VertexData" element
"LineObjects"list of Line primitives given in absolute coordinates
"PointData"point data in indexed form
"PointObjects"list of Point primitives given in absolute coordinates
"PolygonData"polygon data in indexed form
"PolygonObjects"list of Polygon primitives given in absolute coordinates
"VertexData"list of vertex coordinates
"VertexNormals"normal vectors corresponding to the vertices given by "VertexData"
  • Import and Export use the "Graphics3D" element by default for OBJ files.
  • The "VertexData" element corresponds to the first argument of GraphicsComplex.
BackgroundAutomaticwhat background color to use
ImageSizeAutomaticoverall size of the graphics to display
LightingAutomaticwhat simulated lighting to use in coloring 3D surfaces
  • All options of Graphics3D can be given when importing from OBJ.
  • Advanced options:
"InvertNormals"Falsewhether to invert the orientation of vertex normals
"VerticalAxis"{0,0,1}orientation to assume for the coordinate system used in the file
  • By default, Mathematica assumes that in the coordinate system used by the OBJ format the vertical axis corresponds to the third coordinate.
  • With the setting "VerticalAxis"->{0, 1, 0}, Mathematica will apply the transformation {x, y, z}->{x, -z, y} to all graphics coordinates when importing from OBJ, and the inverse transformation when exporting to OBJ.