Is it possible to define a true mathematical fractal in Blender?

For example, would it be possible to use a script or a Blender addon to procedurally generate 3D fractal objects. This could be immensely useful for a number of natural objects that happen to be fractal in nature, such as snowflakes, broccoli, tree branches, ferns, coastlines, mountains, etc?

Fractal snowflake:

enter image description here

Fractal Romanesco broccoli:

enter image description here

My first thought was to use the Add 3D Function Surface addon, but that doesn't currently allow for recursive definitions. Using textures, combined with images of fractals could help with 2D objects (such as the snowflake), but this solution doesn't really allow for the generation of these fractals. So my question is, is it possible currently to recursively generate fractals in Blender, either with built in functionality or with an addon? If this functionality isn't yet available, would it be possible to write a script to do this?

  • $\begingroup$ Blender can edit images, so theres nothing stopping your from making a mandelbrot image and using as a texture -- even to update each frame is possible using a frame_change_post handler. But I suspect this isnt the answer your are looking for, so please write some more details in your question about how you intend to use this. $\endgroup$
    – ideasman42
    Jun 30 '13 at 20:08
  • $\begingroup$ For broccoli see the golden spiral question. The snowflake could be done using the mirror modifier. $\endgroup$
    – Aldrik
    Jun 30 '13 at 21:17
  • $\begingroup$ There is an addon to generate fractals here: github.com/NMEMine/BlenderFractals $\endgroup$
    – user1853
    Feb 22 '16 at 15:47
  • $\begingroup$ Have look at incendia, which can export its results as 3D-objects. But be careful, these end up with millions of vertices. $\endgroup$
    – user31669
    Oct 19 '16 at 6:27

This script will generate a 2D Mandelbrot set in Blender using OSL.

#include <stdosl.h>

shader node_fractal(
        float CenterX = 0.0,
        float CenterY = 0.0,
        point Vector = P,
        float Zoom = 1.0,
        int MaxIterations = 50,
        color Foreground = color(1.0),
        color Background = color(0.0),
        output float Fac = 0.0,
        output color Color = 0.0)
    point p = Vector / (2* Zoom);
    float auxiliar = 0.0;

    p[0] += CenterX;
    p[1] += CenterY;

    point pa = p;
    point pb = point(0.0);
    int i = 0;
    for(i=1; i<MaxIterations; i++)
        pb[0] = pa[0]*pa[0] - pa[1]*pa[1];
        pb[1] = pa[0]*pa[1] + pa[1]*pa[0];
        pa = pb + p;

    auxiliar = sqrt((pa[0]*pa[0]) + (pa[1]*pa[1]));

    Fac = clamp(auxiliar,0.0,1.0);

    if (Fac == 0.0)
        Color = Background;
        Color = mix(Foreground, Background, Fac);


enter image description here

Source: http://elbrujodelatribu.blogspot.fr/2013/04/blender-cycles-osl-mandelbrot-fractal.html

  • $\begingroup$ This is a good read too.. Fun with instancing in Cycles $\endgroup$
    – iKlsR
    Jun 30 '13 at 20:57
  • $\begingroup$ @Gwenn of course by right before, you mean nine minutes after. ;) $\endgroup$
    – Aldrik
    Jun 30 '13 at 21:11
  • $\begingroup$ While this is a neat answer, the question is about modeling. $\endgroup$
    – ideasman42
    Jul 1 '13 at 1:42
  • $\begingroup$ @ideasman42, see above comments, "rendering trick" was acceptable at the time of posting. $\endgroup$
    – Aldrik
    Jul 1 '13 at 2:11

You can implement specific fractal equations and algorithms to generate objects. I did this once for Koch snowflake shapes, if you want to start somewhere.

You can get the script's code here.

Koch Snowflakes

As a basis for golden ratio based objects, you can use this other script that generates Fibonacci spirals.



L-systems for Blender

When discussing 3d and fractals you might want to investigate L-systems (wikipedia link).

This video shows Romain Lopez using his implementation of L-systems with blender and python, unfortunately no links to code are provided. But L-systems are really cool and can make brain-bending complexity with minimal input.

