Inside the Mandelbulb…from outside !
Let’s flip a fractal inside-out like a sock - Octane render - osl by matteo scappin
If you're a fan of mind-bending, infinitely detailed mathematical shapes then you're probably familiar with this monster, the Mandelbulb.
This cool fractal is a three-dimensional version of the famous Mandelbrot set, and it's just as fascinating to explore even if it’s not as detailed as his father.
With its complex structure and mesmerizing patterns, the Mandelbulb is a must-see for anyone who loves math and art. So why not take a trip into this virtual world and see what treasures are hidden inside ?
We’re going to explore some of it’s features in Octane render 2021 and Vectron which is able to render OSL shaders:
As a three-dimensional analogue of the famous Mandelbrot set, the Mandelbulb is a complex 3D mathematical object that is created using a combination of algebraic operations and recursive algorithms and it has an infinitely detailed structure that is constantly evolving and shifting.
The inside of a Mandelbulb is a fascinating and mysterious place, filled with intricate shapes and organic looking patterns.
By turning the Mandelbulb inside out (like a sock), you can see the fractal from a completely new perspective, uncovering hidden details and patterns that may not have been visible before. This process involves using mathematical techniques to manipulate the structure of the Mandelbulb and flip the space with a spherical inversion before calculating the Fractal.
The resulting shape may be unrecognizable at first, but with careful exploration and study, you may be able to uncover new features and insights about the Mandelbulb.
This process can be heavy to render and explore since the distance estimation is not designed for the inside out version of it, but with some tweaks of the code we are able to render it correctly.
Before flipping the Mandelbulb inside out with a sphere inversion transformation, we need to add the famous Julia mode to the code os we can have more control over the Bulb shape.
To do so we just need to replace the “pos” vector with “Julia“ and assign 3 declared float parameters to the vector(JuliaX,JuliaY,JuliaZ).
With Julia mode now connected in the soul of the Mandelbulb, you can explore and experiment with different Julia parameters to find unique and interesting shapes. In my case, I'm on the hunt for holes or voids within the structure of the Mandelbulb, since once flipped inside out, holes will filled with surfaces.
Now that we have all the necessary tools in place, it's time to transform the Mandelbulb by flipping it inside out using a Sphere Inversion transformation. This pre-transformation will be applied before we calculate the fractaland we can now uncover hidden patterns and features that would not be visible using other methods. It's an exciting opportunity to explore the Mandelbulb in a whole new light.
To do that, we need to add the custom SphereInversion( ) function before the “shader OslGeometry()“ and then apply the transformation to our main Position vector Z just after the declaration of it.
Now that we have inverted the Fractal, we need to invert the normals to properly render the image. This can be done by replacing the RayStepMultiplier (0.5) value with a smaller negative number, -0.1 should work great . This will increase the render time and improve the precision of the algorithm, allowing us to see the Fractal in greater detail and accuracy.
Here’s the final code :
The final result
Rendered with octane using the code provided above.
The scene is pretty simple, just a camera and a Daylight environment. For the fractal PBR material I’m using a Subsurface Scattering Random walk node to get some nice colors based on the Bulb thickness.
Here I’ve looked for some nice spirals by tweaking the Julia XYZ with the following values : Julia X = 0.166791 Julia Y = 0.651987 Julia Z = 0.07568 (Could be from Bill Snowzell)
Few images of the Inverted Mandelbulb using different softwares like Mandelbulb 3D, Houdini and Octane render.