Does anyone know how ZBrush exports color in an STL file?
I can export a mesh as color STL and load it back into ZBrush. No problems. But when I sent the data to a 3D print foundry they said there is no color info. I wrote a program to read the STL data but got somewhat garbage data. Most of the triangles have the right color but many seem to have random colors. I used the description in Wikipedia about how color is stored in a binary STL file. I tried both variants but could not get smooth colors.
Any help is appreciated.
There are at least two variations on the binary STL format for adding colour information:
- The VisCAM and SolidView software packages use the two ‘attribute byte count’ bytes at the end of every triangle to store a 15 bit RGB colour: [LIST]
- bit 0 to 4 are the intensity level for blue (0 to 31)
- bits 5 to 9 are the intensity level for green (0 to 31)
- bits 10 to 14 are the intensity level for red (0 to 31) [LIST]
- bit 15 is 1 if the colour is valid
- bit 15 is 0 if the colour is not valid (as with normal STL files)
[/LIST]
[/LIST]
- The Materialise Magics software does things a little differently. It uses the 80 byte header at the top of the file to represent the overall colour of the entire part. If colour is used, then somewhere in the header should be the ASCII string “COLOR=” followed by four bytes representing red, green, blue and alpha channel (transparency) in the range 0–255. This is the colour of the entire object unless overridden at each facet. Magics also recognizes a material description; a more detailed surface characteristic. Just after “COLOR=RGBA” specification should be another ASCII string “,MATERIAL=” followed by three colours (3 × 4 bytes): first is a colour of diffuse reflection, second is a colour of specular highlight, and third is an ambient light. Material settings are preferred over colour. The per-facet colour is represented in the two ‘attribute byte count’ bytes as follows: [LIST]
- bit 0 to 4 are the intensity level for red (0 to 31)
- bits 5 to 9 are the intensity level for green (0 to 31)
- bits 10 to 14 are the intensity level for blue (0 to 31) [LIST]
- bit 15 is 0 if this facet has its own unique colour
- bit 15 is 1 if the per-object colour is to be used
[/LIST]
[/LIST]