352 karma · joined October 28, 2020
https://minus-ze.ro
You can contact me at: alexi@minus-ze.ro
What you are proposing is valid, however the “checking each intersection” part is far from a simple one. It's difficult enough with polygons only, but the input can have Bézier curves too. I highly doubt everything would amount to Log(n) - after all Skia already does something similar to what you're saying, unless I'm misunderstanding.
The bigger surprise for me was that the path builder is slower than doing divide and conquer, given that it's optimized for doing union on everything.
> Sometimes it would help to read a book or consult someone more knowledgeable though.
I'd be happy to receive suggestions!
> kerning, ligature replacement, combining diacritical mark placement, and character composition. Slug also supports a number of OpenType features that include stylistic alternates, small caps, oldstyle figures, subscripts, superscripts, case-sensitive punctuation, and fractions.
Probably still uses the CPU.
Shaping is different compared to rendering glyphs themselves. SDF renderers (and other GPU text renderers like Slug) still do shaping on the CPU, not in shaders. Maybe some experiments have been done in this area, but I doubt anyone shapes text directly in the GPU in practice.
Think of it like a function that takes text as input, and returns positions as output. Shaders don't really know anything about text. Sure you could probably implement it if you wanted to, but why would you? I think it would add complexity for no benefit (not even performance).
Even if you already have a GPU renderer for glyphs and any other vector data, you still want to know where to actually position the glyphs. And since this is highly dependent on the text itself and your application state (that lies on the CPU), it would actually be pretty difficult to do it directly on the GPU. The shader that you would want should emit positions, but the code to do that won't be easily ported to the GPU. Working with text is not really what shaders are meant for.
That being said, SVG allows you to create quite beautiful and complex effects with relatively little code.
Also, keep in mind that I did not mean to implement something better than what Flash did. It's merely an extension to the kind of morphing the browsers already offer.
When researching about this, I didn’t find a lot of writing. Macromedia definitely had this a long time ago, but I don't think you can look up how it was implemented. Not to my knowledge, at least.
Do you have an example of the algorithm you describe? Or a more detailed explanation? I don't quite get how it would work from what you've described.
I know there are plenty of alternatives, but I personally benefit a lot more from a dead simple web page, that does everything locally. It also helps with burnout, I like building very simple, but useful things (at least for myself).
I also have plans for a more serious project though. For a long time now I've been writing down what I would want from a ShaderToy-like website but for SVGs. I feel like there's a lot of potential in making it easy to create and reuse amazing animations with very little code.
I've also seen a lot of people praise the React + SVG combo and I can see why. I'd personally love an environment that I could just spin up instantly, create paths interactively, then create some effects quickly, and then use them wherever I want.
- Kaitai [1], which takes as input a YAML file and can parse binary files based on it (and even generate parsers).
- ImHex [2], which has a pattern language [3] which allows parsing, and it seems more powerful than what Kaitai offers. I stumbled upon some limitations with it but it was still useful.
[1]: https://kaitai.io/
With so little documentation it's hard to know exactly how it works, but I am curious if its architecture is similar to: https://raphlinus.github.io/rust/graphics/gpu/2020/06/13/fas...
And yes, the number of triangles doesn't really make a difference in general, but in Slug's paper they say:
"At small font sizes, these triangles can become very tiny and decrease thread group occupancy on the GPU, reducing performance"
I'm not experienced enough to say how true that is/how much of a difference it makes.
> If I understand correctly the second link is basically an extension of Loop-Blinns implicit curve approach with vector textures in order to find the winding counter for each fragment in one pass.
I've read the paper, but to be honest it's a bit over my head right now, but AFAIK MPVG is an extension to this [1], which looks like it's an extension to Loop-Blinn itself, so I think you're right.
[1] "Random-Access Rendering of General Vector Graphics" http://hhoppe.com/ravg.pdf
[1] "GPU-Centered Font Rendering Directly from Glyph Outlines" http://jcgt.org/published/0006/02/02/
[2] http://w3.impa.br/~diego/projects/GanEtAl14/
[3] http://kunzhou.net/zjugaps/pathrendering/
EDIT: I've only now seen that [2] and [3] are already mentioned in the article
EDIT2: To compensate for my ignorance, I will add that one of the authors of MPVG has a course on rendering vector graphics: http://w3.impa.br/~diego/teaching/vg/
[1] "GPU-Centered Font Rendering Directly from Glyph Outlines" http://jcgt.org/published/0006/02/02/
[2] https://twitter.com/EricLengyel/status/1190045334791057408