jesse__ 2 days ago

"it's a lightweight SVG renderer"

Meanwhile.. drawing 512 subdivisions for a single textured quad.

It's a cute trick, certainly, but ask this thing to draw anything more than a couple thousand elements and I bet it's going to roll over very quickly.

Just use webgl where perspective-correct texture mapping is built into the hardware.

1
seveibar 2 days ago

The goal for this vanilla TS renderer is to have visual diffing on GitHub and a renderer that works without a browser environment. Most 3D renderers focus on realtime speed, not file size and runtime portability. I think in practice we will configure the subdivisions at something like 64 for a good file size tradeoff

kookamamie 2 days ago

Why use SVG for this, though? This could be easily implemented as pure JS software rasterizer without all the tessellation workarounds.

ricardobeat 2 days ago

> The goal for this vanilla TS renderer is to have visual diffing on GitHub and a renderer that works without a browser environment

itishappy 2 days ago

This doesn't answer the question. If you're doing all this work in JS to render a static SVG, why not just "do it right" and output a static PNG instead?

seveibar 1 day ago

The top of the PCB (the lines etc) are computed as an SVG, i would have to have an SVG rasterizer just to begin with that approach, then would be limited by what images I could rasterize. It would also be much much slower than quickly computing matrices

jahewson 1 day ago

You might find that librsvg works for you.

itishappy 1 day ago

I was going to suggest raylib for server-side rendering, but it adds a non-JS dependency. Apparently it has optional support for rendering SVGs to textures.

https://github.com/raysan5/raylib/discussions/3741