Autodesk never published the 3DS format openly. Everything here comes from the reverse-engineered descriptions written by programmers in the 1990s, chiefly 3dsinfo.txt (built on Christophe Chabanois’ earlier notes) and the 3ds.spec notes, and from the open source readers lib3ds and Assimp; lib3ds names every chunk. Where these sources disagree, the pages say so.
The chunk
A 3DS file is one chunk, which holds other chunks, which may hold others in turn. Every chunk has the same 6-byte header:
| Offset | Size | Type | Name | Description |
|---|---|---|---|---|
| 0 | 2 | word | ID | What the chunk is |
| 2 | 4 | dword | Length | Length of the whole chunk in bytes: the 6-byte header, the chunk’s own data and all its sub-chunks |
| 6 | n | bytes | Data | The chunk’s own fields, if it has any |
| 6 + n | m | chunks | Sub-chunks | Any sub-chunks, back to back, up to the end of the chunk |
The length lets a reader skip any chunk it does not know. To find where the sub-chunks start, a reader has to know the size of the chunk’s own data, which is why every chunk ID matters. A chunk with no data and no sub-chunks is a flag: its presence alone means “on”.
00000000 4D 4D 2D 01 00 00 02 00 0A 00 00 00 03 00 00 00 MM-.............
4D4D, 301 bytes long,
then its first sub-chunk, the version chunk 0002 (10 bytes), holding
version 3.Data types
All numbers are little-endian.
| Type | Size | Meaning |
|---|---|---|
| byte | 1 | Unsigned 8-bit integer |
| word | 2 | Unsigned 16-bit integer (some fields, such as a parent number of −1, are signed) |
| dword | 4 | Unsigned 32-bit integer |
| float | 4 | IEEE 754 single-precision number |
| strz | Varies | ASCII text ending with a zero byte |
| vector | 12 | Three floats: x, y, z |
| degree | 4 | A float angle from 0 to 360 |
| rad | 4 | A float angle from 0 to 2π |
Z is up in 3D Studio’s world. Some old notes say Y and Z must be swapped in the keyframer only; 3dsinfo.txt corrects this, and every vector in the file, in the editor and the keyframer alike, uses the same axes.
Colour and percentage chunks
These small chunks are used inside many others, wherever a colour or a percentage is needed.
| ID | Name in lib3ds | Data | Meaning |
|---|---|---|---|
0010 | COLOR_F | 3 floats | Red, green, blue, 0.0 to 1.0 |
0011 | COLOR_24 | 3 bytes | Red, green, blue, 0 to 255 |
0012 | LIN_COLOR_24 | 3 bytes | Red, green, blue, 0 to 255 |
0013 | LIN_COLOR_F | 3 floats | Red, green, blue, 0.0 to 1.0 |
0030 | INT_PERCENTAGE | word | A percentage, 0 to 100 |
0031 | FLOAT_PERCENTAGE | float | A percentage, 0 to 100 |
A colour is often written twice, once in each of two forms. The sources disagree
about which is which: lib3ds calls 0012 and 0013 the linear
colours and treats 0011 as gamma-corrected, preferring the linear one
when both are present, while 3dsinfo.txt calls 0012 and
0013 the gamma-corrected ones. Assimp reads all four as plain colours.
Main chunks and related files
The ID of the outermost chunk says what kind of file it is. 3D Studio used the same chunk system for several of its files.
| ID | Name in lib3ds | File |
|---|---|---|
4D4D | M3DMAGIC | A 3DS scene (.3ds), holding 0002, 3D3D and B000 |
3DAA | MLIBMAGIC | A material library (.mli), holding material chunks |
C23D | CMAGIC | A project file (.prj) |
2D2D | SMAGIC | Probably a 2D Shaper file; not described by any source |
2D3D | LMAGIC | Probably a 3D Lofter file; not described by any source |
3DFF | MATMAGIC | A material file; not described by any source |
The 3DS version chunk 0002 (M3D_VERSION, a dword) gives the
release of 3D Studio that wrote the file, and 0005
(M3D_KFVERSION) a keyframer version. The editor chunk holds its own mesh
version, 3D3E.
The chunk tree
4D4D Main chunk
├─ 0002 3DS version
├─ 3D3D 3D editor
│ ├─ 3D3E Mesh version
│ ├─ 0100 Master scale
│ ├─ 1100…2303 Background, shadows, ambient light, fog, distance cue
│ ├─ 3000 / 7001 Default view and viewport layout
│ ├─ AFFF Material
│ │ ├─ A000 Name
│ │ ├─ A010…A08E Colours, percentages, flags
│ │ ├─ A100 Shading
│ │ └─ A200…A34C Texture maps and masks
│ │ └─ A300…A368 Map file name and parameters
│ └─ 4000 Named object
│ ├─ 4010…4017 Object flags
│ ├─ 4100 Triangle mesh
│ │ ├─ 4110 Vertices
│ │ ├─ 4111 Vertex flags
│ │ ├─ 4120 Faces
│ │ │ ├─ 4130 Material groups
│ │ │ ├─ 4150 Smoothing groups
│ │ │ └─ 4190 Box map
│ │ ├─ 4140 Texture coordinates
│ │ ├─ 4160 Local coordinate system
│ │ ├─ 4165 Colour in the editor
│ │ └─ 4170 Mapping information
│ ├─ 4600 Light
│ │ └─ 4610 Spotlight, and the light settings 4620…465B
│ └─ 4700 Camera
└─ B000 Keyframer
├─ B00A Header
├─ B008 Segment (start and end frame)
├─ B009 Current frame
└─ B001…B007 Node tags
├─ B030 Node ID
├─ B010 Node header
├─ B011, B013, B014, B015 Instance name, pivot, bounding box, morph smoothing
└─ B020…B029 Tracks
Index of chunk IDs
Every chunk ID that lib3ds names, with the page that describes it. Names are lib3ds’s,
without its CHK_ prefix.
| ID | Name | Described in |
|---|---|---|
0000 | NULL_CHUNK | Not a real chunk |
0002 | M3D_VERSION | Main chunks |
0005 | M3D_KFVERSION | Main chunks |
0010–0013 | COLOR_F, COLOR_24, LIN_COLOR_24, LIN_COLOR_F | Colour chunks |
0030, 0031 | INT_PERCENTAGE, FLOAT_PERCENTAGE | Percentage chunks |
0100 | MASTER_SCALE | Scene settings |
1100, 1101 | BIT_MAP, USE_BIT_MAP | Scene settings |
1200, 1201 | SOLID_BGND, USE_SOLID_BGND | Scene settings |
1300, 1301 | V_GRADIENT, USE_V_GRADIENT | Scene settings |
1400–1470 | LO_SHADOW_BIAS, HI_SHADOW_BIAS, SHADOW_MAP_SIZE, SHADOW_SAMPLES, SHADOW_RANGE, SHADOW_FILTER, RAY_BIAS, and 1470 “use raytrace” | Scene settings |
1500 | O_CONSTS | Scene settings |
2100 | AMBIENT_LIGHT | Scene settings |
2200–2310 | FOG, USE_FOG, FOG_BGND, DISTANCE_CUE, USE_DISTANCE_CUE, LAYER_FOG, USE_LAYER_FOG, DCUE_BGND | Scene settings |
3000–3090 | DEFAULT_VIEW, VIEW_TOP … VIEW_CAMERA, VIEW_WINDOW | Scene settings |
3D3D | MDATA | Scene settings |
3D3E | MESH_VERSION | Scene settings |
4000 | NAMED_OBJECT | Objects and meshes |
4010–4017 | OBJ_HIDDEN, OBJ_VIS_LOFTER, OBJ_DOESNT_CAST, OBJ_MATTE, OBJ_FAST, OBJ_PROCEDURAL, OBJ_FROZEN, OBJ_DONT_RCVSHADOW | Objects and meshes |
4100–4190 | N_TRI_OBJECT, POINT_ARRAY, POINT_FLAG_ARRAY, FACE_ARRAY, MSH_MAT_GROUP, TEX_VERTS, SMOOTH_GROUP, MESH_MATRIX, MESH_COLOR, MESH_TEXTURE_INFO, MSH_BOXMAP | Objects and meshes |
4181, 4182 | Not named in lib3ds; external process name and parameters in 3dsinfo.txt | Objects and meshes |
4600–465B | N_DIRECT_LIGHT and the DL_ chunks | Lights and cameras |
4700–4720 | N_CAMERA, CAM_SEE_CONE, CAM_RANGES | Lights and cameras |
5000–5020 | POLY_2D, SHAPE_OK, SHAPE_NOT_OK, SHAPE_HOOK | 2D shaper and lofter |
6000–6160 | PATH_3D, PATH_MATRIX, SHAPE_2D, M_SCALE, M_TWIST, M_TEETER, M_FIT, M_BEVEL, XZ_CURVE, YZ_CURVE, INTERPCT, DEFORM_LIMIT, USE_CONTOUR, USE_TWEEN, USE_SCALE, USE_TWIST, USE_TEETER, USE_FIT, USE_BEVEL | 2D shaper and lofter |
7000–7030 | VIEWPORT_LAYOUT_OLD, VIEWPORT_LAYOUT, VIEWPORT_DATA_OLD, VIEWPORT_DATA, VIEWPORT_DATA_3, VIEWPORT_SIZE, NETWORK_VIEW | Scene settings |
A000–A368 | MAT_ chunks | Materials and maps |
AFFF | MAT_ENTRY | Materials and maps |
B000–B030 | KFDATA and the keyframer chunks | Keyframer |
2D shaper and lofter chunks
The 5000 and 6000 ranges, by their names, belong to 3D
Studio’s 2D Shaper and 3D Lofter rather than to a .3ds scene. lib3ds names them but
does not read them, and no public source describes their data, so their layout is
unknown.