Fibonacci spheres are created from a point set that follows a spiral path to form a sphere (you can see an example, with code at OpenProcessing).
For the video above, I used the approach described in the Entagma Strange Attractors tutorial, but changed the VEX in my solver to:
if (inpointgroup(geoself(), "active", @ptnum)) {
float samples = 500;
float offset = 2.0 / samples;
float increment = $PI * (3.0 - sqrt(2.0));
float i = @ptnum;
float y = ((i * offset) - 1) + (offset / 5);
float r = sqrt(1 - pow(y,2));
float phi = (i % samples) * increment;
float x = cos(phi) * r * 1.5;
float z = sin(phi) * r * 1.5;
vector p = set(x, y, z);
int newPoint = addpoint(geoself(), p);
if (newPoint <= samples) {
setpointgroup(geoself(), "active", newPoint, 1);
}
setpointgroup(geoself(), "active", @ptnum, 0);
int previous = @ptnum - 4; // second clip is simply `@ptnum`
if(previous > 0) {
int polyline = addprim(geoself(), "polyline");
addvertex(geoself(), polyline, previous);
addvertex(geoself(), polyline, newPoint);
}
}This code (the core algorithm is borrowed from this StackOverflow answer) yields a complete sphere over 500 frames.
To jazz things up a little, the parametric geometry lives inside a spherical volume with a geometry area light in its centre - this gives a nice fog that receives shadows.
The first clip was raytraced, which gives lovely results but takes an age. The second clip is micropolygon rendered, which is much faster but not half as pretty.
Add a comment