Live data from Hacker News

Rasterizer: A GPU-accelerated 2D vector graphics engine in ~4k LOC

github.com

31–40 of 58 posts

Re: Rasterizer: A GPU-accelerated 2D vector graphics engine in ~4k LOC

#32
post #6

Congratulations! Can you say how the it's similar and how it's different to superficially similar sounding work? (1) https://github.com/linebender/vello , dual Apache/MIT, by Raph Levien et al (2) https://sluglibrary.com/ , proprietary, by Eric Lengyel (Terathon)

Slug is primarily designed for text rendering. Vello is general purpose, like Rasterizer, but is based on GPU compute. Rasterizer uses the 'traditional' GPU pipeline. Performance numbers for both look very competitive, although Vello seems to have issues with GPU lock up at certain zoom scales. Rasterizer has been heavily tested with huge scenes at any scale.

Thank you very much for that concise explanation.

Re: Rasterizer: A GPU-accelerated 2D vector graphics engine in ~4k LOC

#33

Earlier quoted context omitted.

None of that yet. The underlying SVG library, nanosvg, is very simple with no text support. The first priority was to solve paths to pixels efficiently, including text (50,000 glyphs @ 60fps). Gradients will be added when time allows, as I have code from a previous engine. The coverage algorithm can be extended to support cheap box blurs, which could be used for drop shadows.

Ah ok cool! So what path to this being used in applications do you have in mind? Are you hoping to implement a decent part of the spec in the coming years? Do you have a rough timeline?

Rasterizer excels at animation and complex scenes, e.g. 2D CAD documents. The original inspiration was Flash, as I love innovative design tools. Flash 1.0 could easily be used by designers, but ultimately lost its way became a coder's toy after the Adobe acquisition and ActionScript 2.0.

Fleshing out the spec is planned, but I cannot provide a timeline as this has all been done at my own considerable expense. Maybe if my tips grow: https://paypal.me/mindbrix

Re: Rasterizer: A GPU-accelerated 2D vector graphics engine in ~4k LOC

#35
post #24

Nice work, without having looked at your particular shader code, I can only imagine the horrors and countless of hours that went into writing and debugging the shader code... Which OpenGL and GLSL versions are you targeting? I've been thinking about possibly prototyping integrating an SVG renderer into my game engine that would rasterize the textures from .svg files on content load. Would offer some benefits of impro…

Thanks, you imagine correctly ;-)

The current version uses Metal. I haven't even considered GPU ports yet, as my methodology is to get it working well on one platform first.

For single-pass SVG --> texture, a CPU approach would probably offer the lowest latency. For repeat passes, the GPU would probably win.

Re: Rasterizer: A GPU-accelerated 2D vector graphics engine in ~4k LOC

#37
post #29

This looks juicy! :) @mindbrix does it blend colors in linear space/are colors linearized internally?

Once you do color space correct color mixing you realize that people actually expect the wrong result, i.e. the result you get from mixing in sRGB and then you have to make the rendering output visually more "correct" by making it incorrect. One of the cases where the correct computation is the wrong answer. Heck, that's what people expect with CSS for example.

My reference renderer has been Core Graphics. If it looks like CG I assume it's OK - and if it's not OK I'm in good company ;-)

You can switch between CG and Rasterizer in the demo app using the 0 key to see the difference for yourself.

Re: Rasterizer: A GPU-accelerated 2D vector graphics engine in ~4k LOC

#38
Maybe its me and I am more than okay but I went into a whole license rabbit hole trying to figure out the license that it uses

It uses this "personal use zlib license" And So earlier it was actually licensed under the zlib license which I think of as in something similar to the MIT license (I think, I am not a lawyer)

My issue with this is that the personal use zlib license to me feels like its made up by the author, and that you need to contact the author for a commerical license?

At this point, he should've just used something like a dual license with AGPL + commerical license.

Honestly, I get it, I also wish that there was some osi compliant that made open source make sense as a developer as open source is a really weak chain in this economy and I get it, but such licenses basically make your project only source available.

I have nothing wrong with that and honestly just wanted this to be discussed here. I had a blast looking at all the licenses in wikipedia or opensource.com website. Artistic license seems really cool if you want relicense or something. I am looking more into it. I genuinely wish if something like sspl could've been considered open source as it doesn't impact 90% of users and only something like aws/big tech.

Re: Rasterizer: A GPU-accelerated 2D vector graphics engine in ~4k LOC

#39

Interesting, how does this comparento the Rive renderer?

I can't really answer that in detail yet. I suspect Rasterizer will be faster for complex scenes.

Thanks for the answer. You could make it render a rive asset for one-on-one comparison. ;)

Re: Rasterizer: A GPU-accelerated 2D vector graphics engine in ~4k LOC

#40
post #6

Congratulations! Can you say how the it's similar and how it's different to superficially similar sounding work? (1) https://github.com/linebender/vello , dual Apache/MIT, by Raph Levien et al (2) https://sluglibrary.com/ , proprietary, by Eric Lengyel (Terathon)

Slug is primarily designed for text rendering. Vello is general purpose, like Rasterizer, but is based on GPU compute. Rasterizer uses the 'traditional' GPU pipeline. Performance numbers for both look very competitive, although Vello seems to have issues with GPU lock up at certain zoom scales. Rasterizer has been heavily tested with huge scenes at any scale.

Stupid question: Why not use the hardware (fixed function) rasterizer inside the GPU? I guess that one is only optimized for triangles.
Post reply on HN