Most 3D printers work by taking a 3D file (like an STL), and slicing it into a stack of 2D files. The 2D files are then printed one on top of the other to create the final 3D form. Here we'll start with a 2D animation and use the individual frames as slices to create a 3D object.
Our animation is going to be a simple particle simulation -- circles that move around and stick to each other. The 3D form will show the paths of these circles over time.
This idea came to me after reading Slaughterhouse 9 by Kurt Vonnegut. In the book there are alien creatures that experience time differently:
“Billy Pilgrim says that the Universe does not look like a lot of bright little dots to the creatures from Tralfamadore. The creatures can see where each star has been and where it is going, so that the heavens are filled with rarefied, luminous spaghetti."
So these aliens see all points of time in an instance--spherical stars are drawn out to tubes. We're going to replicate that as best as our tiny human brains can comprehend.
Step 1: Plan Out Your Printer Procedure.
I'm going to use Ember a desktop SLA printer. A typical workflow for Ember is: Create a 3D CAD model, export it as an STL, open up the STL in a slicing program (e.g. Autodesk Print Studio or Slic3r), and finally send a stack of black and white PNGs to the Ember printer.
Instead of starting with a 3D model. We'll jump to creating the stack of PNGs directly.
Note: Though I'm using an Ember printer, many of the principles in this Instructable are applicable to any other SLA or FDM type 3D printer.
Step 2: Use Processing to Generate an Animation
We'll use Processing to generate the animation that we'll print. Instead of writing a sketch from scratch we'll save time by modifying a pre-made example. Let's use the "Flocking" example from Chapter 6 of Daniel Shiffman's Nature of Code. This book is free and all the examples can be downloaded from this Github page.
This example shows a bunch of triangles called "Boids" that fly around the screen. We want to print a form that shows how these boids moving around over time. Now, to make this work for a 3D printed form we're going to have to make several modifications to this Processing sketch:
- Set the size to 1280 x 800. This is the native resolution of Ember's projector.
- Change the appearance of the sketch. When printing with an SLA printer like Ember each slice must be a black and white image. The white areas are printed and the black areas are left to be empty space. So change the background color to black and the boids to solid white. We'll also change the boids from triangles to circles just to make things a little simpler.
- We can modify the behavior of our boids (now represented by circles) by adjusting the cohesive, repulsive and alignment forces. These parameters are located in the Boid class.
- We need to add a line of code to export the frames in a format that our printer can read. Ember requires PNG files with the name "slice_1.png", "slice_2.png", and so on. So our code looks like: saveFrame("data/slice_"+counter +".png"); This line is at the end of the draw() function. Before it, a counter increments every frame.
There are a couple of other very important issues that must be considered for printing this animation....
Step 3: Eliminating the Need for Support Structures in the 3D Print
Since 3D printing is a layer by layer process, when a layer is printed it must be supported by the layer beneath it. A particle standing still or moving slowly it will form a straight or angled pillar -- this is great and will be no problem when printing. If the particle is moving too fast -- so fast it moves so far in a single frame that there is no overlap with the previous frame -- it won't be able to support itself. We'll prevent this from happening by lowering the max speed of a particle.
Another issue with our current sketch is the boundary conditions.Currently, when the particles leave the left side of the screen they wrap around to the right. That will be a big problem when we try to print them: When a particle wraps around it is suddenly in mid air and because it is unsupported it will fall down. Instead make simple boundary conditions (pictured) that reflect the particles back when the approach an edge. The ensures that a particle in a given layer will always be—at least partially—on top of the previous layer .
Step 4: Create and Send the Print File.
This step is fairly specific for Ember, but keep in mind this type of 3D print can be done on pretty much any kind of 3D printer.
An Ember print file is a compressed archive (either .zip or .tar.gz) that contains a text file called "printsettings" and a series of PNG's labeled "slice_1.png", "slice_2.png", etc. We've already created the PNGs in previous steps. The best way to create the Ember printer file is to use Print Studio provided via Spark: https://spark.autodesk.com/
Simply import any STL file -- it does not matter what -- and set the appropriate layer and resins settings. Then after you preview the slices, click "Export Printer File". Unzip this file, copy the printsettings file and paste it into the folder containing the PNG stack. Open this folder, select all of the files, then compress them. The "Archive.zip" file that is created is what you will send to Ember.
For a more detailed procedure check out this Instructable by Arian of the Ember team: https://www.instructables.com/id/Using-Processing-w...
Everything is ready to print and that's it!
Step 5: Use the T2Z Software to Create Animations and STL Files
While working on this project I found that other people have been working on something very similar! It's called the T2Z or "Freezing Time" project. Basically, they wrote processing code that allows you to interact with sliders to create geometric, looping animations. You can export the animation as a GIF or the individual frames as a folder of PNGs. It also exports STL files!
Here's a fantastic step-by-step guide to getting it work: http://htmlpreview.github.io/?https://github.com/e...
Some T2Z links:
Read about it: http://www.realtimerendering.com/blog/freezing-ti...
Download the Processing code: https://github.com/erich666/T2Z
Thanks for reading this Instructable! Please let me know if you have any questions or difficulties.