¡Hola! I am Sara aka parametrip, an industrial design engineer from Barcelona, currently exploring generative art and enjoying the endless mind-blowing results you can obtain with it. I share the majority of my work on my Instagram and on my Twitter.
In this tutorial I am going to show you how I did the animations of this post. We are going to work with magnetic fields in Grasshopper 3D. A field element is an algorithm that applies a force on a given point in space. We are going to use this force to change the position of certain points, obtaining this result:
What you will need
Rhinoceros 3D, a CAD software that includes Grasshopper 3D. You can download here the 90 days free trial.
Grasshopper 3D comes with Rhinoceros 3D. It is a visual programming environment and language used to build generative algorithms, which are created by putting components on the canvas and connecting them with other components and parameters.
Setting up the software
If you want to obtain the same result as me, you will need to change the default settings in Rhino.
I always work with black background, which you can change in View > Display Options > Rhino Options > View > Display Modes > Wireframe > Viewport settings > Background: Solid color / Solid color: black.
I also hide the grid lines, grid axes and world axes icon, unchecking them in View > Display Options > Document Properties > Grid > Grid properties.
Finally, as this time we are going to work in 2D we just need to visualize the Top Viewport, so we are going to maximize it and hide the other ones. For this, click inside the viewport and go to View > Viewport Layout > Maximize.
Okay! We finished the set up. Now run Grasshopper and, if you are like me and don't have two screens, split your screen in two to be able to visualize the Grasshopper canvas and the Rhino viewport at the same time.
Let's start the magic!
Step 1: create a 2D grid of points
We will start the Grasshopper definition with a 2D grid with square cells. There is an specific component to build it called Square, so drag it into the Grasshopper canvas. I have settled the Size of the cells as 0.5. I have also settled the Number of cells in base plane on 'x' and 'y' direction as 70. You can change this parameters, but I recommend you to first build the algorithm the same way I did and then play with different variations. To end this step, add a Point component and Graft the data inside it by right-clicking on it and selecting Graft.
Step 2: set the location of point charge
We are going to create the charge emitting points, which are different from the grid points but are located in the same area. First, add a Plane Surface. Set the 'x' dimension of it as half of the number of cells you settled in the Square grid. To do this add the component Division. Set the 'y' dimension as the same number of cells of the Square grid. Lastly add the Populate 2D component, connecting its Region with the Plane component you just created. Set the number of points to generate, the Count parameter, to 15. The Seed parameter defines a random sequence from a set of possible random number streams, so set it to whatever integer you want, for example 28. Changing the Seed you will change the position of the points randomly.
Step 3: create the fields
The points we just created in the step 2 are the input points for the Point Charge. Add this component and set a Charge and a Decay. I have established the Charge of the points as 28.0 and the Decay of charge potential as 2.00. Connect the resulting fields with the Merge Fields component to unify the fields created in each point into one. To finish this step add the Evaluate Field component. Connect the Field to evaluate with the merged fields obtained, and the Point to evaluate with the resulting points of the step 1.
Step 4: points motion
The last step consists on translating the grid points with the force that executes the field we created. To do this, add the Move component and connect its base geometry to the points we obtained in the step 1. For the Motion input we need a translation vector, so add the Amplitude component, connecting its base vector to the field tensor we obtained in the step 3. For the Amplitude input add a Minimum component, that will return the lesser of two items. The first item for comparison is the length of the tensor vectors, which we will obtain using the Vector Length component. The second item for comparison will be a number settled by us, I used 0.95.
Lastly, I have used the Dot Display component to decrease the Size of the points to 0.17. With this display node you can also change the color of them.
Final definition
The final Grasshopper definition will look like this:
As you can see in the shade of gray of the components, I have put all of them in 'Preview off' mode and I am just previewing the last one: the Dot Display. By doing this, you hide the undesired building elements and show the final result in a clean way. You can hide the display of any component by right-clicking on it and unchecking 'Preview'.
After placing all the components and previewing just the last one, our Rhino viewport should look like this:
Animation
Now you finished the Grasshopper definition, you can export a high-res image of the resultant grid of points, or animate a Number Slider to create motion graphics like I usually do.
To animate any slider right-click on it and select 'Animate'. Now that you are on the Animation controls panel, set the resolution and the frame count. A higher frame count gives a slower but softer movement. You can export the frames of the animation and build the video or GIF in any video editor. You can also record your screen and edit the recording. I usually loop the results I get using Adobe Premiere.
It is important that you set the correct accuracy and numeric domain of the slider before animating it. To do this double-click on it and enter in the Slider properties. Set the rounding to ℝ and the number of digits to minimum 2. This will soften the movement of the geometries. Stablish a minimum and a maximum value for the numeric domain too, which will determine the start and end position of the points, as well as the lengh of the animation.
In the first animation of the post, I animated the Charge input in the Point Charge component. I settled the slider domain from 0.0 to 56.0, with 1 digit of accuracy.
Variations
For me, the best thing about generative and parametric design is the ease and immediacy with which changes can be made in a geometry. Exploring the different variations an algorithm gives is the most enjoyable part of the process for me. In Grasshopper you can easily play with Number Sliders to obtain changes in the geometry you are working on. Here are some of my tests with the algorithm:
In this animation I played with the Seed parameter in the Populate 2D component. I animated the Number Slider from 0 to 35, randomly changing the position of the points that execute the force 36 times.
In this variation I animated the Decay parameter in the Point Charge component from -1.00 to 5.00. I also decreased the dot Size in the Dot Display node to 0.13. Experimenting with negative values gives unexpected and amazing results, try playing with them too.
In this last variation I increased the Count parameter in the Populate 2D component. As you can see, by doing this you increase the number of points that distort the point grid, filling it up.
And that's all!
You can write me to parametrip@gmail.com if you have any doubt about the definition, or if you want to share something with me.
Sara | @parametrip | Barcelona
Comments