NOFF (.noff, .cnoff)
- Import and Export support ASCII and binary versions of the NOFF file format.
- The Wolfram Language reads and writes vertex colors or face colors.
- If both vertex and face colors are present in the file, Import returns the vertex color information.
Background & Context
-
- NOFF 3D geometry format.
- Used for storing and exchanging 3D models.
- NOFF is an acronym derived from Object File Format.
- Related to OFF and COFF.
- Occasionally called CNOFF if color information is present.
- ASCII or binary format.
- Represents a single 2D or 3D object.
- Stores a collection of planar polygons with possibly shared vertices and vertex normal data.
Import & Export
- Import["file.off"] imports a NOFF file as graphics.
- Export["file.off",expr] exports graphics to a binary NOFF file.
- For NOFF files representing a 3D object, Import["file.off"] returns an expression of the form Graphics3D[ GraphicsComplex[vertices,primitives,opts]].
- Planar objects are imported as Graphics[ GraphicsComplex[vertices,primitives,opts].
- Import["file.off",elem] imports the specified element from a NOFF file.
- Import["file.off",{elem,suba,subb,…}] imports a subelement.
- Import["file.off",{{elem1,elem2,…}}] imports multiple elements.
- The import format can be specified with Import["file","NOFF"] or Import["file",{"NOFF",elem,…}].
- Export["file.off",expr,elem] creates a binary NOFF file by treating expr as specifying element elem.
- Export["file.off",{expr1,expr2,…},{{elem1,elem2,…}}] treats each expri as specifying the corresponding elemi.
- Export["file.off",expr,opt1->val1,…] exports expr with the specified option elements taken to have the specified values.
- Export["file.off",{elem1->expr1,elem2->expr2,…},"Rules"] uses rules to specify the elements to be exported.
- See the following reference pages for full general information:
-
Import, Export import from or export to a file CloudImport, CloudExport import from or export to a cloud object ImportString, ExportString import from or export to a string ImportByteArray, ExportByteArray import from or export to a byte array
Import Elements
- General Import elements:
-
"Elements" list of elements and options available in this file "Summary" summary of the file "Rules" list of rules for all available elements - Data representation elements:
-
"Graphics" 2D NOFF file represented as a Graphics object "Graphics3D" 3D geometry represented as a Graphics3D object "GraphicsComplex" NOFF file as a GraphicsComplex object "PolygonColors" face color information, given as a list of color primitives associated with each polygon "PolygonData" the polygon elements in indexed form "PolygonObjects" list of Polygon primitives given in absolute coordinates "VertexColors" colors associated with each vertex, given as a list of color primitives "VertexData" list of vertex coordinates "VertexNormals" normal vectors corresponding to the vertices given by "VertexData" - Import and Export by default use the "Graphics3D" element to represent 3D geometries and the "Graphics" element for 2D objects.
- The "VertexData" element corresponds to the first argument of GraphicsComplex.
Options
- General Import options:
-
Background Automatic what background color to use ImageSize Automatic overall size of the graphics to display Lighting Automatic what simulated lighting to use in coloring 3D surfaces - All options of Graphics3D can be given when importing from NOFF.
- Detailed property:
-
"BinaryFormat" True whether the file is in ASCII or binary format - Binary NOFF files store information as "Integer32" and "Real32" data types, always using the setting "ByteOrdering"->1.
- Advanced options:
-
"InvertNormals" False whether to invert the orientation of vertex normals "VerticalAxis" {0,0,1} orientation to assume for the coordinate system used in the file - By default, the Wolfram Language assumes that in the coordinate system used by the NOFF format the vertical axis corresponds to the third coordinate.
- With the setting "VerticalAxis"->{0,1,0}, the Wolfram Language will apply the transformation {x,y,z}->{x,-z,y} to all graphics coordinates when importing from NOFF, and the inverse transformation when exporting to NOFF.
Examples
Basic Examples (3)
Import the "Stanford bunny" from a NOFF 3D model:
Import and count the polygons stored in this file:
Generate a 3D object using SphericalPlot3D and export it to NOFF:
An Export example using inline 3D graphics: