5 ms·
> the other is lines, curves, thickness, gradients, and fonts You can reduce all these to drawing triangles.
by chrisseaton 6y ago
> the other is lines, curves, thickness, gradients, and fonts
You can reduce all these to drawing triangles.
- deleted 6y ago[deleted]
- Jasper_ 6y agoDoing that reduction is surprisingly difficult, and usually a serial algorithm that runs on the CPU, and a naive approach is a resulting triangle set is not efficient to a GPU, but that's what toolkits like cairo, Direct2D, nanovg do. Raph is describing an architecture where path evaluation happens on the GPU, without being baked to triangles.
- raphlinus 6y ago> You can reduce all these to drawing triangles. You can, people have tried this, and it sucks. The main problem is that the conversion of Bézier paths to triangles is a hard problem with lots of conditional branching. Even when you do it, there is the other problem of rendering triangles with really good antialiasing, MSAA forces a compromise between performance and quality. By contrast, piet-gpu does an exact-area calculation for antialiasing. So it's not a question of whether you can do it, but whether it works well, and approaches like piet-gpu absolutely stomp triangles.
- Const-me 6y ago> there is the other problem of rendering triangles with really good antialiasing Easier than you think. Here's couple lines of pixel shader that does that, with really good antialiasing and without MSAA: https://github.com/Const-me/Vrmac/blob/master/Vrmac/Draw/Shaders/drawPS.hlsl#L116-L143 https://github.com/Const-me/Vrmac/blob/master/Vrmac/Draw/Sha...
- dungdang 6y agoyes, you can draw 2d in 3d space. this thread however is about 3d being built on top of 2d. not 2d being built on top of 3d.