Physarum Network

calendar_today

23.12.2024

label

VEX, Vegetation

mouse

Houdini 20.5

Description

A point cloud shaping a Physarum (slime mold) network by sensing food and also following its own traces.

1 Code

A volume tracing the closest point for each voxel. The trace decays over time.

C
        float decay = chf('decay');

int pt = nearpoint(0, '!0', v@P);
vector pos = point(0, 'P', pt);
float dist = distance(pos, v@P);
float mask = fit(dist, 0.0, 0.05, 1.0, 0.0);

f@d = max(f@d * decay, mask);
    

The point cloud stepping towards the volume's traces. samplecirclearc defines the directions (left, forward, right) for sampling the volume and moving towards its highest sample.

C
        float a = chf('angle');
float r = chf('radius');
float s = chf('speed');

a = a * PI / 2.0;

float val = 0.0;
vector nml = v@N;
for(int i = 0; i < 3; i++){
    float u = i / 2.0;
    vector dir = sample_circle_arc(vector2(v@N), a, u);
    float d = volumesample(1, 'd', v@P + dir * r);
    if(d > val){
        val = d;
        nml = dir;
    }
}

if(length(v@P) > 4.0){
    nml = slerpv(nml, -v@P, 0.25);
}

v@N = nml;
v@P = v@P + nml * r * s;
    

2 Source

Sage Jenson explains the Physarum simulation. Entagma also provides technical information about implementing the system in SideFX Houdini.

download

Downloads

smart_display

Videos

Grid Particle Systems - Physarum Slime Mold Pt I: Theory

Grid Particle Systems - Physarum Slime Mold Pt II: 2D Setup

Grid Particle Systems - Physarum Slime Mold Pt III: 3D Setup

link

Related articles

favorite

369

label

VEX

Attribute to match across inputs

favorite

247

label

VEX

Sphere Packing / Dart Throwing Algorithm

favorite

273

label

VEX

Deintersecting spheres with Voronoi

favorite

314

label

VEX

Fitting Planes to Point Clouds

favorite

318

label

VEX

How to Analyze VEX Code

favorite

153

label

VEX

Monte Carlo Geometry Processing