Skip to content
/ MV2 Public

Hardware accelerated Mandelbrot set explorer and zoom video creator

License

Notifications You must be signed in to change notification settings

Yilmaz4/MV2

Repository files navigation

Mandelbrot Voyage 2

A fully interactive open-source GPU-based fully customizable fractal zoom program aimed at creating artistic and high quality images & videos.

mv2

Mandelbrot set is a set defined in the complex plane, and consists of all complex numbers which satisfy | Z n | < 2 for all n under iteration of Z n + 1 = Z n 2 + c where c is the particular point in the Mandelbrot set and Z 0 = 0 .

Points inside the set are colored black, and points outside the set are colored based on n .

Features

  • Smooth coloring with n = n log P ( log | Z n | ) where n is the first iteration number after | Z n | 2
  • Fully customizable equation in GLSL syntax, supporting 10 different complex defined functions
  • Normal vector calculation for Lambert lighting
  • Super-sampling anti aliasing (SSAA)
  • Customizable color palette with up to 16 colors
  • Hold right-click to see the orbit and the corresponding Julia set for any point
  • Zoom sequence creation
2024_Jan_13_22_31_47_19.mp4
2024-05-22.00-45-10.mp4

Custom equations

The expression in the inputs are directly substituted into the GLSL shader code. Because double-precision bivectors are used, most of the built-in GLSL functions are unavailable; and because vector arithmetic such as multiplication or division are component-wise, the following list of custom implemented functions have to be used instead:

Custom functions reference

Double-precision transcendental functions

Function Definition
double atan2(double, double) tan 1 ( x / y )
double dsin(double) sin ( x )
double dcos(double) cos ( x )
double dlog(double) ln ( x )
double dexp(double) e x
double dpow(double, double) x y

Complex-defined double-precision functions

Function Definition
dvec2 cexp(dvec2) e z
dvec2 cconj(dvec2) z ¯
double carg(dvec2) arg ( z )
dvec2 cmultiply(dvec2, dvec2) z w
dvec2 cdivide(dvec2, dvec2) z / w
dvec2 clog(dvec2) ln ( z )
dvec2 cpow(dvec2, float) z x , x R
dvec2 csin(dvec2) sin ( z )
dvec2 ccos(dvec2) cos ( z )
Local variables

You can use these variables in the custom equation however you want

Name Description
dvec2 c Corresponding point in the complex plane of the current pixel
dvec2 z Z n
dvec2 prevz Z n 1
int i Number of iterations so far
dvec2 xsq 2 ( Z n ) , for optimization purposes
dvec2 ysq 2 ( Z n ) , for optimization purposes
float degree Uniform variable of type float, adjustable from the UI
int max_iters Maximum number of iterations before point is considered inside the set
double zoom Length of a single pixel in screen space in the complex plane

The first input (dvec2) is the new value of Z n + 1 in each next iteration. The second input (bool) is the condition which when true the current pixel will be considered inside the set. The third input (dvec2) is Z 0 .

Examples

Screenshot 2024-05-31 222113
Burning ship fractal Z n + 1 = ( | ( Z n ) | + i | ( Z n ) | ) 2 + c Z 0 = c Bailout:  | Z n | > 100

Screenshot 2024-05-31 222339
Nova fractal Z n + 1 = Z n Z n 3 1 3 Z n 2 + c Z 0 = 1 Bailout:  | Z n Z n 1 | < 10 4

image
Magnet 1 fractal Z n + 1 = ( Z n 2 + c 1 2 Z n + c 2 ) 2 Z 0 = 0 Bailout:  | Z n | > 100 | Z n 1 | < 10 4

Limitations

  • Any custom equation utilizing dvec2 cpow(dvec2, float) where the second argument [ 1 , 4 ] N will be limited to single-precision floating point, therefore limiting amount of zoom to 10 4 .
  • Most of the double-precision transcendental functions are software emulated, which means performance will be severely impacted.
  • Maximum zoom is 10 14 due to finite precision.

Contributing

Contributions are highly welcome, it could be anything from a typo correction to a completely new feature, feel free to create a pull request or raise an issue!