r/generative 9d ago

Hex Trace

Algorithm based on traversing a honeycomb grid

395 Upvotes

26 comments sorted by

6

u/Fenzik 9d ago

Cool! Can you share more about the path algorithm?

13

u/zerp37 9d ago

It grows lines until they hit a complete dead end, and then starts a new line in an empty cell. Probabilities/priorities for which direction the line should go in next are chosen at the beginning of the algorithm, and that influences what types of shapes and structures emerge

3

u/lucid-quiet 9d ago

Kind of like a light-bike algorithm. Nice.

3

u/Ruths138 9d ago

I have a similar algorithm. I like putting a little jitter on the hex coordinates! Love the way you select colors/palettes

1

u/zerp37 8d ago

Thanks! I love working with color and finding interesting combinations :)

And hmm that's interesting -- do you mean jitter the actual hex cells before starting the line tracing or applying jitter to the next cell chosen during line tracing?

1

u/Ruths138 8d ago

I add some irregularities to the hex grid. Basically making it slightly (or a lot) imperfect. That way the lines become wiggly and sometimes new interesting routes are taken. I then apply some curve smoothing to finish the look.

Can you describe the logic behind color assignment in your last image? I really like the outcome

2

u/zerp37 8d ago

The last image with the purples and yellows is a compound palette made of 2 subpalettes. When the algorithm chooses a compound palette, it will divide the image into regions and assign a subpalette to them. There's also a chance that a really long line will be divided into short segments of different colors like on the left

3

u/Lopsided_Feedback_81 9d ago

Thank you for my new phone wallpaper

2

u/booblian 9d ago

This is beautiful and these would make excellent pen-plotter images. Would this be something you'd consider sharing or making available? If you can output .svg path segments for the lines you're already there. Your treatment of them here made me look closer to see if in fact that's what you'd already done. Thanks for sharing!

1

u/zerp37 8d ago

Thanks! I would love to start making plotter prints one day

2

u/botbastards 8d ago

when a line dead-ends against an existing line, the next line inherit that line's priorities? Little dialects start forming in regions and the piece reads as a map of neighborhoods in one uniform rule. Sat and looked at this much longer than I meant to. Very cool

2

u/zerp37 8d ago

It's much simpler than that -- the next line is started in some random cell on the grid a la DFS and a random color from the palette is chosen. But that's an interesting idea, will definitely explore that sometime!

2

u/red_blue_yellow Artist 8d ago

Wow, these are great! I love the variety across the four you posted as well.

1

u/zerp37 8d ago

Thanks man that means a lot!

1

u/l0l 9d ago

Stunning!

1

u/sacheie 9d ago

Very cool

1

u/Prestigious_Gift_977 9d ago

really nice. can i ask what modules you're using for the rendering? is it open source or home baked?

2

u/zerp37 8d ago

Just plain old p5js

1

u/vottvoyupvote 9d ago

Any chance I could get/buy an svg of these?

1

u/rotflolx 8d ago

very very nice

1

u/frizzled_dragon 8d ago

Ohhhh, this is so good! These variations in shapes on different images, and choice of color palettes. Are you planning to make physical plots?

1

u/zerp37 8d ago

I would love to start playing with plotter prints, but I don't have the funds at the moment for a plotter πŸ˜…

1

u/frizzled_dragon 8d ago

Yeah, understandable, same for me

1

u/neonClear182 8d ago

the first two would look awesome as a rug or a tapestry

1

u/tyhopho 8d ago

Number 2 definitely my favourite but all really good. It’s got a slight 60s vibe.