News for hackers. Stuff that matters.
Re:My mental model of how alpha opacity works is wrong (2020) by nyanpasu64 on Saturday February 05, 2022 @05:55PM (#30227183)
The hard problem in 2D rendering (where objects are drawn in a user-determined order) isn't translucent blending of unsorted polygons, but conflation artifacts. If you have two adjacent squares where the first covers the left half of a pixel and the second covers the right half, and both are drawn with alpha blending, there will be background showing through which shouldn't exist, and too little influence from the first square's color. Similarly if you drawn two identical squares on top of each other, which both cover the left half of a pixel, the first square will have some influence over the background which shouldn't happen at all.
Re:My mental model of how alpha opacity works is wrong (2020) by jefftk on Saturday February 05, 2022 @06:28PM (#30227454)
The lazy way to deal with this is to render at a high resolution and then scale down before displaying. Is there a better way?
Re:My mental model of how alpha opacity works is wrong (2020) by namibj on Saturday February 05, 2022 @07:05PM (#30227753)
Collect all polygons with influence over a pixel, then process the resulting lists pixel-parallel using exact math instead of trying to abuse a few planes of Z-buffered framebuffer to accumulate per-pixel state into a few numbers (while handling polygons virtually one-after-another, using some locking tactics of sorts to serialize their access to a single pixel's framebuffer values, if even that much concurrency-correctness is done).