X3D (.x3d)

Background & Context

    • MIME type: model/x3d+xml
    • Web3D geometry format.
    • Commonly used for distributing 3D models on the web and in media applications.
    • XML format.
    • Can store multiple geometries.
    • Introduced in 2003, maintained by the Web3D Consortium.
    • Successor of the VRML format.

Import & Export

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Rules"list of rules for all available elements
    "Summary"summary of the file
  • Data format representation elements:
  • "LineData"lines represented as lists of indices, referencing the vertices as given by the "VertexData" element
    "PointData"point data in indexed form
    "PolygonData"list of polygon elements in indexed form
    "VertexData"list of vertex coordinates
    "VertexNormals"normal vectors corresponding to the vertices given by "VertexData"
  • Geometry representation elements:
  • "BoundaryMeshRegion"boundary mesh representation of a solid
    "MeshRegion"mesh representation of a surface
    "Region"region representation of a surface
  • Graphics representation elements:
  • "Graphics3D"X3D file represented as a Graphics3D object
    "GraphicsComplex"X3D file as a GraphicsComplex object
    "LineObjects"list of Line primitives given in absolute coordinates
    "PointObjects"list of Point primitives given in absolute coordinates
    "PolygonObjects"list of polygon primitives in absolute coordinates
  • Import and Export use the "MeshRegion" element by default for X3D files.

Options

  • 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, the Wolfram Language assumes that in the coordinate system used by the X3D 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 exporting to X3D.

Examples

open allclose all

Basic Examples  (3)

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

"Summary" properties of the solid model:

Export a 3D model to an ASCII X3D file:

Print the raw textual contents of the file:

Export a 3D model:

Scope  (8)

Import  (4)

Import works on X3D file:

Any accessible URL:

Stream:

Import provides access to elements in the X3D file:

Export  (4)

Export works on 3D graphics:

Special regions:

Formula regions:

Mesh regions:

Import Elements  (13)

"BoundaryMeshRegion"  (1)

"Graphics3D"  (1)

Give the Graphics3D object:

"GraphicsComplex"  (1)

Give the GraphicsComplex object:

"MeshRegion"  (1)

Give a MeshRegion:

"LineData"  (1)

Give the "LineData" object:

"LineObjects"  (1)

Give the "LineObjects" object:

"PointData"  (1)

Give the "PointData" object:

"PointObjects"  (1)

Give the "PointObjects" object:

"PolygonData"  (1)

Give the polygon elements in indexed form:

"PolygonObjects"  (1)

Give the list of Polygon primitives given in absolute coordinates:

"Region"  (1)

Give a Region:

"Summary"  (1)

Give the "Summary" of properties:

File size:

"VertexData"  (1)

Give the vertex coordinates:

Export Options  (2)

"InvertNormals"  (1)

Invert normals:

"VerticalAxis"  (1)

Set vertical axis: