3 ms·
A possibly dumb question. GPUs are really, really good at rendering triangles. Millions of triangles per second good. Why not convert a vector path into a fine
by grishka 4y ago
A possibly dumb question. GPUs are really, really good at rendering triangles. Millions of triangles per second good. Why not convert a vector path into a fine enough mesh of triangles/vertexes and make the GPU do all the rasterization from start to finish instead of doing it yourself in a pixel shader?
- jakearmitage 4y agoKind of what Slug does: http://sluglibrary.com/ http://sluglibrary.com/
- bsder 4y agoMark Kilgard from NVIDIA has been beating this drum for a couple decades. It's not simple. His latest paper is about how to handle stroking of cubic splines: https://arxiv.org/abs/2007.00308 https://arxiv.org/abs/2007.00308 He gives it as a talk, but you have to sign up with NVIDIA: https://developer.nvidia.com/siggraph/2020/video/sig03-vid https://developer.nvidia.com/siggraph/2020/video/sig03-vid
- Lichtso 4y agoAh, polar stroking, a really clever tick to sample a curves vertices where it matters and guarantee a uniform tangent angle in between the samples. I actually implemented that (but using complex numbers instead of angles) in my renderer.
- Jasper_ 4y agoYou can do that, except now you've moved the bulk of the work from the GPU to the CPU -- triangulation is tricky to parallelize. And GPUs are best at rendering large triangles -- small triangles are much trickier since you risk overdraw issues. Also, typical GPU triangle antialiasing like MSAAx16 only gives you 16 sample levels, which is far from the quality we want out of fonts and 2D shapes. We don't have textures inside the triangles in 2D like we do in 3D, so the quality of the silhouette matters far more. That said, this is what Direct2D does for everything except text.
- FpUser 4y agoI've used Direct2D and DirectWrite to render vector graphic and text (basically various HUD displays) in one of my products ( game like application) and was overall happy with the quality / performance.