Mikko Mononen

@MikkoMononen@mastodon.gamedev.place
173 Followers
65 Following
62 Posts

Coder and woodworker. Author of Recast&Detour and NanoVG. Previously at Epic Games, Unity, Tinkercad, Crytek, demoscene.

https://github.com/memononen

@floooh Do you have recommendations for tagged unions in C API?

I have a case in skribidi (styling https://github.com/memononen/Skribidi/issues/49#issuecomment-2973298601) which is a good fit for tagged union.

I did see that you reverted some union use in Sokol in a "bindgen preparations" CL way back in 2020. Smells like a minefield for language interop?

In my case I would be fine having a function for initializing the whole struct, or having a getter function to poke the specific struct out. Sort of opaque value struct :)

Text underline support · Issue #49 · memononen/Skribidi

It would be nice if skribidi supports text underline (and I guess strikethrough would be a trivial addition if underline already exists ...)

GitHub
Is there a way to run github CI from the desktop app before push?

I have been researching and working on a text stack good part of this spring.

It is called Skribidi, and it can do bidirectional text layout, rendering and editing.

It has fairly lean dependencies and is MIT licensed.

https://github.com/memononen/Skribidi

It kinda started as a self help project trying to deal with weltschmerz and burnout. I needed something the felt even mildly meaningful and complex enough that I could hyper focus on details.

Any feedback welcome!

GitHub - memononen/Skribidi: Nimble bidirectional text stack for UIs

Nimble bidirectional text stack for UIs. Contribute to memononen/Skribidi development by creating an account on GitHub.

GitHub

I have been working on linear sRGB blending recently (mostly logging my progress on bsky).

I came up with this, which fixes darkening issue of direct sRGB blending, and thinning/gradient-skewing of linear sRGB blends:
https://www.shadertoy.com/view/XXGfW3

I dont know exactly why it works as well as it does, but I like it. I'm sure it can be all boiled down to some offsetting and scaling and a cubic root :)

If someone has experienced the same rabbit hole, I would be interested to hear your stories.

Y'all want to see a cool shader?

https://www.shadertoy.com/view/dls3Wr

This is mashing up two ideas:

- @iquilezles@twitter.com's closed-form "signed distance to a quadratic Bézier curve" solver
- using winding number to determine inside/outside-ness

Putting these two ideas together, we can render a Bézier font from its raw control points, as a single (huge) closed-form math expression!

alright one more restructure~

this time it controls like the quadratic bézier spline! so you can make sharp corners if you want

mirroring the tangent points makes it C∞ instead of the C1 you'd get with the quadratic bézier

×

Y'all want to see a cool shader?

https://www.shadertoy.com/view/dls3Wr

This is mashing up two ideas:

- @iquilezles@twitter.com's closed-form "signed distance to a quadratic Bézier curve" solver
- using winding number to determine inside/outside-ness

Putting these two ideas together, we can render a Bézier font from its raw control points, as a single (huge) closed-form math expression!

@mjk but why
@chengdulittlea I've got a big hammer (a fast evaluator for closed-form implicit surfaces), and want to turn as many problems into nails as possible.
@mjk huh how do you get from an sdf to a winding contribution? And why do you need a winding number anyway--can't you just take the minimum under magnitude of all the distances?

@moonchild

Each quadratic contributes to the winding number based on whether we're inside or outside the quadratic (lines 180-185).

I encourage you to try taking the minimum under magnitude; I found that it didn't handle concave shapes correctly.

@mjk Here—quickly hacked up, and has some obvious robustness issues (which is to be expected with this kind of renderer), but otherwise appears to cope fine with the concave sections.

@moonchild

Here's an quick counter-counter example:

https://www.shadertoy.com/view/dls3WN

It's not robustness issues, it's the equivalent of z-fighting between the two curves when they have similar (absolute) magnitudes.

@mjk Is this what the slug library does?

@msk I'm not sure; it's been a while since I looked over their docs.

This strategy is quite inefficient, but has the advantage that you can throw the equation into a general purpose f-rep renderer (of which I have several!)

@mjk this is really, really cool!
@mjk You were so preoccupied with whether you could, you didn't stop to think if you should.
@mjk having dealt with the (literal) corner cases of shader-based signed distances in font rendering, this is definitely a tempting (if, I'm sure, speedy) idea
@mjk Dammit autocorrect "fixed" "spendy"
@JoshJers You can edit here! 😆
@ackack Yeah I just couldn't figure out how to do it from the Metatext app and I was too lazy to look 😁
vger/sdf.h at f22b38efd4418a865a5146541db40a872903a4e4 · audulus/vger

2D GPU renderer for dynamic UIs. Contribute to audulus/vger development by creating an account on GitHub.

GitHub

@tayholliday Interesting, I'll have to take a look!

If you're interested in vector graphics on the GPU, I'd strongly endorse https://xi.zulipchat.com – I've picked up a lot from lurking and chatting with folks about what they're working on!

@mjk @tayholliday We definitely see Taylor on xi.zuplchat.com, though he is often quiet in the public channels. In any case, always happy to have more people from the broader Rust 2D graphics and GUI communities.