Introduction: How to Create a 3D Mandelbulb With Mathematics!

About: Hi, my name is Joe, and I'm a designer, tinkerer and aspiring pixel artist! I love origami, video games and music, and I'm always looking for new ideas and ways to combine my hobbies. I hope you enjoy some of …


In this instructable, you will learn how to create an amazing 3D Mandelbulb object within the free program blender!

Before you do this project, I would recommend you develop some limited understanding of blender, however, a complete beginner should be able to do this project without any issue.

The Mandelbulb is a three-dimensional fractal, originally constructed by Daniel White and Paul Nylander in 2009.

EDIT: After multiple attempts, I was unable to get better quality images available on this site. However, I have uploaded high-quality images to this Google Drive folder:

All of the images in this tutorial are available here. Apologies for the inconvenience.


  • A computer (Laptop or PC, I don't mind)
  • Blender 2.80 or higher (This is free to download from

Step 1: Scene Setup

First off, when you open your new scene in blender, you will be presented with the layout shown in the first image above, of a cube, a camera (The pyramid with its base pointing at the box) and a light (The circle with the star inside). Leave this setup as it is, and look at the bar on the right-hand side. The top box is called the "Outliner" which is simply a list of what is in your scene, and the bottom box is called the "Properties" pane, which has various features you can use to change the scene and objects. To make sure the scene is prepared, click the image of the camera on the margin of the Properties tab. This will take you to the "Context" pane, where you can view details about the scene. make sure that the upper-most box, labelled "Render Engine" is set to "Eevee".

Eevee is a commonly used real time engine, and the only one that will work correctly with this particular project.

Next, scroll downwards to the drop-down labelled "Volumetrics",as shown the the second image. Open this drop-down, and select "Volumetric Shadows", select the value below, and set it to 100.

Now that your scene is complete, we can move on to programming the Mandelbulb itself!

Step 2: Setting Up the Shader

Once you have set up your scene, go to the "Shading" window via the top tabs bar. now, select your cube, and you should see, in the grey grid area, two boxes appear, one named "Principled BSDF" and the other named "Output" these are nodes, the basic building blocks of visual design in blender, and many other programs. To start, delete the Principled BSDF node, and leave output.

Step 3: Defining the Primary Functions: Rho

If you look at the equation for the cubic Mandelbulb (image 1) you see that there are three primary functions, that are used in the full equation - Rho (r), Phi (Ф), and Theta (θ). These functions determine the x, y and z coordinates of the Mandelbulb when combined with the top equation.

First off, lets define Rho, r. To define r, we need to create a "Separate XYZ" node. To create a node, either use the drop-down on the top border called "add" or press "Shift-A" on your key board.

To find the first node go into Add > Converters > Separate XYZ, and select it. Next, add a "Maths" node, also in the converters section. On the node, there should be a drop-down, labelled "add". Select this, and select "power" in the list presented. Then, change the bottom value to 2. this will square whatever we place into the top value. Now, duplicate this two times (Just copy and Paste), and connect one of x, y and z into the top values of the three power nodes. you should have something that looks like the second image. Next, add two more maths nodes, and keep them as "Add". Connect the outputs from the top two power nodes into the inputs of the first add node, and then add the outputs of the first add node, and the bottom power node, into the inputs of the second add node. This will add each of the power nodes together. Finally for the function itself, connect the out put of the second add node into the top value of a new power node, and set the lower value to 0.5. This will square root the sum of the powers. this is the completed rho function.

Now that you have this Function, go ahead and press "Ctrl-G" to create a group. the screen should go green (Image 3). the reason we do this is for organisation and ease of use. Under the "Group Input" node, there should be a link. connect this to the "vector" input of the Separate XYZ node. On the other side, connect the output of the square root node into the link on the "Group Output" node.

Next on the properties sidebar, (If you can't find it, look for a small grey arrow facing left on the right-hand side of the space) and switch to the "node" tab. you should be presented with a table, labelled "interface" (Image 4). The left column represents inputs, and the right outputs. Select the output labelled "value" and in the box below, rename it "vectorlength". Now, exit out of group view (the bent upwards arrow in the top right corner of the area) and you should see the new group. in the properties tab, switch to item, and rename both boxes "vectorlength".

Finally, select your vectorlength group, and place it in another group (Ctrl-G) connect the inputs and outputs, and exit. Rename this group Rho, the same way you did vectorlength. we did this because the vectorlength will later be used outside the context of rho. our final product should look like the fifth image.

Step 4: Adding Some Values

Before we begin defining Phi and Theta, we need to add some inputs. Go into Add > Inputs > Texture Coordinates, and select that. Then, go into Add > Inputs > Value, and add it. Duplicate this. Set the bottom value to one. Your nodes area should look like the image above.

Step 5: Defining the Primary Functions: Phi

Defining Phi (Ф) is simple: Add a "Separate XYZ" node, add a maths node, and set it to "divide" and add another maths node and set it to "Arctangent". Connect the X output of the separate XYZ node into the top value of the divide node, and the Y output into the bottom value of the divide node. Then connect the divide node's output into the top value of the Arctangent node (The bottom value of trigonometric nodes is non-functional). Finally, group the three nodes, and connect the group inputs/outputs as with vectorlength and rho. Your scene should look like the first image. Exit the group, and rename it as "Phi" in the properties tab, as before. Your project should look like the second image.

Now that this is complete, we will code our final Primary Function: Theta.

Step 6: Defining the Primary Functions: Theta

The final function, Theta (θ), is slightly more complex.

To start us off, we need a separate XYZ, two power nodes and an add node. connect the X and Y into the top value of separate power nodes, like Rho, but leave the Z for now. Set the lower values to two, and add them using the add node. next add a third power node, and set the bottom to 0.5. connect the output of the add node into the top of the third power node. Your setup should look like the first image. What you have done so far is sum the X and Y squared values, and rooted them. if you go back and look at the equation for θ, you will see we now have to divide by Z. So, add a divide node, and connect the Z value into the top value, (For divide nodes, the top value is the denominator) and connect the output of the Square root into the bottom value. Finally, add a maths node and set it to "Arctan2" and connect the output of the divide into the top value of this new node.

Next group it, exit group view, and rename it to Theta, as you did the other functions so far. Your area should look like the second image.

Now that we have defined the Primary Functions, we need to use them to generate our new coordinates.

Step 7: The New XYZ Function: Base

To begin defining the New XYZ function, group the three Primary functions together. For this part, we will begin to use the group tools more.

Once in the group, go into properties, and the "Nodes" tab, the one with the table labelled "interface". in the left column, (representing the inputs) add two values, and label one "n", and the other "z". In the right output column, add one output and name it "z".

Connect the "z" input into each "vector" input of the primary functions. Now, add 4 maths nodes - one power, and three multiply nodes. Then, go into Add > Converters > Combine XYZ and add in that node. Your setup should look like the first image.

If you go back, and look at the top equation of the Mandelbulb formula, you can see a large set of arrow brackets, with three smaller brackets inside. what you have now represents the arrow brackets, but we need to define each smaller bracket individually first.

We will now define the first bracket, referred to as "X".

Step 8: The New XYZ Function: X

To define X, create two multiply nodes in the current group, select them and group again. In the properties tab, go into the Interface table and create three inputs, labelled "n" "Phi" and "Theta". rename the output of the group to "x".

Connect the "n" input into both the top values of each multiply node, and connect Theta into the bottom of the upper multiply node, and Phi into the bottom of the lower multiply node.

Next, add two more maths nodes, and set one to "sine" and the other to "cosine". connect the output from the top multiplier into the sine node, and the output from the bottom multiplier into the cosine node. Make sure this turns out right, because it wont work right if they are switched.

Finally, add a last multiply node, and connect the cosine and sine outputs into it. Connect the output of this multiplier into the output labelled "x". Your scene should look like image one. (Note: if you hold shift, and right-click drag across one or more connections from the same output, you can make a movable branch, like i have used in both images above)

Now, exit this group, and return to your New XYZ group. select the X group, and look at properties. in the item tab, rename this group to "X", and select colour, and set it to red, using the colour wheel. this isn't strictly necessary, but it helps organise the groupings further. Now connect the phi, theta and n outputs (the two groups, and the general input) into the X group. What you have should look like image 2.

Now, we need to create the "Y" function.

Step 9: The New XYZ Function: Y

The Y function is almost identical to the X function (despite this, don't copy and edit the X group, because they will be linked, and any modifications you make will affect both groups.)

So, add two multiply nodes and group. in the group inputs, add three inputs called "n", "Phi" and "theta", and one output called "y". Connect "n" to each multiplier, "theta" to the top multiplier, and "phi" to the bottom multiplier. next add two maths node, but this time set them both to "sine". as before, connect the outputs of the multipliers into the top inputs of the sine nodes. Add another multiplier, and multiply the two sine values together.

Connect the multiplier output into the "y" group output. Your setup should look like image one.

Exit the group, and name it Y, and set the colour to green. Connect up the values as before. Your setup should look like image two.

Onto the "Z" function.

Step 10: The New XYZ Function: Z

Lastly, we need to define the Z function.

This is much simpler than X and Y. Create a single multiply node, and a single sine node. Group these. In the Interface table, create two inputs called "n" and "theta" and one output called "Z". Connect "n" and "theta" into the multiplier, and connect the multiplier into the top value of the sine function. Connect the output of the sine node into the "Z" output. Exit the group, name it Z, and colour it blue. Your area should look like image one.

Connect up the values as before (the group "theta" and n)

Now we need to finish wiring up the New XYZ function.

Step 11: The New XYZ Function: Final Steps

Now that we have the X, Y, and Z functions, we need to connect them up.

first, connect the n value into the bottom value of the power node we created earlier. Remember to connect the n outputs with a single node (shift, right-click-drag) for organisation. Then, connect the output of the rho group into the top of the power node. Your area should look like image one.

Next, connect the output of the power node into the top value of each of the multipliers we created earlier. Now, connect the output of X into the other value of the uppermost multiplier, connect the output of Y into the other value of the middle multiplier, and connect Z into the other value of the bottom multiplier. your area should look like image two.

Finally, connect the multipliers into the combine XYZ node you made earlier. the multiplier connected to x should go into the x input, the y multiplier into the y, and the z into the z. your Area should now look like image three.

Now exit the group, and call it "New XYZ"

Step 12: The BULB Modifier

We have now created the main equation for a Mandelbulb, but we need to use another procedure to be able to apply it to our cube. The BULB modifier is an iterative function, reapplying the New XYZ function repeatedly based on some parameters. For this modifier, we will use a lot of group tools.

First off, create a group around the New XYZ function. In the interface column of the properties tab, add 6 outputs, and 6 inputs. Call these "n", "z", "c", "limit", "length" and "iter" make sure that each input has a corresponding output of the same name. Your setup should look like image one.

To start, connect n, c and limit directly into their counterparts.

Next, add 3 maths nodes; one add node, one multiply, and set the fourth to "less than". Now we need to add a "Vector Math" node. Go into Add > Converters > Vector Math, and add one of these nodes. Set it to add, exactly like a normal maths node.

Now, connect "n" and "z" into the corresponding inputs on the New XYZ function. Then, connect the output of the New XYZ function into the top input of the Vector Math node, and connect C into it's lower value. You should have something like image two.

Now, add our Vector length group we made all the way back at the start. you can find this by entering the New XYZ group via the symbol in its top corner, then the rho group the same way. simply copy and paste this function, as we want to link it. Once you have it in the BULB group, connect the vector output of the vector math node into the vectorlength group's vector input. then, connect the output into the "length" output of the whole group. also connect the output of the vector math nod into the group output labelled "z". You should now look like image three.

Now to utilise the three other maths nodes we added. First, connect the group limit input into the bottom value of the "less than" node. This needs to be entered into the bottom value. then connect the group length input into the top value of the less than node. Then, connect the output of the less than node, into one of the inputs of the multiplier node. Then, connect the "iter" group input into the top input of the add node, and set the lower value to 1. Connect the add node's output into the other value of the multiplier node.

Connect the multiplier's output into the group output for "iter". Your current area should look like image 4.

Now exit the group, name it BULB, and pick a nice colour for it.

Step 13: Applying and Stacking the BULB Modifier

So, to apply the BULB modifier we need to first connect it with those two "value" nodes and the "texture coordinate" node we made at the start. Firstly, connect the blue "object" output of the "texture coordinate" node into the inputs on the BULB for "z" and "c". Then, connect the top value node to the BULB modifiers "n" input, and the bottom value node to the BULB modifiers "limit" input. Next, set "length" and "iter" to 0. Your area should look like image one

In order to iterate, or stack the BULB modifier, simply duplicate it and connect up the inputs to their corresponding outputs as shown in image two. Depending on how beefy your computer is depends on how many times you should stack the BULB modifier. I have a top-shelf Laptop, and I could handle 5 iterations (image 5), but a desktop may be able to handle more, and similarly, a lower-end laptop may not be able to take as much.

Step 14: Visualisation!

Finally, we can make it look like something! But we still need a few nodes. make sure the output node is in sight, and go to the end of your BULB modifier chain. First, add a maths node, set it to "greater than" and connect the "iter" output into the top value. set the bottom value to around 3.5 (you may want to play with this number later)

Next, connect the "greater than" node into a new Multiplier node, and set the other value to around 20 (again, you may want to change it later). Your setup should look like image one.

Now we need some Shader nodes - you can find the one we want by going into Add > Shader > Volume scatter, and selecting that.

Simply put, the volume scatter node will take each "atom" within our cube, and re-position it based on the maths we've just finished writing. Its quite cool, really.

Any way, connect the multiplier's output into the "density" input of the Volume scatter node.

Next connect the Volume scatter node into the Volume output on the output node, and Voila! Your cube should transform into a cool 3D fractal!

(If it looks flat, or you can't see anything, set the top value above the "texture coordinate" node above 0, usually 20 is pretty cool)

However, it might look a bit grey. To colour it up a bit, I added a Colour ramp node, (which is like a gradient) but you can really add whatever you like, and make it your own. to simply change the colour, click the white box, and drag the colour wheel around to create a custom hue.

To add a colour ramp, go to Add > Converters > colour ramp, and add one in. this has two colours you can change with a wheel, but if you select the drop-down next to "RGB" and select "HSV", and the drop-down next to "near" and select "counter clockwise" you can create a spectrum. Set one side of the colour ramp to red, and the other to green and there you go, a spectrum. (image 2)

Step 15: Results

Have a play with the top value and the colours, make something cool! Here are a few variations i got (different to the ones on the front page)

I'd love to see some of your renders!

Please don't hesitate to let me know if your Mandelbulb doesn't turn out right. I had a lot of flops the first time I made my own, and I know it can be frustrating when it doesn't look right, so I am more than happy to help troubleshoot.

Thank you very much with sticking through to the end, and I hope you are satisfied with your final project! who ever said mathematics couldn't be cool?

Made with Math Contest

Participated in the
Made with Math Contest