Dithering becomes really easy to implement once you get the hang of it. However, even though the current algorithm implemented in Makaqu works well, its results aren’t as smooth as they could be.
The main problem lies in the textures’ borders. Skyboxes are comprised of a single tri-dimensional texture split into six different images, so ideally the error diffusion for each of those images should also be spread over to the adjacent ones. Since this doesn’t currently happen, some edges of the textures of the skybox may be not smoothed out properly enough to be unnoticeable.
Also, the current algorithm wraps the error diffusion around the image’s left and right borders, so some colors on either side can get wrong. This can be noticed in this image, where this bug generated a greenish line over the mountains at the right of the sun.
Fixing the second problem is easy, but fixing the first one is tricky. Makaqu accepts textures of almost any size for its skybox, which is a feature meant to save RAM by allowing usage of lower-resolution textures in some sides of the skybox. Due to this, if the error diffusion is to be spread through the adjacent images of the skybox’s texture, it will also have to be scaled.
This scaling of the error diffusion, along with the need to read the dimensions of every image in the skybox before loading any of them, can make the code quite more complicated than it is.
Other sorely needed goals are to support dithering on run-lenght encoded images, and to optimize RAM usage during the conversion, by loading only the currently needed pixels of the original image into the RAM for processing, instead of loading all of them at once.
After that is done, the loading of 8-bit indexed color images should be improved. 8-bit color images that uses a palette different from the game’s one should be converted to 24-bit color and then re-converted to the game’s 8-bit indexed color palette, with dithering applied.
All of this is just for skyboxes. I haven’t thought of any other usage for this code yet, but I know that using it on anything that needs transparent pixels or lighting would bring up several other problems that would have to be fixed.