DOF file format (DOF1)

 

Home Have a look at the insides of the Racer file formats.


Organiser - free planning & organizing tools
Introduction

The DOF file format is used for storing 3D models. Racer v0.3 used DOF0, but has been superseded by DOF1 since 27-12-00 and really hasn't changed during the years. The format allows easy skipping of chunks that future/previous versions might not know about.

DOF's are stored in binary format and use Intel endianness (just about all processors in PC's these days use the same format). Largely inspired by the IFF format (but not completely taken over), the format contains 3 conceptual levels, all indicated by 4-character identifiers. Each chunk begins with a char[4] identifier followed by a 32-bit integer size that indicates the size (in bytes) of the chunk data that follows. No padding is used (this is different from the original IFF specifications). This allows readers to skip chunks they don't know anything about, just by skipping those bytes and trying to go on, hoping not too miss any important information.

DOF files store 3D data and basic material info. More detailed rendering information is stored in .shd (Racer shader) files. These should not be confused with GPU shaders; those can be referenced in the .shd files.

Level 1; objects

Level 2; object components

Level 3; object component attributes

These you will find inside the MAT0 and GOB1 chunks. Note that each chunk is directly followed by its length, to make sure future extensions can be easily put in and out. This is with the exception of the GEND and MEND chunks (those do not have a length added)!
First a description of MAT0:

Next, a description of a GOB1 (geometrical definition, or geob):

General notes about the file format:

Here's a hex dump of a small model; a rectangle generated originally from a SCGT shadow 'model':

  
  00000000: 44 4f 46 31 d1 01 00 00 4d 41 54 53 c1 00 00 00   DOF1....MATS....
  00000010: 01 00 00 00 4d 41 54 30 b5 00 00 00 4d 48 44 52   ....MAT0....MHDR
  00000020: 04 00 00 00 00 00 00 00 4d 43 4f 4c 44 00 00 00   ........MCOLD...
  00000030: cd cc 4c 3e cd cc 4c 3e cd cc 4c 3e cd cc 4c 3e   ..L>..L>..L>..L>
  00000040: 00 00 80 3f 00 00 80 3f 00 00 80 3f 00 00 80 3f   ...?...?...?...?
  00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3f   ...............?
  00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 3f   ...............?
  00000070: 00 00 00 00 4d 55 56 57 1c 00 00 00 00 00 00 00   ....MUVW........
  00000080: 00 00 00 00 00 00 80 3f 00 00 80 3f 00 00 00 00   .......?...?....
  00000090: 00 00 00 00 00 00 00 00 4d 54 52 41 08 00 00 00   ........MTRA....
  000000a0: 00 00 00 00 00 00 00 00 4d 54 45 58 11 00 00 00   ........MTEX....
  000000b0: 01 00 00 00 0b 00 56 45 43 53 48 41 44 2e 42 4d   ......VECSHAD.BM
  000000c0: 50 4d 53 55 42 04 00 00 00 00 00 00 00 4d 45 4e   PMSUB........MEN
  000000d0: 44 47 45 4f 42 fc 00 00 00 01 00 00 00 47 4f 42   DGEOB........GOB
  000000e0: 31 f4 00 00 00 47 48 44 52 0c 00 00 00 00 00 00   1....GHDR.......
  000000f0: 00 00 00 00 00 00 00 00 00 49 4e 44 49 10 00 00   .........INDI...
  00000100: 00 06 00 00 00 00 00 01 00 02 00 00 00 02 00 03   ................
  00000110: 00 56 45 52 54 34 00 00 00 04 00 00 00 cc cc c9   .VERT4..........
  00000120: c2 00 00 8c c1 33 b3 4d 43 99 99 c6 42 00 00 8c   .....3.MC...B... 
  00000130: c1 33 b3 4d 43 99 99 c6 42 00 00 8c c1 66 e6 38   .3.MC...B....f.8
  00000140: c3 cc cc c9 c2 00 00 8c c1 66 e6 38 c3 54 56 45   .........f.8.TVE
  00000150: 52 24 00 00 00 04 00 00 00 00 00 80 3f 00 00 80   R$..........?...
  00000160: bf 00 00 80 3f 00 00 00 00 00 00 00 00 00 00 00   ....?...........
  00000170: 00 00 00 00 00 00 00 80 bf 4e 4f 52 4d 34 00 00   .........NORM4..
  00000180: 00 04 00 00 00 00 00 00 00 00 00 80 3f 00 00 00   ............?...
  00000190: 00 00 00 00 00 00 00 80 3f 00 00 00 00 00 00 00   ........?.......
  000001a0: 00 00 00 80 3f 00 00 00 00 00 00 00 00 00 00 80   ....?...........
  000001b0: 3f 00 00 00 00 42 52 53 54 14 00 00 00 01 00 00   ?....BRST.......
  000001c0: 00 00 00 00 00 12 00 00 00 00 00 00 00 03 00 00   ................
  000001d0: 00 47 45 4e 44 45 44 4f 46                        .GENDEDOF

Organiser -planning, organiser and time billing software

(last updated July 3, 2009 )