Alien Trees from Two Operations

The Benesi Pine Tree looks like something that grew. Not in a vague, hand-wavy "organic shapes" sense. The output genuinely resembles branching trees, coral formations, and root systems, all produced by two geometric operations running in a loop.

The formula does two things on each iteration:

  • Box fold: Clamp each coordinate to [-1, 1], then reflect: z = clamp(z, -1, 1) * 2 - z. This creates sharp creases and symmetry breaks.
  • Sphere fold: If the point falls inside a minimum radius, scale it outward. If it's between the minimum and fixed radius, invert it through a sphere. Points outside pass through unchanged.

After both folds, multiply everything by a scale factor and repeat. The box fold produces angular branching. The sphere fold rounds and inflates the branches. Together they generate structures that split and subdivide like wood grain.

Where It Came From

A FractalForums user named M. Benesi posted a series of 3D fractal formulas around 2009-2010 during the community's search for a "true 3D Mandelbrot." Most of the attention went to the Mandelbulb. Benesi's formulas took a different approach, using triplex coordinate mappings that produced shapes the Mandelbulb couldn't.

The "Pine Tree" name stuck because of what people saw when they rendered it. The T1 variant, implemented in Mandelbulber, produces vertical structures with lateral branches splitting off at angles. Rotate the view and it looks like a conifer. Our 2D version adapts the core box-and-sphere folding operations into a flat projection, which keeps the branching character but flattens it into patterns you can zoom through like a Mandelbrot.

What You Actually See

At the default view, the fractal looks like a symmetrical branching structure against a dark field. Zoom in on a branch tip and you find smaller copies of the whole shape, each one sprouting its own sub-branches.

Change the scale parameter and the character shifts. At scale 2.0, the branches are thick and densely packed. Push it above 2.5 and they thin out, separating into delicate filaments. The min-radius and fixed-radius parameters control how aggressively the sphere fold inflates interior points. Small changes here are the difference between chunky coral and spindly wire trees.

The rotation parameter spins the folding axes, which doesn't just rotate the image. It changes which parts of the plane land inside the fold regions, producing entirely different branching patterns from the same formula.

Exploring It

Parameter Morph

Smoothly varies the scale and folding radii, so the fractal grows, thins, and restructures in real time. Good for seeing how the formula responds to different settings.

Interactive Navigation

Pan, zoom, and rotate manually. Zoom into branch junctions to find self-similar copies of the full structure.

How the Renderer Works

The shader runs the box-fold/sphere-fold loop for each pixel, tracking how fast the point escapes to a bailout radius. Points that never escape get colored as interior (the "tree" itself). Escaped points get a smooth iteration count that feeds into the color palette.

At high zoom levels, the renderer switches to 2x2 supersampling to keep edges clean. Iteration counts scale with zoom depth automatically, so deep zooms don't lose detail. The whole thing runs per-pixel on the GPU, which is why parameter changes update in real time.

Further Reading