Introduction: Create a 3D Printed 3D Fractal
Who doesn't love a good fractal image? Beautiful, ornate shapes expressed though a series of simple formulas. Recent advances in the Fractal Arts have surfaced a whole new breed of 3D fractal shapes - and they are fantastic! Check out this channel on Vimeo to see some of the possibilities: Mandelnauts.
I'd like to show you how you can bring some of these incredible shapes into the real world via 3D printing. We'll be using a 3D printing service like Shapeways or Ponoko - so all you'll need is a PC, some free software, a few hours to tinker, and a few bucks for the final 3D print. I suppose this is a little less physical than most Instructables, but these 3D printers are starting to blur the line between real and virtual.
There are 3 main steps to this process, and each involves a different piece of software. You won't need to master any of them, though. We'll just pop in to use the features we need, then pop out and onto the next step. If you're comfortable installing new software and you don't mind poking at a few mysterious menu items then you'll be fine.
Step 1: Gather Your (free) Tools
First, we need to load up our virtual assembly line with a few free tools.
We'll be using a program called Mandelbulb 3D to generate our shapes. Grab it. This is an app that allows you to explore the strange new world of 3D fractals. M3D is Windows only but it does work on Macs via Wine or CrossOver.
It's a complex, somewhat arcane program - but we'll be concentrating on just a few features. Be warned - if you have a weakness for eye candy or algorithmic art you can easily get lost in the Mandelverse for long stretches of time. ;)
From there we'll move onto an app called Fiji. Grab it. Fiji is cross-platform. I know very little about this one, except for the fact that it will gobble up the stack of images from M3D and spit out the resulting shape as an .OBJ mesh. Easy peasy.
The last stop on the line is Meshlab. Grab it. Meshlab is a powerful app that can perform all manner of topological wizardy. We'll use this to clean up the mesh and prepare it for 3D printing. Opensource and cross-platform.
I've collected these links and a few other resources into a Bitly bundle for easy access.
Get yourself setup with those three apps and let the tinkering commence!
Step 2: Intro to Mandelbulb 3D
First we'll need to find our shape. I say find rather than create because Mandelbulb 3D is more about tweaking and exploring than it is about creating a specific shape - especially when you're just getting your bearings.
Don't run away screaming when you see the riot of windows and buttons and sliders. :) I've prepared a set of parameters that we'll use to find a fun, unique shape - we can ignore most of that other craziness for now.
1)Download the preset parameter file. pollen1.m3i
2) Open up M3D and load in that file. Look for the Open tab at the top left of the main window. The rollover on the button will say Open M3I.
3)Click the colorful 3D Navi button in the upper left. This window is where we can tweak the shape.
4) Press the Parameter button to load our Parameters into this Navigator window.
5) Extend the Navigator palette by clicking the triangle in the lower right. This reveals the sliders that will let us easily change our shape.
Ok. Now we're set to explore a little and find a unique, printable shape.
If you want to know more about M3D, you can watch my series of tutorial videos that cover most of the basics.
Step 3: Find a Fractal Shape
At this point your screen should look something like the first image. With the Navigator window open and the initial preset shape visible and the palette extended to the right. This is a crowded window, but we are only after a few of the sliders.
Be careful with the buttons along the bottom of the Navigation window. These are an amazingly fun way to move the camera around and explore the shape. I hope you do play around with them after this tutorial - but the "Slice it Up' step won't work as easily if you move the camera.
1) Smack in the middle of the right side you'll see the first of 3 formulas that control this shape. This first one is labelled sphereIFS. You'll see its variables listed below, along with sliders.
2) Just to the left is a tiny selector for the formula. Click that up arrow twice, to go to formula three. It should be labelled genIFS. Feel free to tinker with any of the parameters, but this one will produce interesting results quickly.
3) There is a scroll bar hiding next those three sliders. Hover your mouse there, then slide down to the bottom of the list of genIFS variables. Look for the entries labelled Rotation X, Rotation Y, and Rotation Z.
4) Grab a hold of one, slide it a bit and watch the changes in the navigation window. New shapes!
5) Goof around with the sliders and get a feel for how the shapes changes. Flip between the three formulas if ya like. Keep in mind that the laws of physics will go into effect when you print this thing.
6) You'll also want to try and keep the shapes within the cameras view, a little bigger or smaller is ok. This will make the next step easier. If you really need to zoom in or out a little, you can zoom the camera with the mousewheel (or w and s keys).
7) It's very likely that you'll come across shapes that obscure the camera view, or shoot off into space, or disappear. Your best bet at first will be to change a slider slowly, then move to another and see how the changes interact. Remember that you can always push that Parameter button to reset everything.
8) When you've found a shape you like, press the View to Main button at the left. This sends your new shape back to the main rendering window.
9) Click back over to the main window. Press the Calculate 3D button. This will give you a more accurate view of your shape. If you want to make more changes, go back to the Navigator window to tinker, then use the View to Main button again.
Now we're ready to start the journey from virtual object to Real Life doodad. We'll continue using Mandelbulb 3D in the next step.
I've recorded a screencast demonstrating these (and other) steps.
Step 4: Slice It Up
We'll jump through the the first hoop with a feature called Voxel Stacks. We'll use this to slice our object into thin slices which will be represented by a series of black and white images. Then we'll use Fiji to assemble those into a proper 3D mesh object.
If we're lucky and our shape cooperates, then this step is a no-brainer.
1) Back in the main window of Mandelbulb 3D, press the Utilities tab, then the Voxelstack button.
2) Press the button labelled Import parameter from main. This copies our fractal shape from the main window to this Voxel export window. You won't see your entire object at this point, maybe just a scattering of cubes - or nothing.
This part of the process is less predictable than the others. This is one reason why I chose the starting parameters that we used. If your shape is approximately the same size as the intial preset, then we can simply enter some specific values here and we'll be ready to go.
3) Find the Overall Scale entry. Press that down arrow 9 times, or enter .42 into all 3 of the X,Y, and Z scale options. This changes the overall size of our object. You should see parts of your object come into view.
4) Find the Z offset entry and change that to 22.5. This moves our object closer to the 'camera'.
You should now be seeing a chunky, low rez version of your object. Think of that display area as a big cube full of smaller cubes. What we want is for the object to be floating in the middle of that (invisible) box. We'd also like it to fill-up most of that box.
5) Look for the Preview Max Size options. Choose 256. Click the Calculate Preview button. You should see the shape being drawn, back to front. These are lo-rez slices being drawn and stacked within the display box.
6) Watch the sslices as they're drawn. Your shape is probably generally spherical. As the slices are drawn you should see the visible portion of your object start small, then grow larger as it reaches the middle, then smaller again as it reaches the front. When it's drawn all 256 slices, you should see a ghostly version of your entire object.
This is a good place to make a decision as to whether this is a good candidate for 3D printing. You can see the innards of the object as it's drawn and can get a better picture in your head of it's true shape. Are all the parts connected? Will the thinnest sections support the shape? You'll also want to consider the limitations of your 3D printer.
7) If your object looks like it's cut off on the edges - maybe like a marshmallow stuffed in a glass box - then it's too big. Use the Overall Scale button to make your object smaller until it fits.
8) If your object is off-center and cut off on one side, use the X, Y, and/or Z offset settings to move it closer to the center. If you didn't move the camera in the 'Find a Fractal Shape' step, then you probably won't need to change these offsets.
Once your object looks centered and is scaled properly we are ready to export the stack of images. We'll need an empty folder to hold these pics along with a few other files that we'll be creating as we go.
9) Find the option labelled DE: and change it to 3. You can think of this as the the thickness of the walls of your object. If you have spindly bits or details that are too small to print, you can increase this value to 'inflate' your object. A lower DE value might work with a thicker, solid shape.
10)Set the Z Slices option to 800. This will create 800 images that are 800x800 pixels each. A good, medium rez scan. If your system is low on RAM you might try something around 500 slices. (You'll know if 800 is too much if you get an Out Of Memory Error when we use the Fiji app.)
11) Click the Output Folder button and choose an empty folder to store the images.
12) Click the Start rendering slices button. The image slices will begin rendering over in the main Mandelbulb 3D window.
Watching them as they draw will give you more info about the structure of your object. This can help you decide if the DE: setting from step 9 is giving you the results you want. It's ok if there are some blank, black frames at the beginning or end. There is a frame number count on the Voxelstack window that can help you judge the progess.
13) If you don't like what you see as the slices are rendering you can hit the Stop button in the main window, then go back to the Voxelstacks window to make changes. When all the slices are done rendering the Stop button will change back to say Calculate 3D, and there will be 800 shiny new pics in your save folder.
14) Done and done. You can save this shape for later. In the main window press the Save tab, then the Save Complete M3i button. Choose a filename and save your creation. You can use this later just as you used the first preset file.
I demonstrate a more general version of this process in this video tutorial:
Step 5: Happy Little Nerd Dance
Do a Happy little nerd dance to celebrate. You are officially a Mandelnaut! (^_^)
Take a break and stretch your legs. From here on out it's just clicking and watching progress bars. If you need inspiration for your dance:
Step 6: Stack the Slices
1) Load up Fiji
2) From the menu choose File -> Import -> Image Sequence
3) Choose the first image in the sequence that we rendered. Click Open.
4) Check the option labelled Use Virtual Stack. Click OK.
5) From the menu choose File -> Save As -> PGM. Best to just save it in the same folder as the image slices.
6) From the menu choose File -> Save As -> Wavefront .OBJ. Save that in the same folder.
7) Where it says Threshold - enter 0. (zero)
8)UNcheck Green and UNcheck Blue. Red should be the only one checked. Click OK.
9) Fiji will now start processing the images. You'll see a couple of progress bars fill and it will seem that it's finished. It might not actually be done yet! This was very confusing during testing. :) It can take several minutes for the full file to finish writing. Go get a cup of coffee or keep an eye on the file size - when it stops getting larger, Fiji is really done.
This process is also explained in this video starting at about the 11 minute mark.
Step 7: Clean Up Your Mesh
Here's another app with an overwhelming number of features. :) Our goal is to reduce the number of polygons that make up our mesh and to smooth out some of the jaggies caused by the slicing process. We also need to make sure the mesh is properly formatted and scaled for printing.
1) Load up Meshlab. From the menu choose File -> Import Mesh...
2) Open the .obj file that we created with Fiji. It might be a minute or two before the object is imported and displayed.
Right now our object is sort of inside-out. That's why it looks dark.
3) From the menu choose Filters -> Normal, Curvature and Orientation -> Invert Face Orientation. Click the Apply button then the Close button. Now your object should be visible.
A couple of quick cleaning steps....
4) From the menu choose Filters -> Cleaning and Repairing -> Merge Close Vertices. Leave the settings at defualt (1%) and hit Apply, then Close. This will combine any points on the model that are very close together.
5) From the menu choose Filters -> Remeshing, Simplification and Reconstruction -> Close Holes
6) Now a little bit of Voodoo to properly format the faces of the object. From the menu choose Filters -> Normals, Curvature and Orientation -> Re-Orient All faces Coherently . You probably won't see any visual change on this step.
7) This is quite possibly THE best menu option evar. (^_^) From the menu choose Filters -> Remeshing, Simplification and Reconstruction -> Quadric Edge Collapse Decimation !! This will let us reduce the number of polygons that make up our object. We'll shoot for about 99,000 faces, since this is the preferred number at Shapeways. They accept up to a million polys but it's probably best to keep things simple for now.
8) Where it says Target number of faces, put 99000
9) Check the boxes marked: Preserve Normal, Optimal Position, Planar Simplification, and Post-simplification. Uncheck the others.
10) Click Apply. Meshlab will analyze your mesh and re-build it using 99,000 polygons. You should see the number of faces listed at bottom of screen change when it is done.
11) Let's smooth the shape a bit. From the menu choose Filters -> Smoothing, Fairing, and Deformation -> HP Laplacian Smooth. Press Apply then Close. Lots of other smoothing options in that menu if you want to experiment.
Blessed Noodles - we're almost done!
12) From the menu choose Filters -> Cleaning and Repairing -> Remove faces from non Manifold edge..
Now we just need to scale our object so the printer knows how big it should be. Keep in mind that the bigger and more dense your object, the more it will cost. Check out these guidelines from Shapeways for more details. I'd recommend trying a small object at first, maybe 50mm on a side.
15) From the menu choose Fliters -> Normals, Curvature and Orientation -> Transform: Scale
16) There are two distinct steps we'll perform in this window. First we'll make sure that the object fits in a 1x1x1 unit box, then we'll scale it up to the size we want.
17) Check the box marked Scale to Unit bbox. Press Apply. .
18) Your object will most likely disappear. It's not gone, just hiding. Press CTRL-H to see it again.
19)UNcheck the Scale to Unit bbox. Make sure that Uniform Scaling is checked.
20) Where it says X Axis, enter 5. Click Apply. In the same X Axis box, enter 10. Click Apply. This will give us an object that is 50mm (about 2 inches) across. Two adjustments are necessary since the requester only takes values up to ten. Go a little larger if you are feeling brave and don't mind spending a little more on the print.
Feel free to think about this step in inches if that is easier for you to visualize. For a 2 inch wide model, enter 2 in the X Axis value in step 20. Make sure to remember what unit of scale you used in the step, so that you can include that info when uploading the file for printing.
21) Save it! From the menu choose File -> Export Mesh As
22) From the dropdown menu choose STL File Format and save your file. Might as well put it in with all those other files we've been creating.
23)Done. Time to head over to Shapewyas, Ponoko, or phone up your cool friend who has her own 3D printer.
These steps are demonstrated in this video, starting at about 19:20
Step 8: Upload for Printing
FInally ready to print. I've been using Shapeways for my experiments, but there are several other places that will happily print your object. As far as I know, these object files should be compatible with most 3D Printers. I'd love to hear from anyone who tries this with their own equipment!
1) Sign up for a Shapeways account. Their site is well presented and easy to use.
2) From their main menu is a Create option. Choose Upload.
3) Click to choose that .STL file we created in Meshlab.
4) Make sure you choose Millimeters as your unit size. Our object is scaled, but the unit is not saved as a part of the STL file format.
5) After you upload the .STL file you'll get a message that the file was received. Shapeways will analyze the mesh and make sure that it is suitable for printing.
5)Think happy thoughts and wait for the message that says your object is available.
6) If there is a problem it is most likely with the scale of the object or a glitch in the way the polygons are organized. Try rescaling your object by loading the mesh back into Meshlab and performing parts 12-22 of the previous step.
7) If it still doesn't work you can try the entire Meshlab process again, or try again from the beginning - maybe with a simpler shape.
8) If you've found something precious and just can't get it to work, let me know. I might be able to convince the shape to behave. :)
Step 9: Afterthoughts
I've ordered a print of a shape I made by following this tutorial. I'll post pictures here when that arrives. It's here. :)
The detail of theprint is spot-on with the model I sent, even though it is so small. It's fun to actually hold something that was previously just pixels and light. :) It's like I teleported it out of the screen. I can't wait to try a bigger, more complicated piece.
Please leave comments if you need clarification, or get stuck. This is my first Instructable, so let me know if I screwed somethin' up. I'm also entering this into the Make It Real contest here at Instructables. There should be a vote button around here somewhere. (^_^)