Follow

Thanks to , I'm learning how to do 2d SDFs... in 1-bit color. It's only been about an hour or so, but the results are very very promising so far!

Once again, Inigo Quilez is a fantastic resource[0]. All I'm doing is plugging in numbers. Though, instead of shader code, I'm using straight up C code with my 1-bit drawing library [1]. It's been interesting converting all the implicit vector operations to vanilla C functions. It's one of the few situations where I miss operator overloading.

0: iquilezles.org/www/articles/di

1: pbat.ch/wiki/btprnt/

· · brutaldon · 2 · 1 · 3

Couldn't resist trying to play with color. I managed to work in a hack that for all intents and purposes seems to do anti-aliasing without oversampling.

Show thread

Composing SDFs together is very satisfying. Looking forward to controlling these things with sound/signal.

Show thread

@paul the trick, as i worked out in my own head while talking @selfsame through it, is the function you sample has gradients between edges that are exactly 1 pixel thick anywhere on the screen. this, by chance, happens to result in point samples that are more or less the same as what you’d get by super sampling at high resolution, so it feels like getting anti-aliasing for free.

@paul to state it in the opposite direction, an anti-alised pixel should represent the percentage of coverage by the shape over the pixel. if you want the correct values to appear underneath your point samples, the “filter” function just happens to be 1 pixel wide gradients around every hard edge, which just happens to be trivial to get with sdf. (though it gets more complicated once you involve perspective texture projection and gamma correction)

@paul

> It's one of the few situations where I miss operator overloading.

oh yeah shader programming will do that to a person ;)

@s_ol and computer graphics programming in general. It's basically all vector and matrix operations. It was a bit of an adjustment for me. Audio DSP programming has little to none of that, so it is easy to get away with just C code.

Sign in to participate in the conversation
post.lurk.org

Welcome to post.lurk.org, an instance for discussions around cultural freedom, experimental, new media art, net and computational culture, and things like that.