Stanford CS248: Implement an SVG Rasterizer
1–10 of 82 posts
Re: Stanford CS248: Implement an SVG Rasterizer
#2Re: Stanford CS248: Implement an SVG Rasterizer
#32d graphics are kinda hard. The problem is that gpus don't support them out of the box so you have to do a Lot yourself.
For an example of a rasterizer, you can take a look at my pure JS implementation of canvas (which is roughly the same imaging model as SVG). All lines and shapes are flattened into a pure line polygon, then drawn with a scanline rasterizer. Getting the basics working is fairly easy. Handling the endless edge cases, however.... :)
Re: Stanford CS248: Implement an SVG Rasterizer
#42d graphics are kinda hard. The problem is that gpus don't support them out of the box so you have to do a Lot yourself.
I assume the point is that you have to implement a pure software rasterizer. It's not actually that difficult, but it feels like a lot for an undergrad who's not familiar with the space. I assume this is done as part of a class that gives you context. For an example of a rasterizer, you can take a look at my pure JS implementation of canvas (which is roughly the same imaging model as SVG). All lines and shapes are fl…
You have to do things like stencil texture to speed things up etc etc.
Re: Stanford CS248: Implement an SVG Rasterizer
#52d graphics are kinda hard. The problem is that gpus don't support them out of the box so you have to do a Lot yourself.
Re: Stanford CS248: Implement an SVG Rasterizer
#6Earlier quoted context omitted.
I assume the point is that you have to implement a pure software rasterizer. It's not actually that difficult, but it feels like a lot for an undergrad who's not familiar with the space. I assume this is done as part of a class that gives you context. For an example of a rasterizer, you can take a look at my pure JS implementation of canvas (which is roughly the same imaging model as SVG). All lines and shapes are fl…
It's get somewhat tricky when you want things like gpu support, text rendering etc. You have to do things like stencil texture to speed things up etc etc.
Text rendering can be tricky, but not that much trickier -- it's just the same curves at smaller scales.
Not sure what you mean by stencil textures. Are you talking about the NV_path_rendering approach where you stencil out the path? Yeah, that's not really a thing that people do these days.
[0] https://blog.mecheye.net/2019/05/why-is-2d-graphics-is-harde...
Re: Stanford CS248: Implement an SVG Rasterizer
#72d graphics are kinda hard. The problem is that gpus don't support them out of the box so you have to do a Lot yourself.
I assume the point is that you have to implement a pure software rasterizer. It's not actually that difficult, but it feels like a lot for an undergrad who's not familiar with the space. I assume this is done as part of a class that gives you context. For an example of a rasterizer, you can take a look at my pure JS implementation of canvas (which is roughly the same imaging model as SVG). All lines and shapes are fl…
https://magcius.github.io/xplain/article/rast1.html
The edge cases are similar -- precision in computing the path intersections and winding curves.
Re: Stanford CS248: Implement an SVG Rasterizer
#8Earlier quoted context omitted.
It's get somewhat tricky when you want things like gpu support, text rendering etc. You have to do things like stencil texture to speed things up etc etc.
GPUs aren't really designed for 2D graphics out of the box. I've written about this before [0]. Text rendering can be tricky, but not that much trickier -- it's just the same curves at smaller scales. Not sure what you mean by stencil textures. Are you talking about the NV_path_rendering approach where you stencil out the path? Yeah, that's not really a thing that people do these days. [0] https://blog.mecheye.net/20…
Re: Stanford CS248: Implement an SVG Rasterizer
#9Both are closed source, but there are evaluation version available, if someone is interested in compare rendering quality and speed.