r/fractals 1d ago

XOR

Post image

I was trying to make an icon and got this when fiddling with the settings. The checker pattern comes from XORing z - c against zi - ci.
I've used that before, but I found this one rather striking.

46 Upvotes

11 comments sorted by

3

u/Bulky_Nature_3861 1d ago

Looks like a chessboard! Do you have any more color schemes?

1

u/jacob_ewing 1d ago

Of this particular image? No, but it definitely could be done. My renderer uses sine waves with several modifiers to build the palette.

2

u/geon 1d ago

Awesome! Do you have a high resolution render? Like 4k?

2

u/jacob_ewing 20h ago edited 19h ago

Sure! Here it is at 3840x3840 (assuming reddit accepts that large a file):

2

u/geon 19h ago

Thanks!

2

u/FowlOnTheHill 1d ago

Could you explain what you are XORing? A one bit image?

2

u/jacob_ewing 19h ago

Sure. So, you know how in the Mandelbrot set, you start off with a coordinate that you're rendering (c, ci), and repeatedly use it recalculating another point (z, zi). It ends when either (z, zi) falls outside of a radius of 2 or when a maximum number of iterations has been reached.

In this case, when the loop is done, it takes the displacement between (c, ci) and (z, zi), scales it up, XORs the rounded values together, scales it back down, and adds that resulting scalar to the count, which is then used to calculate colour.

If you want to check out the code, I have it up on github at https://github.com/jacobEwing/webtoys/tree/main/mandelbrot

The function that does this work is createColour, defined near the top of mandelbrot.js, and the key line is this one:

count += config.options.coefficients.displacementXOR * ((config.map.accuracy * (countInfo.zi - countInfo.ci)) ^ (config.map.accuracy * (countInfo.z - countInfo.c))) / (config.map.accuracy);

2

u/FowlOnTheHill 19h ago

Thank you! It didn’t occur to me that the zi and ci were the imaginary components. Thats neat! I’ll have to play with that!

1

u/jacob_ewing 19h ago

Follow-up: right next to that logic is one that XORs their polar coordinates instead. It gives results like this:

2

u/Toothpick_Brody 1d ago

Woah, a combination XOR-Mandelbrot fractal! Nice work 

2

u/Ready_Challenge_7875 14h ago

now play chess on it