Better HN
topnewbestaskshowjobs
Log inSign up

mindbrix

192 karma · joined Mar 16, 2020 (6y ago) · 30 submissions

Submissions

comment 1y ago · link · parent

Ruffle is cool. From pixel inspecting the demo, it looks like they are using triangle fans with stencil & cover + MSAA, which was how I started!

comment 1y ago · link · parent

The depth buffer is used for opaque path interiors.

comment 1y ago · link · parent

My original target was iOS, so this was unavailable. I did experiment with their algorithm, but 4x MSAA was slow and had poor quality compared to Core Graphics, which was my reference.

comment 1y ago · link · parent

My email address is in every file ;-)

comment 1y ago · link · parent

Drawing cached renders in quads is how Core Animation works, but they do not scale well. You are ultimately limited by the CPU. Rasterizer enables a fully-animated canvas @ 60fps.

comment 1y ago · link · parent

The longer answer is that using straight-edged geometry to represent curves is a resolution-dependent operation, e.g. a full screen circle may need to be flattened to an 80-sided polygon.

Rasterizer can solve quadratic curves in the fragment shaders, which massively reduces the geometry needed for a scene.

Also, the native rasterizer only supports MSAA, which is inferior to reference analytic area AA.

comment 1y ago · link · parent

Good question and answer ;-)

comment 1y ago · link · parent

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.

comment 1y ago · link · parent

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.

comment 1y ago · link · parent

Thanks. I couldn't really say without doing proper research.

comment 1y ago · link · parent

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

comment 1y ago · link · parent

The Rasterizer algorithm handles self-intersecting paths without issue. Removing them requires expensive and complex computation geometry.

comment 1y ago · link · parent

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

comment 1y ago · link · parent

No magic, just 10+ years of experimentation and optimisation.

comment 1y ago · link · parent

Linear at present.

comment 1y ago · link · parent

The "traditional graphics pipeline" approach was chosen to maximise the platforms Rasterizer could run on, as GPU compute support at the time was patchy. Compute is now more universal, so Rasterizer could move that way.

SDFs are expensive to calculate, and have too many limitations to be practical for a general-purpose vector engine.

comment 1y ago · link · parent

Winding numbers are easy to explain, but hard to compute efficiently: https://en.wikipedia.org/wiki/Winding_number

comment 1y ago · link · parent

The core problem is path winding: https://en.wikipedia.org/wiki/Winding_number

Paths can be any size, and the problem is hard to parallelize. GPUs like stuff broken into small regular chunks.

TestFiles/Manchester_Union_Democrat_office_1877.svg is composed of a single huge path, which was a great torture test.

comment 1y ago · link · parent

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.

comment 1y ago · link · parent

No. I'm hoping someone else will do that ;-)

comment 1y ago · link · parent

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.

comment 1y ago · link · parent

Hi Steve. Yes, it is! 10+ years in the making.

comment 1y ago · link · parent

Thanks for the feedback. I will work on one.

comment 1y ago · link · parent

I've been working on this problem on and off for over 10 years.

AMA ;-)

25.

Rasterizer: A GPU-accelerated 2D vector graphics engine in ~4k LOC(github.com ↗)

169 points · by mindbrix · 1y ago · 56 comments

comment 1y ago · link · parent

The WebGL antialiasing quality looks poor compared to the software renderer. It could be using MSAA instead of full analytical AA.

I had to use Chrome to test it, as the viewer doesn't play on Safari.

https://thorvg.github.io/thorvg.viewer/

comment 6y ago · link · parent

I'd like to humbly suggest that Rasterizer may have extended the state of the art of 2D GPU-accelerated rendering: https://twitter.com/Vector_GL/status/1214507005316128768

comment 6y ago · link · parent

Many thanks! Fixed.

29.

Concentrichron: A clock and calendar made of concentric rings(twitter.com ↗)

184 points · by mindbrix · 6y ago · 73 comments