4 ms·
It would help if he defined what "subpixel accurate" means. I can't figure out why you'd care about subpixels if you're producing a bitmap image? Or is he doing
by IshKebab 4y ago
It would help if he defined what "subpixel accurate" means. I can't figure out why you'd care about subpixels if you're producing a bitmap image? Or is he doing something like cleartype but not antialiased?
- pubby 4y agoThe standard bressenham algorithm expects the start and end point of the line segment to be perfectly centered inside the grid. The modified version lets you put the start and end points anywhere. For example, the standard algorithm would always generate lines that are symmetrical: #### #### But the modified version lets you position the endpoints different, so that you'd get: ### ##### or ## ###### etc
- tomstuart 4y agoThe endpoints of the lines have subpixel resolution, so although you’re only drawing whole pixels, the choice of which pixels to draw along the line may change based on the subpixel positions of the endpoints.
- zozbot234 4y agoHe's not doing anything like ClearType, but for smooth animation you'd still want your end points to have more than single-pixel accuracy.
- flohofwoe 4y agoIt becomes important with low resolution framebuffers and once things start to move. Triangle outlines in early 3D games tended to wobble and jitter because the 'math' didn't work at subpixel precision (many PS1 3d games suffered from this). With subpixel precision (e.g. you do all the math at a higher precision than the framebuffer resolution, and preserve the fractional part of pixel coordinates in all computations until you actually write to the framebuffer), the outlines remain stable even for small movements. IIRC Quake (with the software renderer) was one of the first games which paid proper attention to subpixel accuracy, and they showed this off with a very slight camera movement at the result screen after a multiplayer match. Triangle edges were properly 'crawling' instead of being all jittery.
- Sharlin 4y agoAlso the death screen in single-player, and I remember being impressed by the effect.
- scotty79 4y agoI was confused about this too. What he means is fractionally accurate endpoints of the lines. So it's just about line endings coordinates not being exact integers.
- Sharlin 4y agoAnd the reason why fractionally accurate endpoints matter is that they affect what exact pixels get drawn, which in turn makes animation look much smoother. Eg. a line that "crawls" from 0 to 6 as the endpoints move fractionally upward looks much less jittery than a line that's always 3. 0 # ####### ## ###### ### ##### 3 #### #### ##### ### ###### ## 6 ####### #