3D Studio File Format (3ds).

Autodesk Ltd.

Document Revision 0.91 - June 1996


   Rewritten by Martin van Velsen (email: [email protected] )
   and Robin Fercoq ( 3ds-bin + mli )(email: [email protected])
   Based on Original document by Jim Pitts ( email: jp5.ukc.ac.uk )

   A lot of the chunks are still undocumented if you know what they do
   please email me Martin van Velsen,Robin Feroq or Jimm Pitts. 
   As I get more information of the file format,I will document it for 
   everyone to see. I will post this regurlarly to alt.3d and alt.3d-studio 
   and I can be contacted there if my email does not work.

   Disclaimer.
   This document describes the file format of the 3ds files generated by
   3d-studio by Autodesk. By using the information contained within you agree
   not to hold me Jim Pitts or Robin Feroq liable if, from its use, 
   you f^Hmuck something up. OK?


   A warning beforehand. This docs describes the format of 3ds files produced
   by version 3.0 and higher of 3d-studio. You can find this information at
   byte 29 in the binary file.

   This document can be found on the regular newsgroups:
   alt.3d and alt.3d-studio
   It can also be found at:
      "http://www.ptf.hro.nl/odi/free-d/docs/io/3ds/3ds_bin.doc"
   Or 
      "http://www.mediatel.lu"

   The 3ds file format is made up of chunks. They describe what information
   is to follow and what it is made up of, it's ID and the location of the
   next block. IF you don't understand a chunk you can quite simply skip it.
   The next chunk pointer is relative to the start of the current chunk and
   in bytes. The binary information in the 3ds file is written in a special
   kind of way. Namely the lest significant byte comes first in an int.
   For example: 4A 5C  (2 bytes in hex) would be 5C high byte and 4A low byte. In a long it
   is: 4A 5C 3B 8F where 5C4A is the low word and 8F 3B is the high word.
   And now for the chunks. A chunk is defined as:

   start end size name
   0     1   2    Chunk ID
   2     5   4    Pointer to next chunk relative to the place where
                  Chunk ID is, in other words the length of the chunk

   Chunks have a hierarchy imposed on them that is identified byt it's ID.
   A 3ds file has the Primary chunk ID 4D4Dh. This is always the first
   chunk of the file. Within the primary chunk are the main chunks.

   to give you a preview and a reference to the hierarchy of chunks, below is
   a diagram to show the diffrent chunk ID's and their place in the file.
   The chunks are given a name because below the diagram is a list which
   defines the names to the actual chunk id's. This makes it easier to
   put it in some source code ( how convenient that some sample code is
   included )

                  MAIN3DS  (0x4D4D)
                  |
                  +--EDIT3DS  (0x3D3D)
                  |  |
                  |  +--EDIT_MATERIAL (0xAFFF)
                  |  |  |
                  |  |  +--MAT_NAME01 (0xA000) (See mli Doc) 
                  |  |
                  |  +--EDIT_CONFIG1  (0x0100)
                  |  +--EDIT_CONFIG2  (0x3E3D) 
                  |  +--EDIT_VIEW_P1  (0x7012)
                  |  |  |
                  |  |  +--TOP            (0x0001)
                  |  |  +--BOTTOM         (0x0002)
                  |  |  +--LEFT           (0x0003)
                  |  |  +--RIGHT          (0x0004)
                  |  |  +--FRONT          (0x0005) 
                  |  |  +--BACK           (0x0006)
                  |  |  +--USER           (0x0007)
                  |  |  +--CAMERA         (0xFFFF)
                  |  |  +--LIGHT          (0x0009)
                  |  |  +--DISABLED       (0x0010)  
                  |  |  +--BOGUS          (0x0011)
                  |  |
                  |  +--EDIT_VIEW_P2  (0x7011)
                  |  |  |
                  |  |  +--TOP            (0x0001)
                  |  |  +--BOTTOM         (0x0002)
                  |  |  +--LEFT           (0x0003)
                  |  |  +--RIGHT          (0x0004)
                  |  |  +--FRONT          (0x0005) 
                  |  |  +--BACK           (0x0006)
                  |  |  +--USER           (0x0007)