A point cloud shaping a Physarum (slime mold) network by sensing food and also following its own traces.
A volume tracing the closest point for each voxel. The trace decays over time.
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.
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;
Sage Jenson explains the Physarum simulation. Entagma also provides technical information about implementing the system in SideFX Houdini.