3DS

Last modified by Farooq Sheikh on 2019/07/17 07:55

A file with 3DS extension represents 3D Sudio (DOS) mesh file format used by Autodesk 3D Studio. Autodesk 3D Studio has been in 3D file format market since 1990s and has now evolved to 3D Studio MAX for working with 3D modeling, animation and rendering. A 3DS file contains data for 3D representation of scenes and images and is one of the popular file formats for 3D data import and export. It considers information like camera locations, Mesh data, lighting information, viewport configurations, smoothing group data, bitmap references and attributes to create vertices and polygons for rendering a scene.

What is 3DS file?

At its base, 3DS is a binary file format and follows a predefined structure for storing and retrieving of data. The binary file format enables the 3DS file format faster smaller as compared to text-based file formats. Data inside a 3DS file is stored in the form of chunks.

Chunk

Each chunk in a 3DS file is a block of data that contains an ID, length of the block for location of next block and the data itself. The chunk ID lets 3DS file format readers to skip the blocks that they don't recognize. It also helps in extensibility of the format. Each chunk stores information related to shapes, lighting and viewing information that together render the scene. Chunks are arranged in a hierarchical structure in a 3DS file and resemble XML Document Object tree in representation. 

Chunk ID: The first two bytes of a chunk represent a chunk identifier that lets the file reader decide whether to consider it during reading or skip it.

Length of the chunk: The Chunk ID is followed by a 4-bytes integer (in little-endian) that stands for the length of the chunk. This length also includes the length of the data, the length of its sub-blocks and the 6-bytes header.

Payload: The length of chunk is followed by actual bytes of data for the chunk, followed by its sub-chunks in the same hierarchical structure that can be extended to several levels deep.

Structure

The hierarchical structure of a simple chunk is as shown below:

* A Chunk.

startendsizename
012Chunk ID
254Next Chunk

Chunks have a hierarchy imposed on them that is identified by its ID. A 3ds file has the Primary chunk ID 4D4Dh. This is always the first chunk of the file. With in the primary chunk are the main chunks.

* Main Chunks

idDescription
3D3DStart of object mesh data.
B000Start of keyframer data.

The Next Chunk pointer after the ID block points to the next Main chunk.
Directly after a Main chunk is another chunk. This could be any other type of chunk allowable within its main chunks scope.

For the Mesh description (3D3D) they could be any multiples of.

* Subchunks of 3D3D. - Mesh Block

idDescription
1100unknown
1200Background Colour.
1201unknown
1300unknown
1400unknown
1420unknown
1450unknown
1500unknown
2100Ambient Colour Block
2200fog?
2201fog?
2210fog?
2300unknown
3000unknown
4000Object Block
7001unknown
AFFFunknown

* Subchunks of 4000 - Object Description Block

- first item of Subchunk 4000 is an ASCIIZ string of the objects name.
Remember an object can be a mesh, a light or a camera.

idDescription
4010unknown
4012shadow?
4100Triangular Polygon Object
4600Light
4700Camera

References

Created by Farooq Sheikh on 2019/07/10 12:46