One extension for the STL format to use colour information has already been published to the rp-ml from Aad van der Geest some time ago. This extension is used by TNO and VISICAM RP. Materialise - another RP software house, is using a similar extension with a different bit order within their Magics RP software (msb PBBBBBGGGGGRRRRR lsb). Therefore, coloured STL files are not always comparable to each other. Following is the extension of the STL format used from TNO and VISICAM:
| # of bytes | description | |
|---|---|---|
| 80 | Any text such as the creator's name
(For Materialise colour STL file: COLOR= is placed in an arbitrary location followed by a 4-bytes integer, representing the part colour in a RGBA-format. The least significant byte of this integer represents the R-value, followed by the G-byte and B-byte, ending with the most significant byte that represents the A-value) |
|
| 4 | int equal to the number of facets in file | |
| facet 1 | ||
| 4 4 4 4 4 4 4 4 4 4 4 4 |
float normal x float normal y float normal z float vertex1 x float vertex1 y float vertex1 z float vertex2 x float vertex2 y float vertex2 z float vertex3 x float vertex3 y float vertex3 z |
|
|
2
(previously unused) |
bit 15 | always 1 to distinguish
from normal STL files
(For Materialise: 1 The part colour will be applied for this triangle 0 The part colour is not used, the triangle colour is described in the following 15 bits.) |
| bit 10-14 | red intensity (0-31) | |
| bit 5-9 | green intensity (0-31) | |
| bit 0-4 | blue intensity (0-31) | |
| facet 2 | ||
| 4 4 4 4 4 4 4 ... |
float normal x float normal y float normal z float vertex1 x float vertex1 y float vertex1 z float vertex2 x ... |
|
In this way there are 32768 possible colours.
Cross reference: