Rainbow Wave Palette Expansion v0.1

Published 2023-06-12


Developer Explanation

First of all love is love! Support the human rights of human beings!

This is a flicker palette expansion demo that uses 49 colors of an available 136 "colors" to animate a randomized, circular rainbow "video wipe" style effect. This is achieved by drawing two different colors on the same pixel in quick succession to dazzle your senses into tricking your brain into thinking it's seeing more colors than Pico-8 can actually draw. It looks okay at 30 fps but really benefits from 60 fps.

Apparently there is historical evidence of arcane "Super CGA" video cards using this method to expand the color palette of old 16-color monitors from a bygone era. Cool stuff. Most of the CGA cards like the CGA board that went into the IBM PC XT back then were only displaying four colors at time so there wouldn't have been much incentive to write a piece of software that actually used this technique.

This GIF image example is 30 fps since capturing a GIF at 60 fps only shows one half of the frames so the effect is lost in the conversion. This 30 fps example is also slow enough to give an idea of how the effect is achieved: each band of colors is actually three bands wide. The code runs at 60 fps which looks 100% better than the example GIF.

My goal is mostly to remind anyone who needs to hear this that Pico-8's palette can be greatly expanded using only the official 16 colors.

Just so I know my math is right the rainbow uses 7 official colors which blends into 6 new colors between the bands. The background fills with any of the 16 official color which only add 9 new colors to the mix. The red band blends with 14 of the background fill colors in a way that it hasn't already with itself and orange as does the violet band with itself and dark blue but since red blending with violet has already been counted that's only 13 additional colors for violet.

7 + 6 + 9 + 14 + 13 = 49 colors

Controls

No controls yet. It just draws sweeping rainbows until you quit. It could use some sliders to adjust things like speed, width, delays, etc.

Developer Notes

I found cart by @dw817 called "256 Colors" with Pico-8's "Lucky Draw" feature which looks to be showing at least 136 unique colors (and 120 duplicates) which was where I got the inspiration to try something similar. I had been watching videos about legacy computers and just had to try this out. It's easy to imagine how someone might have been able to get old 16-color CGA monitors to behave in a similar fashion either in software or with special hardware.

Shout out to David Murray "The 8-Bit Guy" whose video "Meet the Super CGA Cards" discusses specialized CGA video cards like the Plantronics Colorplus and the QuadColor II. I think I just figured out how the Quadcolor II supposedly has support for 136-color on 16-color displays. @dw817's cart is a literally picture of a similar set of colors using Pico-8s official 16-color palette.

For anyone interested in the history on this stuff, here's the video I'm referring to.

I highly recommend "The 8-Bit Guy" to Pico-8 developers for some insights about what 1970's and 1980's era PC gaming was actually like. Does anyone remember when the swatches in Microsoft Paint in Windows 3.1 were dithered on some systems because the hardware didn't support the colors? Nostalgia ...

This "flickering color palette expansion" method probably has to be used somewhat sparingly in practical applications because some scenes would take too long to render at a full 60 fps.

Possible Expansions

I haven't implemented any dithering which seems to open up quite a bit more color options. There might also be a way to flicker in an extra color layer or two for broader color depth but at a considerable cost to frame rates.

There are a ton of Rainbow-themed carts that could benefit from implementations of this technique. Well worth searching around the BBS for these carts. Lots of good stuff in there.

There's lots of little variables you can play with in the code to change how this little tech demo behaves. I think of it as a piece of parametric software but I haven't yet brought out the parameters to the GUI so this cart would benefit from that work.

Minimal effort to make some sort of useful library so people can place a rainbow wipe or other gradient anywhere on the screen might be useful to someone.

Musical Notes

There's no music but this might be a good effect for any demoscene kinds of work I might do with Pico-8's amazing synthesizer capabilities which I barely know how to leverage in code at this point but after discovering @luchak 's "RP-8" cart I need to dig deeper, awesome stuff.

Free Software

Feel free to use, optimize or expand this code in any way your see fit for example to accompany music, simulate shock waves or whatever other project you're working on if you just need to slap a flickering rainbow on something. It can easily be modified to use other colors and might look amazing with some fast dithering techniques maybe using special characters or something.