Rather, vector graphics on GPU is hard because GPUs don’t know how to draw filled *polygons*. That’s because fill rules are inherently sequential: whether a pixel is filled depends on every pixel before it in the scanline.
-
Show this thread
-
Replying to @pcwalton
(Signed) distance fields are a different way of approaching this. Fill a pixel where distance is negative, small distances are used for anti aliasing by eg making the edges fade to transparency. They have different problems though, not a panacea :)
2 replies 1 retweet 2 likes -
Replying to @Atrix256
Yeah, I addressed SDF in the next tweet: drawing the SDF is essentially equivalent to drawing paths on CPU.
1 reply 0 retweets 1 like -
Replying to @pcwalton
Oh sorry i was talking about continuous SDFs, like not made into a texture. A pixel is able to take a discrete sample of the continuous SDF and reconstruct.
1 reply 0 retweets 1 like -
Replying to @Atrix256
Oh, you mean something like constructing a voronoi diagram for edges and encoding distance to edge in each voronoi region?
1 reply 0 retweets 0 likes -
Replying to @pcwalton
Like mathematically defining some 2d shapes, possibly doing domain distortion (modify x values in strange ways), using modulus to repeat the shapes, and operations to combine the influence of multiple distance fields. Its not good for drawing text, but lemme grab a shadertoy rq.
2 replies 0 retweets 2 likes -
Replying to @Atrix256
Ah, I see, that’s cool! Not really relevant for <canvas>/SVG/text which are all about beziergon meshes though
1 reply 0 retweets 0 likes -
This looks relevant: https://www.shadertoy.com/view/Mlj3zD Compute SDF from bezier, evaluate per pixel.
2 replies 0 retweets 2 likes -
I don't know if you've seen this, worth a read through just for enjoyment tbh: http://www.iquilezles.org/www/material/nvscene2008/rwwtt.pdf … Basically shows how to combine analytic SDFs to generate very complex shapes. Author has many examples here https://www.shadertoy.com/user/iq
1 reply 0 retweets 0 likes -
So it seems maybe plausible that you could do this for 2D... Basically generate HLSL/GLSL for analytic composition of all the shades, run per pixel (perhaps cache in texture).
1 reply 0 retweets 0 likes
Problem is you still have compute the winding numbers in the first place, which is inherently sequential no matter how you slice it. Lots of algorithms that claim to solve it have a hidden O(n^2) in there: for example, stencil buffer, or Slug…
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.