Introduction: 3D Printed Reaction Diffusion Patterns
I'm inspired by the visual and sculptural works of:
- Nervous System: http://n-e-r-v-o-u-s.com/
- Karsten Schmidt: http://postspectacular.com/
- Jonathan McCabe: https://www.flickr.com/photos/jonathanmccabe/sets/
- Peter Jellitsch: http://www.peterjellitsch.com
- Daniel Widrig: http://www.danielwidrig.com/
- Michael Hansmeyer: http://www.michael-hansmeyer.com/
The patterns in their work are out of this world and perplexing! These patterns look very novel and simultaneously feel so familiar. I believe a lot of these artists are inspired by natural pattern formation and generative/biological systems. Recently, I spent some time researching an interesting model for pattern formation: reaction-diffusion systems. Here is an interesting use of reaction diffusion by Karsten Schmidt: https://www.flickr.com/photos/toxi/sets/72157604724789091/ & http://www.printmag.com/article/building_august2008_cover/.
Recently, I've been playing around with Gray Scott's model of reaction diffusion (RD). It's been a ton of fun exploring the different types of patterns that emerge from changing the parameters of a RD system. I wrote an application that simulates and visualizes a RD system in real-time. The application also exports geometry, thus what's seen on screen can be 3D printed and/or used in other applications for product design, scientific research, rendering, etc.
I'd like to share the application with you and the steps involved in using the app to export 3D geometry so RD patterns can be easily 3D printed on a makerbot replicator 2 (however you could use any 3D printer in theory).
Things You'll Need:
- Apple Computer (OSX 10.9)
- 3D Printer
- The Great Scott!?! App (https://dl.dropboxusercontent.com/u/46826568/apps/GreatScottApp.zip)
Step 1: What Is Reaction Diffusion?
Reaction diffusion system are widely studied and researched because their are argued to be linked to the chemical / biological processes that are responsible for pattern formation in nature (zebra stripes, leopard spots, etc). In addition, reaction diffusion systems exhibit beautiful motion when simulated and visualized. The gifs above showcase different growth patterns and oscillations in RD systems. To see more gifs, go here: http://www.syedrezaali.com/blog/?p=3262
In simple terms, reaction diffusion systems model how one or more substances (i.e. gases or liquids) change and/or combine when mixed in a container. The reaction part of the model describes what happens chemically when the substances combine together (i.e. maybe an entirely different substance is created and introduced into the mix). The diffusion part of the model defines how the substances propagate (i.e. diffuse) in the container (2D or 3D space they are mixed in).
For more technical information about reaction diffusion, specifically Gray Scott's model of reaction diffusion, check out this blog post: http://www.syedrezaali.com/blog/?p=3262 (It's a work in progress, in the post I'll be breaking down the model (mathematically) and describing how to simulate and visualize the model on the GPU using C++, Openframeworks, and GLSL Shaders).
Step 2: Generating Patterns & Exporting Geometry
This is where things start to get interesting! We are going to be generating patterns using the Great Scott!?! App. Download it from here: https://dl.dropboxusercontent.com/u/46826568/apps/GreatScottApp.zip
Here is a quick break down of the Great Scott!?! App (shown in the second and third photos). The app has a couple UI panels:
The "GREATSCOTT" panel allows you to save and load presets. The "UPDATE" and "RENDER" toggles control whether the app is updating and rendering the RD simulation.
The "SYSTEM" panel contains various controls that affect the output geometry, RD system, and form parameters.
The "EXPORT MESH + MEL" button is used to export the current state of the simulation as a closed surface mesh with non-zero volume. The exported mesh can be 3D printed without any additional clean up or post processing! In addition to the generated mesh, a MEL Script is created. This MEL Script generates curves in Maya, which then can be used to create geometry and/or other crazy awesome things.
The "BASE HEIGHT" slider is used to control the thickness of the base of the exported geometry. The larger the base height value, the thicker the exported geometry will be.
The "MODEL PARAMS" section of the "SYSTEM" panel contains controls that manipulate the simulation.
The "SELECT IMAGE" button is used to select the simulation's source input image. Different images will produce different visual results, so be sure to play with various types of images. I've included a couple images above and within the assets folder in the data folder: data/Layers/GreatScottLayer/Assets.
The "RESET" button is used to reset the simulation and zero out the values. I would recommend resetting and randomizing after having selected a new source image.
The "RANDOMIZE" button is used to randomize the values in the simulation. I equate pressing this button to shaking a container containing two liquids of different polarities and seeing them react to each other and then separate or dance with each other until the reaction has reached an equilibrium or a pseudo-balanced cyclic chaotic state.
The "ITERATIONS" number dialer controls how many simulation cycles are performed per frame. If your simulation is not fast enough and you want to see what the pattern would look like if time was sped up, increase this number. However, keep in mind that this will drastically affect the app's real-time performance. So you can always crank up this number in the beginning and when you've found system params that produce interesting results you can always lower this number back to 1.
The "DT" number dialer controls the simulation's time step. Lower time step values will yield better (more accurate) simulation results. I generally keep this number below 0.5.
The "DU", "DV", "DF", "DK" number dialers control model parameters of the RD system. To learn more about what these values mean and how they affect the system, check out: http://mrob.com/pub/comp/xmorphia/
The "SRC PWR" number dialer controls the influence of the input source image. This value controls the in influx of one of the substances in the chemical reaction. Try out positive and negative values to see how they affect the simulation!
The "EXTRUDE" slider controls the height displacement multiplier of the point grid. Each grid point represents a virtual sensor in space that measures the concentration of one of the substances in the RD system (in this case U). The higher the concentration of U at a certain point, the more offset (vertically) the grid point will be in space. Thus, the "EXTRUDE" slider scales the vertical offset of the grid points.
The "RENDER" panel contains various visualization controls. The "FS" toggle to the right of the "RENDER" label allows the app to become fullscreen.
The "DRAW OUTPUT MESH" toggle allows the user to view the mesh that will be generated and exported. I would recommend using this only when your ready to generate some output, otherwise keep it off while using the app.
The "DRAW POINTS" toggle toggles between rendering points and a surface. I like the aesthetic of the points and find it better for seeing the displacement of the mesh.
The other sliders ("POINT SIZE", "COLOR PALETTE", and "COLOR OFFSET") can be used to change the aesthetic of the visualization. Sometimes you can get a better sense of depth and structure by switching up the colors used in the visualization.
The "PRESETS" panel contains various presets that produce visually interesting patterns. By pressing one of the toggle in this panel, you will activate the preset and apply the preset's parameters to the simulation. I would highly recommend cycling through these presets and getting to know how different values of DT, DU, DV, DF, and DK affect the system!
So play with the app and generate a pattern you find interesting! Once you're ready to export geometry, press the "EXPORT MESH + MEL" button. This will generate a closed mesh from the current state of the visualization. The mesh is saved inside of the data folder: data/Layers/GreatScottLater/Assets/model
Step 3: 3D Printing
Now that we have our geometry exported. Lets 3D printed it! If you didn't generate your own pattern, fear not, I've included a couple here that are ready to go!
Regarding 3D printing, I'd recommend following the printing instructions for the 3D printer you'll be working with. The following instructions are for a Makerbot Replicator 2 (Makerware 188.8.131.52).
Open the MakerWare app and create a new file (second photo). Then import a model by pressing the "Add" button. Once you've made your selection, MakerWare will tell you that the Object is too large (as shown in the third photo), and thats okay. Just press "Scale to Fit" to scale the model to fit within the Makerbot's build area (the end result should look like the fourth photo).
Then orient the model so that it is laying flat on the build plate. Do this my pressing the "Turn" button. After rotating the model, press the "Lay Flat" button so the model is in contact with the build plate (as shown in the fifth photo). The press the "Scale" button and then press the "Maximum Size" button.This will scale the model so that it fits within the boundaries of the Makerbot (as shown in the sixth photo).
Now you're ready to print the model! Press the "Make" button and select the level of detail you would like (I usually go with High) and then send it to your 3D printer by either hitting "Export" or "Make It"!
Step 4: Summary & Links
I hope this instructable has ignited your curiosity about natural pattern formation, generative systems, and apps that allow people to explore the parameters of these systems.
If you're interested in learning more about reaction-diffusion systems, here are some links:
If you're interested in learning more about programming, creative coding frameworks, and how to create programs like the one used in this instructable, check out these links:
If you're interested in seeing more things that are inspired by natural pattern formation and/or generative/biological systems, checkout my work and the work I find inspirational:
If you have any feedback, comments, ideas, or questions, please comment! :)