Over the last few weeks, this interest has finally spiralled into an attempt to develop a renderer of my own. I've come up with a design which seems promising, but I do have one question for which I haven't yet found a good answer:
It seems to be common wisdom that 16xMSAA has unacceptable quality for 2D rendering. In practice, though, I'm struggling to find any test-cases where I can differentiate 16xMSAA from 256-shade analytical AA with the naked eye. The only exception has been fine strokes (e.g. downscaled text, or the whiskers on this Ghostscript tiger [0]), which tend to "shimmer" or "sparkle" as they move. Does MSAA have any other common failure modes that I should be aware of?
I didn't invent the Cairo trapezoidal algorithm, I think that was mostly Carl Worth, maybe Keith Packard, but I certainly did do one of the earliest analytical area algorithms in the free software space, which I know inspired other work. It's been quite a ride, I went back and looked at my early work[1], and thought it was impressive that I could render the tiger in 1.5s. Now I'm seeing times in the 300µs range on discrete graphics cards.
16xMSAA is pretty good, and I would say is definitely good enough for most vector art. I consider it not quite good enough for text scaling, and anything less than 16x not acceptable. Desktop cards shouldn't have much trouble with it, but mobile devices might not be capable of it or able to deliver adequate performance.
Of course the upside of MSAA is that it's much easier to solve conflation artifacts, so I imagine we'll end up with some variant of it in additional to the analytical AA; and the latter will continue to be used for almost all glyph rendering.
I’m excited to see results of innovation in this area, but the fact that he (and others like pcwalton, nical, etc) are making things like incremental updates and blog posts with supporting images and pseudo code available to us is just fantastic.
Thank you, Raph. I’ve had so much fun exploring your work on font-rs, and on Piet. I hope one day I’ll be able to move past tinkering and actually pitch in and help, thanks to your fantastic write ups and docs.
Took me a while to realise that this was just a name clash! Doh.
it's an abstraction of common 2d vector graphics libs.
https://en.m.wikipedia.org/wiki/Piet_Mondrian
My post wasn’t to complain about the name collision though. I don’t see an issue with the name being shared like that as they’re occupy similar but distinct domains. I just thought I’d share my confusion in case it entertained anyone.
I'm openly embracing the fact that piet-gpu is advanced research into not just 2D rendering, but parallel algorithms and also GPU infrastructure. The fact that it's doing advanced compute portably is not something a lot of other projects can claim. Unfortunately, it adds constraints and makes the code more difficult than it would be if it were targeting a single GPU.
So, feel free to ask questions, and I'll do my best to answer them. Education is part of what I'm trying to do, and I'd like to put together more resources for understanding both piet-gpu and also compute shader programming more generally.
Background: This actually seems related to a pet project of mine, tinkering with graphics rendering on an FPGA. An application-side 2D renderer would be very interesting to me to better understand the application side of it, when building the hardware side. Especially when it is a renderer that uses a presumably modern approach of using shaders for everything, making the hardware side insanely flexible, and because there are already plenty of other renderers to understand a static rendering pipeline.
this project seeks to draw vector graphics directly using gpu.
Does this project assume any other operating system level infrastructure? If so, which OS -- Linux, Windows, BSD, ...?
Vulkan is simply the lowest-level approach currently available among the major APIs. Piet is an example of a rendering engine that stands on top of Vulkan: it still needs application code to be a complete renderer, but it provides higher level abstractions that speak in the desired domain language(shapes, vector data, etc.).
this paper explains it well
https://w3.impa.br/~diego/projects/GanEtAl14/
Or the OP's earlier blog post
https://raphlinus.github.io/rust/graphics/gpu/2019/05/08/mod...
Regarding hardware support, it needs a GPU capable of compute shaders (which rules out a bunch of the older or very low end mobile chips). There is a hardware abstraction layer which currently supports Vulkan, Direct3D12, and Metal, but I believe D3D11 could be added, as well as other lower level interfaces (I took a look at deko3d and was tempted to use that as a way to port to Nintendo Switch).
https://github.com/linebender/piet#backends
https://github.com/linebender/druid/tree/master/druid-shell/...
Would this somehow help improving Chrome's rendering performance? Right now Chrome has massive performance issues with rendering very large SVGs (zoomed in SVGs) and I am convinced that clipping could dramatically improve this.