Vector Field Tools in Grasshopper – Basic + and – Point Charges – Example 7.1


An interesting set of tools that was introduced to Grasshopper a few versions back are the “Field” tools. It only takes a bit of practice to get these up and working. What is more difficult is learning to control the results of the fields, and grounding the products of these tools in a design process. You might change one slider or charge just a little bit and suddenly the field completely morphs and turns into something else. This is a challenge I am still struggling with, but since one of my primary research interests is generating design form with fluid simulation systems, I have been trying to understand these tools better and their potentials for integration into a design process.

A quite nice book attempting to rationalize and understand fluid forms and processes is Theodor Schwenk’s book Das sensible Chaos (English Sensitive Chaos: The Creation of Flowing Forms in Water and Air). An image in the book that jumped out at me was this one of five “fields” in water that is gently oscillated. I will need to do a bit more research to see what the exact conditions are that produce each of the specific fields, but I though it would a worthwhile exercise to model these 5 fields in Grasshopper using the Vector Field components

"In oscillating containers filled with water, geometrically regular patterns of flow occur, varying according to the shape of the container (after Parlenko) - from "Sensitive Chaos - The creation of Flowing Forms in Water and Air"

“In oscillating containers filled with water, geometrically regular patterns of flow occur, varying according to the shape of the container (after Parlenko) – from “Sensitive Chaos – The creation of Flowing Forms in Water and Air” – page 32-33

I will start by trying to produce the most simple of the five fields described in Schwenk’s image. Like I said previously, the basic structure of a “Field” script is usually the same, and is fairly simple. Below is the grasshopper script to draw the first field, and I have put a box around the four basic parts.

Basic Field Setup with Grasshopper “Field” components

Basic field with two Point Charges. Black Geometry is drawn in Rhino, Dashed blue lines are the result of the "Field Line" component

Basic field with two Point Charges. Black Geometry is drawn in Rhino, Dashed blue lines are the result of the “Field Line” component

1. The first thing you need are “Charges” or forces. Here I am using two point charges. These have four inputs. The first, P, is a point–the location of the charge. For this example I am drawing these as two points in Rhino, which I then am referencing into grasshopper. The “C” input is the charge itself. This can be a positive or negative number. For now, we will use just a charge of +1 and one of -1. “D” refers to decay, or the rate at which the charge’s effects diminish. I will clarify this a bit more later but for now we will also just use a decay of “1”.  The last input is a boundary. If you have lines dancing off into the sunset, this is a useful way to simply trim the results, but in this case, I will not be using a boundary.

2. The second thing you need are origin points for your field lines. In general, this should be a regularly spaced field, although you could use just a single point as well. In this case, I drew a circle in Rhino, which I then changed to a circular surface. Afterwards, I divided this surface into points to serve as my origin points in the field. You could also draw a grid, populate random points, etc…

3. This is a simple step. All of your charges should be merged together using the “Merge Field” component. This will calculate how they all interact with each other. In this case I only have two charges, but I could merge many more. In my experience, if you try merging too many charges, your computer could crash. Before I merge my fields I like to save 🙂

4. The last step is to interpret your field, using the “Field Line” component. The merged charges go into the first slot “F”. The origin points for your lines (in this case my grid of points in the circle) goes into the “P”. The next number, “N” tells you how long the lines will go through the field. We will see an image of this soon, but a low number here will have only short lines through the field. The steps are pretty small.

Changing the Number of Steps on the Field Line Component


To show a little bit more clearly what is going on, In this diagram I simplified my field a bit. If preview is turned on in Grasshopper, you will see that the positively charged points have arrows pointing out. Generally these will push any line coming out of a point away from it. Negative charges preview with lines pointing inwards, since negative charges suck anything towards it. The sixteen small “x” points represent my field that is plugged into “P” on the “Field Line” component. In each frame, I am making the “N” or the number of steps in the lines incrementally higher. You could also animate this in grasshopper to show the field flowing. The lines coming out of points that are closer to the positive than to the negative will feel the influence of the positive charge stronger than the negative, but will always move towards the negative. As the lines get closer to the negative, the influence of the positive charge diminishes. The result of this interaction are the arced form of the field lines.

There are a couple of ways to alter the behavior of the field. You can alter the strength of the charges, or you can alter the rate of decay.

Effect of changing Charges on Points

Effects of altering the charges on the field

Effects of altering the charges on the field

In the image on the left, the positive charge is increased to +2.0 while the negative charge remains the same at -1.0. You can see that the lines are pushed more strongly by the positive, creating an imbalance in what was once a uniform arc. The lines still move to the negative point, but it takes them longer to get there. In the image on the right, the positive charge remains at +1.0, while the negative charge is increased to -4.0. The effect is the positive has very little influence outside of its immediate vicinity. The lines quickly arc under the influence of the negative charge, and then tend to move straight towards it. When the charges are altered, what is important is the ratio between the various charges. for example, a field with one charge of +1.0 and one of -1.0 will look essentially the same as one with charges of +5.0 and -5.0. To keep things simple, I would recommend keeping the baseline charge always at |1.0| and altering other charges proportionally towards it.

Effect of Changing Decay on Points


Effect of altering the decay

The second variable to alter is the decay, which refers to the radius of effect of a charge. A charge may be very strong in its immediate vicinity, but as you move away it quickly diminishes. Note, that the higher the decay number the faster the effect of the charge decays. In the series above, you can see that when the decay is low (it is 1/10 on the left), the charges tend to keep their full (or nearly full) effect throughout the field. When the decay is is high (5.0 on the right) the lines tend to only feel the effect of the charge nearest to them, and once they cross the threshold between charges, the line abruptly changes its vector. In other words, as the decay approaches infinity, the vector field becomes increasingly angular. Here I have changed the decay of both points proportionally, but you could also make one point decay faster than another, which would create un unbalanced effect in your field.

Examples with Additional Points

It is quite easy to adapt the script above to have more positive and negative charges/points. The first way is to reference multiple points into the same point containers corresponding to your positive and negative charges. Every point with the same attributes can be put into the same container. The second way to do this, especially if you want to be able to independently change the attributes of each point charge, is to simply set up a new point charge (you can copy and paste) and then plug it into the “Merge Field” component along with the other points.

Vector Fields drawn in Grasshopper based on images from Schwenk's 'Sensible Chaos'

Vector Fields drawn in Grasshopper based on images from Schwenk’s ‘Sensible Chaos’

The image above shows the grasshopper variation of each of the five fields in Schwenk. The field in the left-most image I have already described, with two charges. The second image shows four charges in a line, alternating between positive and negative charges, while the third image also shows four charges, alternating between positive and negative near the four quadrants of a circle. The fourth image shows eight charges, while the last image shows six charges.