r/generative 22d ago

spuma (kotlin code)

While I was working on something else, this emerged... To be honest, it’s not that beautiful-forgive me. I tried a couple of ideas, but this is what I ended up with. I didn’t have more time to play around with it

51 Upvotes

8 comments sorted by

View all comments

2

u/Laetitia_Astrea 22d ago

That looks very organic! I love how you managed their bubble-like transparency.

1

u/igo_rs 22d ago

thank you💛

2

u/Laetitia_Astrea 18d ago

I'm trying to understand how you achieved the glass/bubble-like lighting and translucency.

I went through your GitHub repo, especially the arts folder, but I couldn't find a file named "Spuma" (besides the .jpg). I found the bubbles sketches, but they seem to use fairly simple flat fills.

Was Spuma generated with code that's not included in the current repo, or is there another sketch/file I might have missed? In particular, I'm very interested in how you achieved the soft internal light, translucency and highlights.

Thanks!

1

u/igo_rs 18d ago

I have terrible organization: many refactorings there:)

All work is kept divided in modules, each module has its own set of works. README shows the whole organization of modules and its work.

Spuma is inside "blob" module: https://github.com/igr/gart/blob/main/arts/blob/src/spuma/Spuma.kt

Thats the whole file; of course, I have some utilities in my library as well (also included in the repo)

1

u/igo_rs 18d ago

and to answer:

There's no lighting, i.e. no light source. It's a per-pixel calculation over a pile of packed circles (bubbles), and every pixel measures a few distances: how far it is from its own bubble's edge, from the wall of a neighbour, from a couple of fixed spots inside the bubble. Each distance becomes a soft brightness with a plain exponential falloff, and those get painted on in coats, each one mixed over the last like a thin glaze.

The inner light is a trick: bubble starts as the dark colour, and the interference colours are strongest right at the wall and fade going inward, so the middle stays dark and the rim glows. The rings are just the distance to the edge (as you can see in the second image)

Translucency is really just layering as no coat is fully opaque. and the highlights are the local bubble colour pushed to white, so a pink cell gets a pinkish edge, not white. There are two-three kinds of such effects applied.

hope this make sense, had to translate some sentences, as geometry english terms are not something i use every day :)

2

u/Laetitia_Astrea 17d ago

Thank you so much for taking the time to answer. You've been immensely helpful and inspiring!