Live data from Hacker News

Stanford CS248: Implement an SVG Rasterizer

github.com

41–50 of 82 posts

Re: Stanford CS248: Implement an SVG Rasterizer

#41
post #13

What's a good JavaScript-based solution to render SVG into an image? html2canvas doesn't work well with SVG, especially those heavily styled with CSS.

I’m surprised no one mentioned canvg: https://canvg.github.io/canvg/demo/index.html

If using CSS with SVG is important then it’s actually better to use a backend with a library like librsvg (e.g. Cairo) then run node-canvas on top of it like automattic does. Even Inkscape has problems with CSS in SVG files. CSS in browsers is subjective because nowadays they might be using an style that doesn’t have a straightforward approach that can be rasterized. I haven’t had much luck with rasterizing SVG styles past CSS2 spec.

Re: Stanford CS248: Implement an SVG Rasterizer

#42
post #30

Earlier quoted context omitted.

Wait, why do you say GPUs support parametric curves? GPUs are based on triangles mostly.

GPUs can take in way more than just triangles as input. There are particle simulation and even Ray tracing implemented on GPUs nowadays. Support for parametric curves was one of the more recent additions.

That's a very... naive view of how a GPU works. Particle simulation is done in compute, and ray tracing, as implemented in RTX/DXR, is done on a soup of triangles. The core of rasterization is still done on triangles, and can't easily be done in compute. Have any references to parametric curves on GPUs? All the approaches I know of, like the recent mesh shader work, still output triangle meshes.

Re: Stanford CS248: Implement an SVG Rasterizer

#43
post #30

Earlier quoted context omitted.

Wait, why do you say GPUs support parametric curves? GPUs are based on triangles mostly.

GPU aren't based on anything. They are turing complete, you can run Linux on it if you wanted to. What you are saying is outdated by maybe a couple of decades.

A Turing Machine is turing-complete, but it would be inefficient to run Linux on it. We're not talking about raw computability here, but feasibility. And still, I am not aware of anything "running Linux on a GPU", their scheduling engines are not designed for those sorts of workloads.

Re: Stanford CS248: Implement an SVG Rasterizer

#45

This is a good example of a CS project you would do at Stanford and wouldn't get assigned at your local university.

You can easily do this on your own.

If "you" are 19 and can do this on your own, then chances are you are a CS student at Stanford, or a peer institution.

Re: Stanford CS248: Implement an SVG Rasterizer

#46

Earlier quoted context omitted.

You can easily do this on your own.

If "you" are 19 and can do this on your own, then chances are you are a CS student at Stanford, or a peer institution.

I don't understand your point.

Re: Stanford CS248: Implement an SVG Rasterizer

#47
post #6

Earlier quoted context omitted.

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…

Yeah I'm talking about that. What do people use then?

Fast, efficient 2D graphics using the PostScript (i.e. SVG) rendering model is still an open research problem. Most shipping implementations these days do full tessellation to triangles on CPU.

Re: Stanford CS248: Implement an SVG Rasterizer

#48

Earlier quoted context omitted.

If "you" are 19 and can do this on your own, then chances are you are a CS student at Stanford, or a peer institution.

I don't understand your point.

Can you work us through what you don’t understand?

Re: Stanford CS248: Implement an SVG Rasterizer

#49

Does anyone know similar courses where you get to do similar kind of practical assignments?

CS148 [1] varies from year to year (most people complained that I made the final assignment on subdivision surfaces too hard, but I had at least a few "Thank you, this was awesome") and is the pre-cursor to 248. I'd recommend it if you're getting started.

If you like ray tracing, Cem Yuksel currently teaches most of the related courses at Utah [2].

[1] http://web.stanford.edu/class/cs148/assignments.html

[2] http://www.cemyuksel.com/courses/

Re: Stanford CS248: Implement an SVG Rasterizer

#50
post #49

Does anyone know similar courses where you get to do similar kind of practical assignments?

CS148 [1] varies from year to year (most people complained that I made the final assignment on subdivision surfaces too hard, but I had at least a few "Thank you, this was awesome") and is the pre-cursor to 248. I'd recommend it if you're getting started. If you like ray tracing, Cem Yuksel currently teaches most of the related courses at Utah [2]. [1] http://web.stanford.edu/class/cs148/assignments.html [2] http://w…

Sometimes I kick myself for not doing CS while I was at Utah. :(
Post reply on HN