Michael Anders has a tutorial for an L-system addon, which was posted on BlenderNation not so long ago.

  • $\begingroup$ Animation nodes has L-Systems too ;) $\endgroup$
    – Chris
    Apr 12 '21 at 23:39

I think the answer to your question would be No, but you can get useful results by generating triangles based on a mathematically defined surface.

This is a very open ended question, even though you ask about fractals, the question applies to any mathematically generated shapes.

The bottom line is that Blender only supports polygonal geometry (so no mathematically defined surfaces, nurbs, metaballs etc) - It all gets converted into triangles before displaying in the view-port or rendering.

Contrast this to Povray which can render math based surfaces. *

So you can write some script to generate geometry, but its limited in that the output must be polygonal geometry.

I have seen an example where a developer was able to automatically adjust the detail to match the camera - this way you can fake having infinite detail, so perhaps this can be a solution for you.

This can work simply by using a Python script which regenerates a mesh on a frame-change handler, taking the Camera's view-point (and any other changing parameters) into account.

However the question is so general that its not clear what your intention is exactly once you have some generated geometry rendering.

*Note, that Blender has povray integration which can use custom defined math surfaces


I think the answer is NO. Blender can not make 3D fractals. You can make 2D fractals using OSL or python (as other answers explain).

3D fractal softwares use voxel data to create volumetric shapes through certain number of iterations. I think it is not a question of making surfaces or vertices with code or addons.

I don't know how BI works with voxel data but in Cycles it is a future project. There is some recent work made by blender developers but the future is the integration with OpenVDB library. Before this milestone won't be possible to create a proper 3D fractal.


Fractals in blender can be imitated however, using image tracking software like "123D Catch". You can use a script to analyze point locations to reverse engineer a fractal somehow for polygonal simplification, but doubt it would do any better than Mandelbulber for speed no matter what you do. I've been looking into using strafed jpegs around objects in Mandelbulber for generating terrain which can then we weathered, and or given many other types of mods for use in Unigine or Unity. It might be useful for a terrain generator to be built into Mandelbulber itself. Take on a non-standard grid using 5 (or variable divisible into 360 evenly) of perspectives to simplify the voxels by merging the points onto the perspective grid using fuzzy logic to figure which planes to stick to. I've seen a blender image catcher outside of 123D but haven't had time to compare the two. 123D is out of beta testing, so she's really good for this.


I'm also very interested in this. I found a video on Youtube where someone made a shader to render julia fractals as volumetrics. I then searched for julia mandelbulb and especialy mandelbox formulas and infos about distance estimation and raymarching but I couldn't understand it really. But I tried to put everything together and somehow it worked. The result is not a real mandelbox but I think never the less some interesting shapes came out of it. I then found also that it's possible to use the vertex displacment node with it but it's not working exactly as I would like. But It does something. Here are my results:

Just different sized Cubes with adaptive subdivision: Just different sized Cubes with adaptive subdivision Use of the Distance Value with a Color Ramp to mix Glas and Metalshaders: Use of the Distance Value with a Color Ramp to mix Glas and Metalshaders Cube with subdivision and edgesplit modifier applied then scaled the faces by 0.5: Cube with subdivision and edgesplit modifier applied then scaled the faces by 0.5 The Distance Value can also used to define density of volumetric scattering and absorption with a colorramp: The Distance Value can also used to define density of volumetric scattering and absorption with a colorramp I hope I'll find a way to improve the vertexdisplacment thing. There is a demo where one made something like this in unity engine but very improved and also realtime.

Here is a link to the blend-file on googledrive: https://drive.google.com/open?id=1OHEbTSi0fQuVkUER5bKxa2Jf-FRq8fzS

Some more links:

Mandelbox Volumetric Shader OSL Script

A Realtime Fractal in Unity Engine by Okan Koese

Julia Fractal Shader for Blender Youtube Tutorial

  • $\begingroup$ Added the link. $\endgroup$
    – Bluebone
    Jul 10 '18 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.