10 ms·
Grayscale on 1-bit LCDs (2022)
- _8j50 4y agoYou know, I had a cool hardware hacking idea I really wanted to do but both TFTs and eInk screens are prohibitively expensive. I just wanted a low resolution/dpi cheap monochrome display. Lack of demand apparently meant they cost more than normal colored lcds.
- ErikHuisman 4y agoWhy are people doing this 30+ years to late? Imagine having this as kids.
- ChuckNorris89 4y agoThe computational and engineering effort for these hacks to get to those results in production would have made those price sensitive consumer gadgets far more expensive. It just wasn't economically feasible. Also, if I'm not mistaken, those hacks look good on static images but could produce nasty artifacts on moving images.
- cameldrv 4y agoWe were! When I was a kid 28 years ago I had an HP48 calculator that people used the same techniques with for some games and such.
- roywiggins 4y agoTI-83+ calculators were doing grayscale like this 20 years ago, so a lot of people did have this as kids. It was a bit flickery but worked well.
- Yhippa 4y agoYep! I remember doing this on the HP 48G's in the mid-90's: https://www.hpcalc.org/hp48/graphics/grayscale/ https://www.hpcalc.org/hp48/graphics/grayscale/
- DSMan195276 4y agoThey actually gave an example that was, the Gameboy. I think in that case the big issue for going beyond just 4 gray levels is RAM and ROM space, and also potentially the speed of the PPU and display driver in dealing with the extra data.
- saboot 4y agoI'm trying to think of examples that used it on the gameboy. The Gameboy Camera obviously did, any games though?
- dragontamer 4y agoThere's a ton of monochrome screens available to EEs under $20, even under $10. This is still quite relevant.
- z2 4y agoImmediately thought of the assembly-level hacking people did ~20 years ago on TI's graphing calculators to get reliable grayscale, for instance this on the TI 83 series: https://www.ticalc.org/archives/news/articles/7/77/77966.html https://www.ticalc.org/archives/news/articles/7/77/77966.htm...
- dpkingma 4y agoHaha, thanks for dredging this up, I made that :) It seems quite related to the OP article. It's a library for making grayscale games on the TI83 graphical calculator, which has a monochrome display. The main challenge was optimizing the interrupt routine, the z80 assembly code that performed the flickering/dithering that achieves the grayscale effect, to fit within the tiny amount of clock cycles available on the Zilog Z80 6 MHz processor. Even after optimization, it took up ~50%-75% of all available cycles. Some people managed to make some pretty fun grayscale games with it (e.g. https://www.ticalc.org/archives/files/fileinfo/331/33153.html https://www.ticalc.org/archives/files/fileinfo/331/33153.htm...). This was obviously in the pre-smartphone era, so the ti83 was quite popular for playing games in class, and hand written assembly code was the only way to make it fast.
- andrepd 4y agoI knew immediately that the link was to Desolate before opening it :) It blew me away the first time I played it, as I was used to my shitty turn-based TI-BASIC games.
- modeless 4y agoCool to see that one of the authors of the most cited paper in machine learning also got their start hacking on TI calculators. What a great learning environment that was!
- joshstrange 4y agoHoly crap! This takes me back. I used this (or something based on it) on my TI84 SE+ to play around with grayscale over a decade ago. It's the first thing that came to mind when I saw this article. I never got into ASM on the TI calcs but I wrote a TON of TI-Basic. I spent a ton of time on those forums and posted a number of apps/games I wrote (though I can't find them now).
- matt-attack 4y agoThe PWM greyscale is commonly used in other other display technologies like LED where controlling current is not feasible as well as Texas Instrument's DMD which is a micro mirror that can only be on or off.
- dragontamer 4y ago> LED where controlling current is not feasible Voltage-controlled current source is a pretty basic OpAmp circuit actually. There's also some tricks to turn some common voltage regulators into current controls. If your "information" is already encoded as current, you can somewhat current-mirror with a very basic BJT circuit (its not the best circuit, but if you don't care about accuracy its fine). I'd say that current control is _more expensive_ than PWM though. PWM is just software or a 555 timer if you're oldschool, both are cheaper than OpAmps / Voltage Regulators. Or maybe you mean, "not feasible for the costs people expect", which is probably true. PWM is just so much cheaper in practice.
- mananaysiempre 4y agoWhen I needed a beeper with a time delay for a fridge door, I looked at retail prices for a dual-555 IC (a 556) and for a dual-opamp IC (ended up going with a 6002) and was surprised to find the opamp was something like three times cheaper, even taking into account the hefty capacitor for the time delay. (Active buzzers wouldn’t run off a 3V cell so I did need a dual IC for the delay and the square-wave generator.) Is this just a retail-specific distortion?
- londons_explore 4y agoAll of the components you mentioned would be sub-cent in large volumes and surface mount parts. I'd imagine the retail price is a combination of 'what the customer is willing to pay', and 'random'.
- matt-attack 4y agoI really meant for large 4K (4096x2160) arrays of LED pixels like in this [1]. [1]: https://displaysolutions.samsung.com/led-signage/onyx https://displaysolutions.samsung.com/led-signage/onyx
- Syzygies 4y agoMy father Bryce Bayer studied this question fifty years ago at Eastman Kodak; his approach is known as ordered dithering: https://en.wikipedia.org/wiki/Ordered_dithering https://en.wikipedia.org/wiki/Ordered_dithering One is effectively posterizing a grayscale image, and his primary goal was to reduce artifacts drawing unwanted attention to the borders between poster levels. With improvements in hardware other approaches to dithering took over. The last time I saw my father's pattern was on a DEC box logo. He moved to the color group at Kodak, and designed the "Bayer filter" used in digital cameras.
- _Microft 4y agoYour father invented the Bayer filter. HN never ceases to amaze me :)
- mbreese 4y agoIf you think that’s good, also check out further down in this thread. Gotta love HN for finding people that wrote old libraries. In the below case, it’s a library for using grayscale on a TI83. https://news.ycombinator.com/item?id=34356244 https://news.ycombinator.com/item?id=34356244
- WithinReason 4y agoTo add to the above, an alternative dithering approach is error diffusion, e.g.: https://en.wikipedia.org/wiki/Floyd–Steinberg_dithering https://en.wikipedia.org/wiki/Floyd–Steinberg_dithering The article mentions also doing this in the temporal domain.
- IIsi50MHz 4y agoAnd for 1-bit, Atkinson dithering can produce good effect. Floyd-Steinberg and Atkinson are the only two I'd usually consider for 1-bit dithering, with a preference for Atkinson for most images. Ordered dithering, even at 8-bit, is…not my cup of tea.
- 4y ago
- kqr 4y agoWow, this is really impressive. I would have stopped at various types of dithering, but these techniques are cool and the results look like they really work! I'm not a hardware person, but now I sort of want to try to simulate this myself to see what it looks like.
- londons_explore 4y agoEven modern color LCD's on laptops and stuff implement many of these tricks.
- drtse4 4y agoAKA Bit banging PWM, never seen it working with this kind of displays, nice project, it can be done even with higher frequency signals too (requires an oscilloscope and a few tries to get a smooth signal).
- aliqot 4y agoMan it's been so long since I've seen an 88x31 on a website. I miss those.
- _Microft 4y agoHere is a video by the author with explanations of the technique and later on video playback on the display. Demo of "Sintel" playing at ~20min into this video: https://www.youtube.com/watch?v=n7uxEaGB9t0 https://www.youtube.com/watch?v=n7uxEaGB9t0
- karmelapple 4y agoI thought it might be about dithering used in HyperCard, but nope, very different approach. I wonder if Apple ever tried this with its early CRTs for the Mac?
- marssaxman 4y agoI can't swear that nobody ever tried it, but such a demo would have been very impressive, and I can't imagine how it could have been done. Those original black-and-white Macintoshes had an 8 MHz processor, and the screen was 512x342 pixels; just performing a single cycle's worth of computation per pixel would limit you to 45 Hz. Even if you could somehow miraculously perform dithering in a single instruction per pixel, you'd have no CPU left to run the animation or do anything else.
- adrianmonk 4y agoWould it have provided any benefit? CRTs have continuously variable brightness. The bottleneck was having large enough video RAM to even store the higher pixel depth, the processing power to draw it, and the bandwidth to do the output. Circuitry to convert a multi-bit value to a voltage doesn't seem to have been cost prohibitive. Even cheap devices (the predate the Mac) like the Atari 2600 could do that. I'm actually not sure why they went 1-bit with the Mac. Maybe they felt having more pixels was so important that going monochrome was a reasonable trade-off. The original NeXT had 2-bit greyscale (black, white, 2 shades of gray), and that looked pretty nice. It also had lots of pixels and was way more expensive.
- marmakoide 4y agoThere was some code allowing 12 bits RGB display on 8 bits palette screen mode, using very simple temporal dithering (PWM). For example, a demo for old versions of Allegro library. This blog post shows a way to improve on that.
- FullyFunctional 4y agoNice final result but I would have skipped the PWM detour. PWM sucks and has known bad aliasing issues. Sigma-Delta (AKA "1-bit DAC") is error diffusing, cost the same to implement, and should always be preferred IMO. A lot of "tricks" from the past were accommodating the slow processing powers, but if you are driving this from, say, an FPGA, you there's no reason for not just doing the best thing. One thing I didn't see mentioned: the reason this all works is because the liquid crystals don't turn very fast so effectively they are providing a filter that implements the gray-scale output from a binary input. What I'm curious about is if this is a linear process. Based on the PWM result it looks pretty linear.
- bee_rider 4y agoFWIW, as someone who doesn’t really know anything about LCDs but has messed around with circuits and LEDs, the digression into PWM bridged the gap nicely for me at least. It probably wasn’t necessary from a technical point of view but it helped tell the story.
- robinsonb5 4y agoPWM still has its place - it's not uncommon for high-end sigma deltas to have a multi-bit rather than one-bit output, which feeds into a PWM final output stage. It helps with numerical stability. I've used a similar technique to improve the audio output in FPGA projects where a simple 1st order SD feeds a 5-bit PWM. On the boards in question the output drivers seem to be somewhat asymmetric, making an SD quite noisy at higher clock frequencies. With the PWM final output stage the same effect manifests as a DC offset instead, since (when not saturated) the PWM has a fixed number of rising and falling edges in a given time period.
- aryaonearth 4y ago[flagged]
- aryaonearth 4y ago[flagged]
- Tepix 4y agoIs it just me? I look at the screenshot below the sentence "Then bring in the noise-shaper." that shows the difference between the 1st-order noise shaper and the Sequence LUT and… i'm seeing only a very small difference!
- sbierwagen 4y agoIt makes more sense in video: https://www.youtube.com/watch?v=n7uxEaGB9t0 https://www.youtube.com/watch?v=n7uxEaGB9t0
- philsnow 4y agoAh, thank you, the post says "But as you could see from the video progress bar, I am not finished yet" but doesn't embed the video or have a link to it anywhere that I could see.
- fooblaster 4y agoAnother excellent article on dithering: https://news.ycombinator.com/item?id=25633483 https://news.ycombinator.com/item?id=25633483
- starmole 4y agoMade a (very simple!) shader toy for temporal dither on your webcam: https://www.shadertoy.com/view/clf3Rj https://www.shadertoy.com/view/clf3Rj
- londons_explore 4y agoOP comments on 'error diffusion dithering in 3d' in a few places... If OP did that, but measuring and taking into account the slow rate of change of color of these pixels, then I think he could get far better results for watching a movie on the LCD, because it should get rid of much of the blurring for fast motion. If the error signal is allowed to propagate both back and forward in time (which would require preprocessing), then you could probably reduce the blurring even further - effectively a pixel changing from one shade of grey to another can start the transition ahead of time.
- seltzered_ 4y agoIt's worth noting this person (Wenting Zhang aka zephray) is the same one that's also worked on the eink drivers for https://www.modos.tech/ https://www.modos.tech/ - https://twitter.com/zephray_wenting/status/1534641299705499648?lang=en https://twitter.com/zephray_wenting/status/15346412997054996... See also https://news.ycombinator.com/item?id=31674373 https://news.ycombinator.com/item?id=31674373
- userbinator 4y agoHe's also the guy who pushed an eink display to 5bpp: https://news.ycombinator.com/item?id=16140284 https://news.ycombinator.com/item?id=16140284
- braunboffel 4y ago> He's also the guy who pushed an eink display to 5bpp didn't the original sony prs ereaders have 32 grays as well?
- peterisza 4y agoSince we have the whole video in advance (we can look forward in time) and we can also measure the response function of the pixels, it would be possible to preprocess the whole video to make it look even better (less ghosting).
- avodonosov 4y agoGood article, but the background beneath the text (the small paw prints) makes reading difficult.
- em3rgent0rdr 4y agoVery impressive. But frustrating having to read this great blog post over a tiled background which obscured the text.
- B5C8ECB24DB47D1 4y agoI thank the reader mode of my browser in case like this.
- tinglymintyfrsh 4y agoPWM those 1 bits to get grayscale and add dithering. I'm sure this is what the Palm Handspring did.
- legosexmagic 4y agoyou can use (abuse?) multiplication to get a nice dither without any tables: bool dither(int time, int value) { time *= value; return (value + time ^ value ^ time) < 0; } where value is in the range 0 ... (int_max/2)
- dang 4y agoRelated ongoing thread: Lid – Lo-fi image dithering - https://news.ycombinator.com/item?id=34358828 https://news.ycombinator.com/item?id=34358828 - Jan 2023 (27 comments)
- deleted 4y ago[deleted]
- daguava 4y agoInteracting with hardware is on another level. I remember taking some introductory hardware level classes, and we began to simulate our circuits, just combinations of gates and what-not and you hit a weird signal pattern.... "Ohh, that's just a gate-glitch, we'll discuss that in later courses!" The way that physics interacts with hardware is incredible, and the dance that we all do back and forth between hardware and software really strikes me as magical. I love it.
- ComputerGuru 4y agoExcellent write-up. I really wish the photos were apng/webm/mp4 though, it would have added a lot to the reader’s ability to really grasp the changes.
- mattmar96 4y agoThis reminded me of the fantastic dev blog of Lucas Pope, the creator of games like Papers Please and The Return of the Obra Dinn. He has an entry on dithering his 3D game and how he managed to "stick" the dithering to the 3D objects. https://forums.tigsource.com/index.php?topic=40832.msg1363742#msg1363742 https://forums.tigsource.com/index.php?topic=40832.msg136374...