1. NodeBox 3
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Download
  4. Documentation
  5. Forum
  6. Blog

Creating Generative Design

First things first.

Before starting this section you should:

Generative Tower.

Nodebox is ideal for creating generative design. We’ve covered a few of them before (f.e the arab tiling principle).

Suppose we want to make a network that stacks building blocks (represented as simple rectangles with a difference in width and height) on top of each other. I want to be able to tell each tower how many segments it contains and i want to be able to reset the width and height of each segment.

Let start with building the segment.

Since I want the ability to change width and height parameters of this rectangle I will create a random number and use its’ seeding principle to change its’ value.

generative tower step 1

Now for the stack:

The result is ten rectangles all on top of each other. We will have to create a procedure to stack them on each other with reference to their height value.

generative tower step 2

generative tower step 3

The idea is to make a sommation netwerk that returns the sum value for 0, 0-1, 0-2, 0-3, 0-4 and so on. We can do this by changing the Size value of slice1. Try it out and notice that the sum is higher with a higher size. We will do this as many times as there are numbers in random_numbers2. Let’s create a subnetwork to store this function and enable to send a range of numbers to it.

Let’s get back to the child nodes to implement a few modifications. I want to be able to send a number to the Size of slice1 so I need to publish this specific parameter. In addition I want to create a point based on this number.

The idea is that the value can be used to push the y coordinate of each rectangle up based on the combined height of his predecessors. This means we have to negate the number and send it to a make point node.

Back in the root you should be able to see a modification in the accumulation node. It has an extra port that refers to the Size of the internal slice node (the port is a gray one meaning it expects a value).

Now let’s give it a value.

generative tower step 4

The next step is to use the points for the location of the rect.

generative tower step 5

You can change the tower by:

We will create a subnetwork from this procedure and publish some variables that will enable us to change the look of the tower.

The tower node has three ports:

The new tower looks like this:

generative tower step 5

Read the subnetworks page and try creating a number of towers or a skyline:

generative city

Changing the basic segment will change the complete building / city:

generative city


Styled Invader.

Suppose i want to recreate something like the invader example as decribed on the subnetworks page. In stead of using simple rectangles i will create a few shapes to work with.

Output should be the half of the original rectangle (rect1 node):

generative step 1

I want to be able to use this shape with a difference in rotation. Therefore:

generative step 2

Now let’s create something that may represent an eye.

In a later stage i want to be able to select one of these shapes. Next few nodes make this happen:

generative step 3

Our network is getting a bit big so let’s create a subnetwork.

Let’s get back to the childnodes to implement a few modifications. I want to be able to send a number to the Start_index of slice1 so i need to publish this specific parameter. I also want to be able to give a unit a location so i will have to implement and publish a translate node:

Back in the root you should be able to see a modification in the unit node. It has two port: a first one referring to the Start_index (a gray one meaning it expects a value) and a second one to Translate (a blue one meaning it expects a point).

generative step 4

This new unit node will be placed on certain locations of a grid.

generative step 5

Let’s introduce a procedure that does not always pick the same unit but picks a random one instead. First we need to know how many times a unit has to be created. We can count the amount of pick1.

Based on this count we can create an amount of random numbers varying between 0 and 4 (remember that on 0 till 3 were the triangle shapes and on 4 was the eye)

generative step 6

Change the Seed of pick1 to create another result.

This is half of the result. Next step is to align it to the right side of the origin. In order to do this an important step has to be made: render the unit node and have a look at the Data tab in the viewer pane. Notice that there are 8 paths in the list: 1 for each unit. If we would align this as is it would result in a similar aligment for all units. To avoid the translate information we will have to group these 8 paths into a single geometry path.

After the alignment we will reflect it to obtain an invader. Last step is an implementation of a snap node which will change the shapes over a snapping procedure.

generative step 7

Let’s create a few of them.

generative step 8

Below is the same procedure with a few modifications. A shadow was added and the ‘invadergrid’ was altered by rows, columns and dimension.

generative final step