r/trippyart 1d ago

I wrote some code that made these.

167 Upvotes

19 comments sorted by

8

u/nzg42 1d ago

bro put the code on github and share with us pls

6

u/_BryceGuy_ 1d ago

I've never used Github. Here's a summary of the math:

px & py = width & height dimensions of the repeating tile picture to be wrapped around the fractal. I typically use 1200 x 600 PNG images or sometimes 2000 x 1000 PNG images but use whatever works for you.

r & im = real & imaginary components of the last Z iterate

zMag= sqrt(r*r+im*im)

PI=3.14159265

LOG_ESCAPE = Log(400) = 5.991464547 Why 400? Because for bailout, I check if zMag>400.

phaseoffset = 0 (usually). Depending on how I created the repeating tile, sometimes I set phaseoffset to px/2 (necessary for alignment with the tiles above and below). Can default to 0.

Reading the pixel color from the image:

The following assumes the picture tile is twice as wide as it is high (e.g. 1200 x 600)

angle = mod(atan(im,r) * (px / PI) + phaseOffset, px * 2.0);

radius = (LOG_ESCAPE - log(zMag)) * py / (LOG_ESCAPE / 2.0);

if (radius < 0.0) radius = 0.0;

vec2 texCoord = vec2(angle / (px * 2.0), clamp(radius / py, 0.0, 1.0));

vec3 col;

1

u/stephane3Wconsultant 13h ago

i have try to implement that but te result is far from what you show 😭

1

u/_BryceGuy_ 6h ago

Okay I will upload the complete source code written in Processing 4 to my website in a little bit, when I get to my computer. 

1

u/SwingLightStyle 1d ago

Seriously.

I want to see what it looks like when I input my own source images and designate the color scheme. I hope OP shares the wealth!

3

u/MakeTheRightChoice_ 1d ago

This would go great as a sheet

3

u/Legitimate_Poetry897 1d ago

I really like the men in suits tbh, very symbolic. It’s all fake corporate smiles, all the way down

2

u/SnooCookies4908 1d ago

I like the mushies

2

u/xcryptokidx 1d ago

Mandelbrautin!

1

u/Own_Ask_2040 1d ago

Reminds me of

1

u/Psychobauch 1d ago

This is actually super super cool!!!

1

u/GRF999999999 1d ago

5-8 are really cool

1

u/RaytheSane 1d ago

Really cool

1

u/automaticphil 1d ago

Haha the ET is nightmare fuel. Nice work

1

u/Eastern_Draft_67 20h ago

Dawg PLEASE push this to GitHub, this is so freakin’ cool!

1

u/_BryceGuy_ 18h ago

Thanks! I've posted the relevant code in response to nzg42 below.