Hacker News new | past | comments | ask | show | jobs | submit login
Daily Driver: Channelling RGB into 1-bit (gingerbeardman.com)
37 points by zdw 54 days ago | hide | past | favorite | 16 comments



I applied a similar idea in a drawing application I wrote recently. You can paint and fill with 1-bit patterns, but since the underlying representation preserves a "color" index for each pixel, you can repeatedly flood fill, post-hoc edit patterns, and even animate the patterns: https://beyondloom.com/tools/ditherpaint.html


What you've written is beautiful. I love that I'm drawing an image where the paintbrush behaves as an eraser. This project has perfect fidelity with the original MacPaint except better https://archive.org/details/mac_Paint_2 I upvoted your link. https://news.ycombinator.com/item?id=26517917 It deserves to be in HN's second chance pool.


This is great! I also get Classic Macintosh vibes from it. In fact, another of my projects is to use Classic Mac 1-bit drawing apps under emulation on an iPad Pro. Painting with dither patterns is so satisfying! I've done a few fine-art style pieces with this technique. https://blog.gingerbeardman.com/2021/04/17/turning-an-ipad-p...


I guess the alternative would be to compute everything in greyscale and use Floyd-Steinberg [0] or some other dithering algorithm to convert it to 1-bit color.

[0]: https://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dither...


Originally I was using greyscale and dithering (I have another bespoke tool for exploring a dozen or so dithering algorithms) but the results were less than ideal. Dithering works great at larger sizes, but with my final sprites being only 30x30px (much, much smaller than the example images in the blog post) the results were a mess.

After the exploration with greyscale, as the blog post hopefully explains, I moved from to pulling out black and white separately - which gave better results - to this RGB Channel approach to generate the masks more easily.

I have headroom to squeeze another colour by using the alpha channel as the base colour and using the free colour for some other detail. But so far I've not needed to. Though good to know it's there if I need it to be!


Thank you for pointing to Wikipedia's article on Floud-Steinberg. Cool stuff!


You're welcome, there are many others:

https://en.wikipedia.org/wiki/Dither#Algorithms


Doesn't this mean you can have 16 shade of grey (or 8? without the alpha channel)? Is there an advantage to this compared to a 4 bit greyscale system?

Edit: the Dither pattern implementation is really cool


I haven't explored the total number of masks that could be pulled out of this setup, but it probably is around 8. I don't need that many, because I need to keep the number of colours low because of the 1-bit target display, and the tony size of my sprites (30x30px). So once I got enough to cater for black and white and another for a dither pattern I stopped there. I could easily get one more, but I've not needed it so far. https://twitter.com/gingerbeardman/status/139613198879333171...


Wouldn't it be easier & more maintainable to use a nodes compositor? Something like blender, nuke, resolve, etc. Or, if custom shaders are needed, Shadron or similar.


Possibly! Though I have no idea what any of those are.


Is there an implementation in this article?


There isn't a runnable implementation, sorry. I only talk about it casually, at a high level.

If there is interest in this sort of thing I will go back and detail it at a later date. However, I will be including more like this plus code, scripts, makefiles, etc in my "making of the game" book.


This appears to be a game (in development) for a handheld device I hadn't heard of. There are a few other posts about it on his blog.

I didn't see any code, but it sounds like the post was detailing how he marks (manually) which section of his models will have a dither pattern -- basically just masking.

There are a a bunch of posts about it if you go to his blog index, there are only 7 pages so it's easy enough to flip through them, they're all labeled with the DailyDriver name. There might be something in there about the render process.


Exactly, I'm just extracting masks from the channels in a way that is easy for me to specify through my render.

For browsing my blog you can also click on the tags at the top of each post, which will show you other posts with the same tag. For my game that's: https://blog.gingerbeardman.com/tag/dailydriver/


> a handheld device I hadn't heard of

It’s the upcoming Playdate, developed by Panic: https://play.date/




Applications are open for YC Winter 2022

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: