How to 3D Print in Full Color (Part 2): Repairing and Checking VRMLs
This is the second in a series of tutorials to help printer operators who are NOT graphic artists get the absolute most out of their multi-color, multi-material 3D printers, like the Stratasys J750.
We will cover how to look deeper inside our VRML files to predict if they will import correctly and how to choose the resolution of VRML files from Rhino and other artistic CAD programs to make sure they are capturing the information you want.
Step 1: Why Do We Need VRMLs?
Last time, we discussed how most engineering CAD programs (like SOLIDWORKS, Creo, Inventor and CATIA) don't retain texture information when you send files in native, STL, or even VRML format:
To overcome this, we talked about a workflow where you exported STLs from your CAD package, then re-applied the texture inside Photoshop, finally exporting a VRML to GrabCAD Print for printing:
But that's not the entire landscape.
Besides engineering CAD, there are also many flavors of 'artistic' CAD that graphic designers and animators use, and if you choose the right settings, some of those programs can export VRMLs with full-color textures still attached:
But in either case, the end result to carry your geometry + texture information into your print preparation tool will be a VRML file. (Currently GrabCAD Print does not import textures for .OBJ or .FBX formats. If that changes, we will update this paragraph here.)
(Edit 5/2/18: We've heard reports that Maya 2016 can no longer export VRMLs. So if applying textures in Maya 2016+, you will probably have to export an .OBJ or .FBX, then convert to VRML in some other software like Photoshop or Magics.)
So if we're going to be leaning heavily on VRML formats for carrying texture information to our 3D printers, we should learn how to look inside them.
Step 2: Reading a VRML in a Text Editor
To understand why some VRMLs work with 3D printing and some don't, we have to learn how to examine the raw data inside.
You can open any VRML using any text editing program (Notepad, Wordpad, Microsoft Word), and get a look at the data inside, even if it is a little hard to read:
Most of the text data won't be meaningful to humans, but there are a few key things you should look for (colors added by me):
First I check that the VRML is version 2 (red), the more recent version and the only one which GrabCAD Print can read.
Secondly, large transforms that wildly deform or scale the triangle data (blue) sometimes cause problems during tray layout and texturing, and this section is usually at the top, so I check for that too.
The base material appearance (green) sets the default look of the material. Sometimes there is an image path there ("brick texture.png", etc.) that is important to note.
And finally, then there will be thousands, possibly millions, of XYZ coordinate points (purple) that are the actual location of each vertex making up our triangular mesh. You can totally skip past those.
Below the triplets (I replaced a thousand lines with "...") might be information on how EACH vertex is colored ("colorPerVertex" in red):
VRMLs that are formatted by Color Per Vertex will be much larger than normal, since all the RGB values for every vertex must be separately listed out in the VRML (above, in brighter red) instead of being stored in an external JPEG or PNG.
Checking for "ColorPerVertex" is usually a good step if you suspect your VRML is too large and causing performance issues.
Finally, the last thing I search for in problem VRMLs is a CTRL+F for the word "texture", to see if there are any external texture files the VRML needs to reference during open:
In well-formatted VRMLs the indentation level will guide you to where the data belongs, and there will be a closed bracket for every open one, etc, helping you know when a section ends.
(Edit 7/13/18: If you REALLY want to get deeper into reading VRMLs as text, we just learned about this software called "VrmlPad". It's essentially a notepad editor for VRMLs with the color coding and section breaks already built in. I don't know if it's worth the 150 Euros it costs for the full version, but you can learn about and download an evaluation version here, and check out my screenshot below, on the left-hand side I've got a feature tree which breaks my VRML up into sections and lets me find my textures very easily (red arrow):
Step 3: So How Do We Actually Use this Knowledge?
That was a lot to take in. Is any of that actually usable in real life? Well, let's say you were doing a test to see if textures applied in Rhino correctly export for printing as VRMLs.
First, you'd apply a full body material texture in Rhino:
And if you then save a VRML from Rhino and try to open it in GrabCAD Print:
You might now conclude that Rhino is "Broken." That it can't correctly export material textures as VRMLs to show up for printing!
But then you might remember that you can open VRMLs in text editors to search for external texture paths:
And if you find that Brick.PNG file deep inside your Rhino install directory, copy it to the same folder as your VRML, then file opens (and should print) in GrabCAD Print correctly:
I haven't done this test for every single CAD package out there, but maybe people who read this tutorial can let us know in the comments how Maya, 3DsMax, Zbrush, Blender, CREO, Inventor, CATIA and even the different years of SOLIDWORKS do exporting textures in VRMLs for printing? (Make sure to look inside the VRML text for the right path before saying 'It doesn't work!')
Maybe the list of CAD systems that can correctly export textured VRMLs is bigger than we thought?
Now that we have the tools needed to tell if our textures are importing correctly through VRMLs, let's move on to one more controversial aspect of "artistic CAD"-to-print export: resolution of the file.
Step 4: Choosing the Resolution of Your Export
Let's say you've got this fun Earthworm Jim type character in Rhino that you want to 3D print:
(And thanks to GrabCAD user Syaqil Ng for uploading this awesome model for everyone to use- check out Syaqil's work here.)
If you go to "File...Save As' and choose 'VRML', you get a few options:
From the previous steps in this tutorial you know you should choose "Version 2.0," and that if you choose "Vertex Colors," your file will be much larger than in not.
(In fact, I tried all three of those options and you have to uncheck ALL THREE for the file size to drop by half, not just the "Vertex Colors" checkbox. Science!)
104 Mb is a large single file, but not above the limit of what my computer can do. And when you open both files side by side in GrabCAD Print, you don't really notice a difference between them:
(Notice that there are no gradients or blends in the color files above. The reason Jim is still in full color, even on the non-ColorByVertex file, is that the VRML has many different bodies in it, like his blue glove for example, which each contain their overall body color info (all of glove = blue). If we wanted to apply gradients or image textures, we might export an STL and use Photoshop to save out a VRML, as done in Part 1 of this series).
To give you a sense of scale, here is how those files look on the full J750 tray (with a 6-inch orange ruler for comparison):
Do each of those tiny files really need to be 104 MB or 54 MB, containing 28,000 triangles? If we wanted to print a hundred of those toys to fill up the tray, file size might start becoming an issue.
So how can we choose what resolution to export files from, in artistic CAD programs that generate VERY dense meshes of triangles?
It starts by knowing the fundamental resolution of your printer.
Interestingly enough, for a J750 polyjet printer, the fundamental resolution is different in the X and Y directions, with the printer putting down 600 DPI x 300 DPI respectively. So if you had a 1-inch square you wanted to print, you could fill it with 600 colored dots in one way and 300 in the other:
Since you're not only printing in one direction and your part could be rotated to fit better on the tray during final layout, let's go with 300 DPI as our base.
Now looking at the original Earthman Jim in Rhino in Wireframe mode shows that the curves aren't anywhere near 300 DPI:
HOWEVER, if we look at the preview when Rhino is creating our VRML, we can see certain high-change areas like the fingers or eyeballs probably have many more triangles than needed:
And while we have a Planck length of 300 DPI as an absolute lower boundary of what the printer can do, there's a lot of triangles we can remove from that thumb and still have it look like a thumb after printing.
Below are examples at three different settings of that slider in Rhino, and the effect they have on the model size:
Now, that 3 Mb file looks bad, but keep in mind Jim's head is less than a third of a centimeter across. Printed out at normal size, you really may not see the difference. If you scale the model 10x or 100x on the tray, you might.
I hate to be wishy-washy, but it really does depend on what you're printing. However, we now know two tools in Rhino that greatly affect our VRML size. The first is "Color By Vertex" which tends to double the size:
(You also now know how to open a VRML in text and SEE if that color by vertex data is there, giving an RGB color for every triangle.)
And finally, when choosing your resolution for your VRML, make sure to do a few test prints and always:
Step 5: Summary
While reading VRML files as text and changing the resolution on simply-colored files (not textured) may SEEM like it has nothing to do with printing textured files, the steps learned in this tutorial help troubleshoot SO MANY issues we see with full color printing. (And that we will run into in part 3!) Learn more about how the Stratasys J750 and the their new vivid color pallet can help yo achieve even better color 3D printing results with this helpful guide.
In the next part of this tutorial series, we're actually going to get into UV mapping (I ran out of space this time), and tackle the HARDEST thing you can do in color printing: transparent shapes with semi-transparent textures wrapped around them:
Step 6: Thumbnail Step
This image is just here because the tutorial chooses the last image as the thumbnail for the whole thing: