CMSI 698 SS:NVE Summer I 2004 - SMDv1

The Simple Model Data format is designed to be an easy to parse basic model format. The data is a series of stanzas, each of which begins with a color and a polygon count, followed by the vertexes in a triangle strip.

Polygons are stored as a series of vertexes encoded with signed 16 bit values. There are always polygon count + 2 vertexes in each stanza. The vertexes compose a Triangle Strip, with a count of 1 simply being a single polygon. Easy!

A simple SMDA to SMD converter can be downloaded here.

SMDv1 Format

An SMD file begins with an SMD header and then contains one or more stanzas until the end of file is reached.

Of course, all multi-byte values are in network byte order (big endian).

SMD Header

The header contains just enough to ensure that the reader has an unambiguous SMD file.

bytesfield
1Magic 0 = 's'
1Magic 1 = 'm'
1Magic 2 = 'd'
1version = 0x01
22+1+ stanzas go here

SMD Stanza

The stanzas are very simple in format. They have three color bytes followed by a polygon count (max 127) specifying how large the triangle strip in the stanza is. The negative and zero values of the polygon count are reserved for future use in later versions of SMD.

In the degenerate form, an SMDv1 file contains a series of 22 byte fields with a single colored polygon in each one. Inefficient, but some (crappy) models may not be representable any other way.

bytesfield
1Red (0-255)
1Green (0-255)
1Blue (0-255)
1Triangle Count (1-127) Signed! (-128-0 reserved)
2x1
2y1
2z1
2x2
2y2
2z2
Repeated count times
2xn
2yn
2zn

SMD URLs

When given a URL to an SMD format file, you can treat that as a URI and assume that the model at that location never changes.

That is to say, if you have a cached copy of the model at http://www.technocage.com/~caskey/ferrari.smd, and you find some entity specifying that same URL as its model, regardless of the version information between the two entities (the one you have it cached from and the one in question), you can consider the cached copy with the same URL as being the current model at that URL and skip the re-download step.

It is the hope that SMD versions of models would only be used as temporary placeholders while more sophisticated models are downloaded from their own sources.

Version: 1.2

Valid XHTML 1.0!