4
$\begingroup$

Lately i've been reading a lot about fractals, mandelbrot set and the mandelbulb.

I am able to recreate the mandelbulb in Blender using a volumetric material (similar to the solutions discussed here, without using an add-on: Recreating Mandelbulbs with math nodes). But as I wasn't really satisfied with the possibilities there I tried to replicate in in Animation nodes to maybe get a particle-system-like look (I don't really know where I was going tbh).

The formulas used in pseudocode:

r = sqrt(x*x + y*y + z*z )
theta = atan2(sqrt(x*x + y*y) , z)
phi = atan2(y,x)

newx = r^n * sin(theta*n) * cos(phi*n)
newy = r^n * sin(theta*n) * sin(phi*n)
newz = r^n * cos(theta*n)

The way I understood the whole thing was, I have starting Coordinate (P1), and for every iteration I get a new Coordinate (Pn). So this is my node tree and the result (not really what I was going for):

enter image description here enter image description here enter image description here

I think my formulas are correct – I don't think I really understood the whole concept though. Is this even possible to do? Any hints?

$\endgroup$

1 Answer 1

3
$\begingroup$

I experimented with Mandelbulb in Animation Nodes before, so yes, it is possible. However, I had to write a lot of custom code to the point that the node tree was composed entirely of nodes that don't exist in the official version of Animation Nodes. Creating what you want in the official build is extremely hard if not impossible. I shall not attempt to answer your question, but I will give you an idea about what we need.

A very quick explanation, will edit later when I have the time.

The Cycles implementation classified every point in space to either belong to the Mandelbulb set or not, the density of the volume at the points that belong to the set was initialized to a very high value, while the points that didn't belong were initialized to a zero density. The very high density rendered the set almost diffuse, that's why you can see it.

In Animation Nodes, we could similarly compute whether a point belong to the set exactly like the Cycles implementation, but what next? what are you going to do with this information? One thing you could try is for each point in a 3D grid, place an object if the point belongs to the set, this will roughly visualize the the set depending on the resolution of your grid. But if you want to create a mesh from it, we have to use something called Implicit Polygonization, the most commonly used and simplest technique is called Marching Cubes(MS). MS can polygonize binary fields(Either belong to the set or not), but for better smoother results, one has to compute a Signed Distance Field(SDF) which is somewhat hard to compute from the set (Basically you will be computing the distance between every point in space and the closest boundary of the set). But then you will need to store and compute that field somehow, Animation Nodes only support linear lists/Arrays, we will need 3D arrays, which is something we can do in Python using Numpy, a workaround would be to use Linear Indexing, but it will be less convenient.

Here are some resources to help you implement this. A full description of the problem and solution can be found in this article by Inigo Quilez. The only difference is, you will be polygonizing the SDF and not rendering it using Ray Marching. You can learn how to implement Marching Cubes from this article by Paul Bourke. Finally, you can store and compute the field using numpy, a good starting point is the meshgrid function, you can work your way through the documentation from there.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .