MDL file format specification


The MDL format is a simple scene description format for 3D scenes containing colored triangular patched that emit colored light. MDL files are ASCII text files containing coordinates and color values. A symbolic representation of the file format follows:

num_patches


v1x v1y v1z
v2x v2y v2z
v3x v3y v3z

cr cg cb
er eg eb


v1x v1y v1z
v2x v2y v2z
v3x v3y v3z

cr cg cb
er eg eb


....


v1x v1y v1z
v2x v2y v2z
v3x v3y v3z

cr cg cb
er eg eb


num_patchesan integer describing the number of patches in the file
vnx, vny, vnz, n in {1,2,3}floating point values representing the x, y, and z coordinates of the nth vertex of a patch
cr cg cbfloating point values representing red, green, and blue color components for the reflectivity of the patch
er eg ebfloating point values representing red, green, and blue color components for the light being emitted from the patch


The patch normal (direction perpendicular to the front side of the patch) is computed from the order of v1, v2, and v3. If these vertices are drawn on a piece of paper in clockwise order, the normal will point out of the paper. You should arrange patches in a scene so that patch normals point out of the object you are building with the patches (back sides of patches are ignored when propagating light around the scene).

Spacing and blank lines are not important, though at least one blank space should separate each value in the file. Actual contents of an MDL file follows:

3


-10 0 10
0 20 0
10 0 10

1 1 1
0 0 0


-10 0 10
0 0 -10
0 20 0

1 1 1
0 0 0


10 0 10
0 20 0
0 0 -10

1 1 1
0 0 0