We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › how to export 3d color models for printing
Page Index Toggle Pages: 1
how to export 3d color models for printing? (Read 1259 times)
how to export 3d color models for printing?
Mar 12th, 2010, 6:56am

i'm trying to find a way to export 3d color files out of Processing so that i can send them to  a z-corp 3d printer.

Has anyone done this successfully?

eventually I need to make VRML files to send colour information to the printer, but any format that i can export to 3dsMax would be okay because I can convert it from here.

Does anyone know of a library that writes color .obj files? I've tried a few different libraries for this,  but only seem to get geometry.

I've also tried using toxiclibs to write color .stls,  but none of of the stl viewers i used (meshlab, minimagics) could see any colour, so I'm not sure if its working.  But anyway I can't a way of converting color stl to vrml yet.

Has anyone any experience of writing vrml files directly out of processing?  At the moment i'm trying to learn how to write it, but its a bit daunting!

many thanks!
Re: how to export 3d color models for printing?
Reply #1 - Mar 12th, 2010, 7:08am
as far as i know its not possible yet. although i read toxi writing something about it lately.
Would be great if somebody could figute that out i also have some models that uses colors that i would love to print.

Re: how to export 3d color models for printing?
Reply #2 - Mar 14th, 2010, 3:11pm
The colouring of 3D models in most of the standard file formats is usually achieved via texturing or setting a base color/material properties for the entire (sub)mesh. On the other hand, the direct coloring of individual vertices or faces without textures is not that commonly supported. (Binary) STL supports the individual coloring of faces, however there're 2 major variations/formats of how this is done and they're not compatible with each other. For toxiclibs I've implemented both of these color models, since I didn't know which software was used by the 3D print studio I was working with back then.

Even though these color models are supported, they're not used by default when exporting a TriangleMesh instance. The main reason for this is the current lack of color/texture support by the mesh class itself, but you could trivially create your own version of saveAsSTL() and do something like:

/* a custom mesh STL exporter */
import toxi.geom.*;
import toxi.geom.util.*;

// assume this has been populated somehow...
TriangleMesh mesh;

// create stl color model with mesh base color
// the true flag means facets can have their own RGB value
MaterialiseSTLColorModel colModel=new MaterialiseSTLColorModel(0x112233,true);
// create STLWriter instance
STLWriter stl = new STLWriter(colModel);
// write the file header
stl.beginSave(sketchPath("color.stl"), mesh.getNumFaces());
int k=0;
// iterate over all mesh faces
for (Iterator i=mesh.faces.iterator(); i.hasNext();) {
 TriangleMesh.Face f=(TriangleMesh.Face)i.next();
 // tint every 2nd face in alternating colors
 // btw. a RGB value of -1 will disable the face color
 // and revert to the default mesh color
 stl.face(f.b, f.a, f.c, f.normal, 0==k%2 ? 0xff00ff : 0xffff00);

Using the Materialise color model will only be successfully picked up by their Magics software (incl. MiniMagics, the only version I've ever tested with). As far as I know, MeshLab and a lot of the other STL viewers don't even check color info for STL files...

If you want to use this with Shapeways, then you're correct that you will need VRML or X3D files for this eventually. However, other 3D print studios might not be that limited, especially if they're using the Materialise tool chain (as a lot of them seem to do)... shop around!
Page Index Toggle Pages: 1