AMF is defined by ISO/ASTM 52915 (first published by ASTM as F2915 in May 2011; current edition 52915:2016, format version 1.2). The standard is sold rather than published freely, so this page is built from public descriptions of it and from the readers in open source software: Assimp’s AMF importer, whose comments quote the standard’s element descriptions, PrusaSlicer’s reader (up to version 2.9) and an independent JavaScript parser. Where a detail could not be confirmed from those, the page says so.
The file
- UTF-8 XML, starting with the XML declaration and enclosed in one
<amf>element. There is no namespace. - The file may instead be a ZIP archive holding the XML. Both forms keep the
extension
.amf, and readers tell them apart by content: a ZIP starts withPK(50 4B 03 04), the XML with<?xml. A minimal reader must decompress the file and import at least the geometry, ignoring curvature. - Elements carry their values as child elements and text, not attributes: a
vertex is
<coordinates><x>…</x>…. - Numbers use a full stop as decimal separator.
Element tree
amf unit, version
├── metadata type
├── object id
│ ├── metadata
│ ├── color
│ └── mesh
│ ├── vertices
│ │ └── vertex
│ │ ├── coordinates → x, y, z
│ │ ├── normal → nx, ny, nz
│ │ ├── color
│ │ └── metadata
│ ├── edge → v1, v2, dx1 … dz2 (placement unconfirmed)
│ └── volume materialid, type
│ ├── metadata
│ ├── color
│ └── triangle → v1, v2, v3
│ ├── color
│ └── texmap rtexid, gtexid, btexid, atexid
├── material id
│ ├── metadata
│ ├── color
│ └── composite
├── texture id, width, height, depth, type, tiled
└── constellation id
└── instance objectid → deltax, deltay, deltaz, rx, ry, rz
amf
| Attribute | Meaning |
|---|---|
unit | millimeter (the default), inch, feet, meter or micron |
version | Version of the format, such as 1.1 |
Children: at least one object; optional material,
texture, constellation and metadata
elements. Without any material, one default material is assumed.
object, mesh, vertices and vertex
| Element | Attribute or children | Meaning |
|---|---|---|
object | id | Unique object ID, used by constellations |
mesh | one vertices, then one or more volume | The whole geometry of the object |
vertices | vertex elements | Every vertex of the object, numbered from 0 in order; volumes of the same object may share them |
vertex | coordinates (required), normal, color, metadata | One point |
coordinates | x, y, z | Position, in the file’s units |
normal | nx, ny, nz | Optional surface normal for curvature: unit length, pointing outwards |
volume and triangle
| Element | Attribute or children | Meaning |
|---|---|---|
volume | materialid | Material of this volume |
type | object (assumed when absent), region or support; a support volume need not meet the geometric requirements of a closed solid | |
metadata, color, triangle | A closed volume, tessellated by its triangles | |
triangle | v1, v2, v3 | Vertex indices, anticlockwise seen from outside (right-hand rule); triangles are numbered from 0 |
color, texmap | Optional colour or texture mapping for this triangle |
Volumes of one object may touch and share vertices but must not overlap.
Curved triangles
Triangles are flat unless curvature is given. A normal on a vertex
bends every edge meeting there so that the edge is perpendicular to the normal and
stays in the plane of the normal and the straight edge. Where the surface has no
single normal (a corner, cusp or crease), an edge element gives the
tangent directions at the two ends of one edge, and it overrides the normals. The
standard requires a curved triangle to be split recursively into four, five levels
deep, giving 1024 flat triangles generated while slicing; curvature should not move
the surface more than 50% of the triangle’s largest dimension from its plane.
| edge child | Meaning |
|---|---|
v1, v2 | Indices of the edge’s two vertices |
dx1, dy1, dz1 | Tangent direction at v1 |
dx2, dy2, dz2 | Tangent direction at v2 |
The exact interpolation formulas for curved edges and the subdivision are given in
the standard and could not be confirmed from a public source; which element holds
the edge elements (the mesh or its vertex list) could not be confirmed
either.
color
| Attribute or child | Meaning |
|---|---|
profile | Colour space of r, g and b: sRGB (the default), AdobeRGB, Wide-Gamut-RGB, CIERGB, CIELAB or CIEXYZ |
r, g, b | Red, green, blue, 0 to 1; a constant or a formula of x, y and z |
a | Alpha, 0 to 1: how much of the colour from the level below shows through (optional) |
A colour may sit on a material, object, volume, vertex or triangle. The lowest level wins: triangle over vertex over volume over object over material.
texture and texmap
| Element | Attribute or children | Meaning |
|---|---|---|
texture | id | Unique texture ID |
width, height, depth | Size in pixels along x, y and z; a depth greater than 1 makes a 3D (volume) texture | |
type | grayscale, the only value: one byte per pixel, 0 to 255, read as 0 to 1 | |
tiled | If true, the texture repeats beyond coordinates of 1 | |
| text | Base64 bytes, pixels left to right, then top to bottom, then layer by layer | |
texmap | rtexid, gtexid, btexid | Textures giving red, green and blue (one greyscale texture per channel) |
atexid | Texture giving alpha (optional) | |
utex1–utex3, vtex1–vtex3 | Texture coordinates at the triangle’s three vertices |
Early files use map with children u1–u3
and v1–v3; readers accept both. Textures can also be
sampled from formulas with tex(textureid, x, y, z).
material and composite
| Element | Attribute or children | Meaning |
|---|---|---|
material | id | Unique material ID; 0 is reserved for no material (void), for porous structures |
metadata, color | Name and display colour | |
composite | One per constituent: another material’s share, as a constant or a formula of x, y and z |
Constant shares make a uniform mixture; formulas make graded materials, lattices
and random structures. rand(x, y, z) returns a number from 0 to 1 that
stays the same for the same point, and tex() reads a texture. The full
list of operators and functions allowed in formulas is in an annex of the standard
and is not reproduced in any public source checked.
constellation and instance
| Element | Attribute or children | Meaning |
|---|---|---|
constellation | id | ID of the constellation, in the same ID space as objects |
instance | objectid | The object or constellation placed |
deltax, deltay, deltaz | Translation from the object’s original position | |
rx, ry, rz | Rotation in degrees about x, then y, then z |
Constellations may contain other constellations, without cycles. If a file has several top-level constellations, or several objects outside any constellation, the reader may place them as it likes.
PrusaSlicer adds its own children to instance (scale,
scalex–scalez, mirrorx–mirrorz,
printable) and to object and amf
(layer_config_ranges, custom_code_per_height) with
slic3r. metadata types. These are not part of the standard.
metadata
Allowed in amf, object, volume,
material and vertex. The type attribute
names the item and the text is the value. Reserved types:
| Type | Meaning |
|---|---|
Name | Label to show the user |
Description | Description of the entity |
URL | Link to a related resource |
Author | Author or authors |
Company | Company that made it |
CAD | Originating CAD program and version |
Revision | Revision of the entity |
Tolerance | Desired manufacturing tolerance, in the file’s units |
Volume | Total volume, for checking (objects and volumes only) |
Files in the wild also write these names in lower case (name,
author).
Worked example
<?xml version="1.0" encoding="utf-8"?>
<amf unit="inch" version="1.1">
<metadata type="name">Split Pyramid</metadata>
<object id="1">
<mesh>
<vertices>
<vertex><coordinates><x>0</x><y>0</y><z>0</z></coordinates></vertex>
<vertex><coordinates><x>1</x><y>0</y><z>0</z></coordinates></vertex>
<vertex><coordinates><x>0</x><y>1</y><z>0</z></coordinates></vertex>
<vertex><coordinates><x>1</x><y>1</y><z>0</z></coordinates></vertex>
<vertex><coordinates><x>0.5</x><y>0.5</y><z>1</z></coordinates></vertex>
</vertices>
<volume materialid="2">
<triangle><v1>2</v1><v2>1</v2><v3>0</v3></triangle>
<triangle><v1>0</v1><v2>1</v2><v3>4</v3></triangle>
<triangle><v1>4</v1><v2>1</v2><v3>2</v3></triangle>
<triangle><v1>0</v1><v2>4</v2><v3>2</v3></triangle>
</volume>
<volume materialid="3">
<triangle><v1>2</v1><v2>3</v2><v3>1</v3></triangle>
<triangle><v1>1</v1><v2>3</v2><v3>4</v3></triangle>
<triangle><v1>4</v1><v2>3</v2><v3>2</v3></triangle>
<triangle><v1>4</v1><v2>2</v2><v3>1</v3></triangle>
</volume>
</mesh>
</object>
<material id="2">
<metadata type="name">Hard material</metadata>
<color><r>0.1</r><g>0.1</g><b>0.1</b></color>
</material>
<material id="3">
<metadata type="name">Soft material</metadata>
<color><r>0</r><g>0.9</g><b>0.9</b><a>0.5</a></color>
</material>
</amf>