Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

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?


You 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.


I'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.


Mark 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

He gives it as a talk, but you have to sign up with NVIDIA: https://developer.nvidia.com/siggraph/2020/video/sig03-vid


Ah, 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.


Kind of what Slug does: http://sluglibrary.com/




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: