UPDATE

I'm clashing with the color scheme to let you know, I have moved to 3DESPRIT.COM !

Saturday, August 23, 2014

Full Color 3D Print Models with VRML using Blender for Shapeways

So not very long ago, I presented my first full-color model to Shapeways. Unfortunately, the process wasn't as painless as I hoped. To keep anyone else from having to deal with such an ordeal, I'm creating a simple tutorial on how to assemble your model for Shapeways submission.




Before Starting...

I won't go into the details of making your mesh ready for Shapeways, as that's a whole other video to come. If you need to know the guidelines for creating models for Shapeways, read their article Things To Keep In Mind.

UPDATE: You can also check out David Ward's tutorial for creating 3D Models for Shapeways, using the X3D extension.

Setting Up The Model

Creating a full-color model using Blender is easier than many would expect. Reading through the Shapeways support, Blender users have it easier than Maya and ZBrush users. Starting out, you want to make sure that your model has a UV Map, and a Diffuse Map to work with it. When unwrapping your model, make sure you don't have any overlapping faces, where colors will be different. When creating something with minor detail, you don't need to worry too much about detail, as much as you do have to worry about consistent color. Regardless, unwrap your model, create a new image in the UV Editor, color as you please, and save your diffuse map for the upload.

To save time, I have a few tricks I use to speed up the time of coloring. I use seams around borders where colors are going to change, and use the most common color as the color of my Diffuse Map. After the UV and basic Diffuse Map are created, I use Blender's Texture Paint to get the initial color laid out on the model. I don't worry about edges, just color so I can see on the layout what needs to be what (for sloppy unwraps, or maps with lots of islands). Once I have each color placed haphazardly on the Diffuse Map, I save the image, and do the rest of the color in Photoshop.

Exporting The Model To VRML2

Now for the part that would probably make many people rip their hair out, the export. Before I mention much more, go into Blender's User Preferences, Addons, Import-Export category, and enable VRML2 (Virtual Reality Modeling Language). VMRL2 is one of the file type that Shapeways uses with their ZPrinters for full-color prints. Save your user settings, make sure your model is selected, and now choose to export your model to VRML2. Now go to the export settings at the bottom-left of the screen, and choose Selection Only, Apply Modifiers, Texture/UVs, and deselect Color (You don't need it). You also want to make sure forward is at Z Forward, and up is Y Up (Shapeways uses Y Up).

Model Scaling

Before exporting, you also need to figure out the scale for the model. This can be determined with a trial-and-error method, since you can continue to upload models until you are happy with the most recent one. Blender's BU (Blender Unit) scale coverts to millimeters at a 1:1 ratio. So each BU is 1mm. If your model is 1BU wide, and want it to be 7 centimeters wide, you would set the scale to 70 for the export. Once you upload the model, you will be given dimensions to check your scale, so don't worry too much about it.

Adding The Color

Now that the model file is ready, we now need to make the diffuse map work with the VRML file (yes, it's not automatic). Before I start, I want to mention, I'm not sure how anyone is suppose to figure this out. I figured this out by looking at tutorials for other modeling software, and a bit of trial and error. So, let's now open the WRL file that was exported, with a text editor, like WordPad, ViM, Pico, and Notepad++ (I wouldn't try Textedit, as it usually adds extra syntax to files, but has been tested). Once you have the file open, look for the following lines:

texture ImageTexture {
url [ "." "." "." ]
}
Now, change the url line to the file name of the Diffuse Map. Make sure that it matches the file name exactly, as some systems are case-sensitive, and we want to test it before the upload. Also, make sure the Diffuse Map is in the same directory as the model file. Here is an example of the change:

url [ "diffuse_map.png" ]

NOTE: I did end up with one export where it had all three portions of the URL filled out, but had to remove all but one for Shapeways to take it without an error. 

Testing the Model In Blender

Now that the file has been set to point to the Diffuse Map, save it, and go back to Blender. We now want to test the export, which luckily we can do in Blender (Unlike other modeling software). Make sure that you still have your original model open, with the diffuse map. Choose to Import an VRML .wrl file, and choose your newly altered .wrl file. Next, switch to Blender Render, then go to the Shading Properties (N Key), turn off "Textured Solid", and set Shading to "GLSL". If the color is working, you'll see your model, in its full-color glory. If the map isn't matching the UV Map, that's perfectly fine, we are more worried about the map being referenced.

If you still don't see color, make sure your original model is still showing color, with the same diffuse map, saved as the name you put in the WRL file. Also, double check that both files are in the same folder, and that the diffuse map is the same name in Blender. Of course, make sure you are in Material Mode in Blender, and the Blender Render Shading settings are set as mentioned above.

Uploading To Shapeways and Testing More

Now it's time to get ready to test the model on Shapeways. Make sure to add both the WRL file and your Diffuse Map file (PNG/JPG), into a ZIP file. Once you have archived both files into a single ZIP file, upload it to Shapeways, and wait for it to process. You might as well grab a cup of coffee at this point, as it may take a little while before all of the settings are shown. Once the model is ready, you can check to see if the dimensions are correct, and most importantly, that you don't have "Thin Wall" issues. If you get the "Thin Walls" error from a majority of the materials, you may want to alter your original model again to fix these issues.

Fixing Thin Walls with Blender

Luckily fixing the "thin wall" issue is pretty easy. You can have Shapeways do it, but I have yet to find a time that I was happy with the results from their repair tool. Instead, click on the Thin Wall error link, and a window will pop up with a render of your mesh, and problem areas. Make a mental note of what areas are too thin, and then decide how you want to remedy the conflict. There are a number of ways to deal with the issue, so you can pick the best for each area.

1. Make the print larger in scale. The issue Shapeways has is when a wall is less than 3mm in size. The first option is to increase the size of your model, thus increasing the size of the walls.

2. As another option, you can of course go into Blender, and scale whatever part of the mess. This is great for low-poly portions of the mesh, and making sure you don't lose a certain shape.

3. If you are working with high-poly meshes, it may be a bit more problematic to scale portions of your model, especially if your modifiers have been applied. Since the detail is already there, simply open the model in Sculpt Mode, press I, and inflate the portions of the model to a size that will alleviate the thin wall issue.

After making any of the above changes to your model, export it again, edit the file again, and upload it to test again. If you get the thin wall error again, continue to look at the render results on the Shapeways page, and see what areas are still giving you issues. Eventually, they will all be fixed. It's also important to mention, that you need to let the Shapeways page fully load, or you may end up looking at old thin wall results, where the new ones have not been generated yet.


In Conclusion... 

I really hope that this has helped you publish your full-color models to Shapeways, as well as understand the process just a little bit more. Never underestimate Blender, and from what I read from other documentation, it seems to be the easiest, and only one other that can actually test the export. I promise after this first time, the next time will be so much faster.

No comments: