This example demonstrates a grid of spheres that change in size based on their distance from an input point.
Here is the link to the final example: https://app.nodi3d.com/?example=Attractor

Add a Sphere Node

To add a node, double-click on the node canvas or press the Tab key to open the node search menu.
You can browse through the node categories to find the desired node. Alternatively, you can type the node name into the search bar to add it. In the node search bar, type Sphere to display the Sphere node as a suggestion. Click on it to add it.

Check the Node Information

When you click on a node placed on the node canvas, the information of the selected node is displayed in the Node Inspector.

In the Inspector, you can configure the properties of the node and check the data output by the node.

The Sphere node has properties representing its center position and radius. By editing these properties in the Inspector, you can adjust the shape generated by the Sphere node.

Each node has input parameters and output parameters. By connecting the output of one node to the input of another, you can create data flows and perform modeling. This structure, composed of nodes that hold data and edges that connect the nodes, is called a node graph.

You can check what type of data a node’s input expects and what data is available from its output by hovering your mouse over the input or output sections.

Create a Data Flow

Try connecting a node that outputs a numerical value to the Sphere node to parametrically change the radius of the sphere.

Add a Number Slider to the node canvas and connect it to the Sphere node.
You can create an edge between nodes by clicking on the input/output section of a node and dragging it to the desired connection point.

With the Number Slider’s output connected to the radius input of the Sphere node, you can observe the sphere’s size change as you adjust the output value in the Number Slider’s Inspector.

This achieves the simplest form of parametric modeling!

How to Disconnect Nodes

To disconnect an edge between nodes, right-click on the input or output connected by the edge and select Disconnect from the menu.

Alternatively, you can hold the [Ctrl or Command] key and left-drag to activate a drawing tool for quickly cutting multiple edges at once.

Move a Sphere

By connecting the output of the Sphere node to a Move node, you can change the position of the sphere.

The Move node accepts geometry data to be moved and a vector representing the translation offset. This vector data can also be modified directly in the Inspector.

At this point, you may notice that two spheres are displayed.
This happens because the geometry output from the original Sphere node and the geometry moved by the Move node are both being displayed.

If you want to hide certain geometry, you can turn off the visibility setting of the node that outputs that geometry.

Arrange Spheres in a Grid

Add a Square Grid node to the node canvas.
The Square Grid node allows you to create a grid with square cells by specifying its size and the number of divisions in the x and y directions.

The Square Grid outputs rectangle curves representing each cell and the positional data of the grid’s vertices. This vertex information can be viewed in the Inspector.

By connecting the position data output of the Square Grid, which represents its vertices, to the translation vector input of the Move node, you can arrange spheres in a grid pattern.

Create an Attractor

An attractor is an object that influences other objects based on spatial relationships, such as distance.
In following sections, we will create an attractor that changes the size of spheres based on their distance from the attractor.

First, create the attractor’s position data using a Construct Point node.

Next, calculate the distance between the vertex coordinates output from the Square Grid and the attractor’s position using a Distance node.

To change the size of the geometry arranged on the grid via the Move node, use a Scale node. The Scale node takes the following inputs:

  • Geometry to scale
  • Center point for scaling
  • Scale factor

Connect the output of the Move node to the geometry input of the Scale node,
and the output of the Square Grid to the center position input.

https://github.com/user-attachments/assets/8adb6512-37cb-4f1e-8c19-50ac482adcac

Finally, connect the output of the Distance node to the scale factor input of the Scale node. This completes a node graph where the sphere sizes change based on their distance from the attractor’s position.

However, directly inputting the Distance values into the scale factor would result in values that are too large. To address this, use a Division node to scale down the Distance values before connecting them to the Scale node.

Adjust the Attractor’s Position to Be Relative to the Grid

In the current setup, you can edit the attractor’s position by adjusting the XY properties of the Construct Point node. However, the attractor’s position is not relative to the grid size, so when the grid size changes, the attractor’s position becomes misaligned.

For example, if the grid size spans X: 0 to 10 and Y: 0 to 10, and the attractor is positioned at (5, 5), it will be perfectly centered on the grid.

However, if the grid size doubles along both the X and Y axes(0 to 20), the attractor’s position remains at (5, 5), which is no longer the center of the grid.

This misalignment occurs because the attractor’s position is defined in absolute terms rather than being relative to the grid’s size.

To make the attractor’s position relative to the grid size, first modify the setup to output the grid’s size as a variable from a separate node.

The grid size is determined by two inputs of the Square Grid node:

  • The input that sets the size of each cell.
  • The inputs that set the number of cells along the X and Y axes.

Edit the node graph so that these inputs are influenced by values output from Number nodes.

The grid size is calculated as “cell size × number of cells”.

To represent this, connect the outputs of the two Number nodes to a Multiply node.

The attractor’s position will be determined using an MDSlider node.

The MDSlider node provides a UI for editing 2D values. The values edited in the Inspector always range from 0.0 to 1.0. The actual output from the MDSlider is calculated based on the configured numerical range using the formula:

output = (max - min) * t + min

where t is the value in the range of 0.0 to 1.0.

By connecting the previously calculated grid size values as inputs to the MDSlider, the coordinates output from the MDSlider will always fall within the range of (0.0 to grid size).

Finally, connect the output of the MDSlider to the input of the Distance node. This ensures that the attractor’s position is determined relative to the grid size.

It’s Complete!

Now you have learned the basics of using Nodi.
By exploring [[other examples|Examples]], you can discover the functionalities of various nodes and how to utilize them effectively.

Regarding this attractor example, note that the sphere’s size and the scaling factor based on the attractor’s distance are not yet relative to the grid. However, the attractor example available from the application has these aspects adjusted to be relative. Feel free to check it out if you’re interested! https://app.nodi3d.com/?example=Attractor