logoalt Hacker News

Lichtsoyesterday at 1:58 PM2 repliesview on HN

Great write-up!

Though a little caveat from my side, as I have written both 2D and 3D rendering engines. Let me tell you, they could not be more different. It is not just another dimension but completely different goals, use-cases and expectations.

So instead of:

> Everything we talked about extends to the 3D case as well.

I would say the entire post is mostly about 3D, not 2D rendering. If you are curious about this topic being approached for 2D rendering here is a nice write-up I found about that: https://ciechanow.ski/alpha-compositing/

One particular criteria for AA techniques that no one cares about in 3D but is very relevant in 2D is correctness and bias. AAA for example is heavily biased and thus incorrect. Drawing the exact same shape multiple times in the same place will make it more opaque / darker. The same thing does not happen with MSAA which has a bounded error and is unbiased.


Replies

lagrange77yesterday at 2:44 PM

Hey, i'm brainstorming for a 3d vector renderer in WebGPU on JS/TS and stumbled on your project [0] yesterday.

(Thick) line drawing is especially interesting to me, since it's hard [1].

I also stumbled upon this [2] recently and then wondered if i could use that technique for every shape, by converting it to quadratic bezier curve segments.

Do you think that's a path to follow?

[0] https://github.com/Lichtso/contrast_renderer

[1] https://mattdesl.svbtle.com/drawing-lines-is-hard

[2] https://scribe.rip/@evanwallace/easy-scalable-text-rendering...

show 1 reply
kookamamieyesterday at 7:36 PM

I don't think the article generalizes trivially to 3D, though.

The solution presented relies on signed distance fields, yet skims over the important part - a distance to what? In 2D it is obvious, we are measuring distance to an edge between the object and its background, to a silhouette.

In 3D, when objects may rotate producing self-occlusions, things get more complicated - what are we measuring the SDF against? The silhouette of a 3D object's 2D projection is ever-changing and cannot be trivially precomputed.