3D printing community Shapeways allows their members to upload 3D models, preview them on the website and have them 3D printed in a variety of materials. Until recently, the previews were rendered in OpenGL and were rather bland looking. I was involved in the implementation of Blender on their webservers, in order to generate better quality previews. Here’s a look behind the scenes of this project.
Before I begin: this was an awesome project. I had a chance to work together with some great Blender designers and developers. The Shapeways team loved the concept but wasn’t easy to satisfy – a great combination for arriving at a fantastic final product.
What did we want to achieve?
The original thumbnail previews were rather bland and suffered from OpenGL rendering artifacts. Check out the model below:
Most of all, we wanted to show what the design would actually look like when 3D printed. We picked one material (“White Strong and Flexible“) and set off to render this as photo-realistically as we could. This proved to be a challenge as White Strong and Flexible is, well, mostly pure white. Things weren’t made much easier when Product Manager Peter Paul Cornelissen gave us the briefing for the scene design: a white, reflecting background, slightly overexposed, with soft shadows below the object. White on white – oh yeah :)
Blender Designer Dolf Veenvliet (Macouno) set off to design the scene and material for us, and after a couple of iterations, working together for an afternoon at the Shapeways offices, and then some more changes, we arrived at our first version. After consulting with the Shapeways Community we learned that they didn’t like our automatic smoothing. If an object is meant to be angular, it should be rendered as such. Fair enough. Here’s how we render the models now:
Of course, we had to keep the render time of the scene acceptable as we could soon be rendering thousands of images each day. Seconds matter! The scene now renders in different layers and uses the node compositor to tie them all together. Not many command-line tools can do such tricks ;-)
Have another look at some images ‘before and after’:
Pretty sweet, right?
The ‘Blender Server’ is a combination of three components:
- A .blend file containing the scene, lighting and material. We’re still using good ol’ Blender 2.49 for this project as it’s stable and many of the features that we needed aren’t available in 2.50 yet.
- A Python script that loads STL or VRML files, and scales the model so it fits in the viewport. The Python script can switch between different scenes, can toggle between different materials or UV texture maps, and can re-orient the models if necessary.
- XJ3D to convert X3D files to VRML. Blender’s X3D importer isn’t good enough yet.
Each of these components are easy to maintain. Adding more scenes or materials is a definite possibility.
Power of Open Source
Could we have done this with another tool? I highly doubt it. Using an Open Source tool and having access to Blender developers helped us solve two issues:
- Even though Blender already runs on a large number of operating systems, we found that it didn’t work on the Shapeways webservers. Blender Developer Nathan Letwory (JesterKing) made a custom build for us.
- We also found that the VRML/X3D import filter that’s distributed along with Blender had some issues that made it hard to implement in our specific scenario. Fortunately it’s written in Python which made it easy to modify.
All in all: Open Source (and Blender ;-) FTW!
Try it out for yourself!
To test-drive the new renderer, check out the Shapeways introduction page for Blender users. Keep in mind that models need to be printable (that is: closed volumes, and not too thin/small) before they’re added to the gallery.
Asides from offering more materials and scenes to choose from, we have a few more tricks up our sleeve – more about that another time :) Of course, if you have an über-cool idea of what we can do with this, we’re all ears!
Do you need help with your project?
- Shapeways Gallery: recently added (note: we’re still re-rendering all the existing thumbnails and are about 30% done!)
- Shapeways Materials overview (with some cool video’s for some materials)
- A quick introduction to Shapeways for Blender users
Disclaimer: while I do work for Shapeways as a freelancer, I wasn’t paid to publish this article.