Hacker News new | ask | show | jobs
by td 5804 days ago
I have a question about this blending effect. In the article, the author writes "If only I'd invented this trick 20 years ago when it really mattered!" But wouldn't this blending have cost a big performance hit, since, to do this with 256 color palettes, you would need to switch to different color palettes very fast, to render all the in-between colors?
1 comments

I think the idea is to interpolate the palettes "in-between" a shift of x and a shift of x+1. If you are going at 60 frames a second, but you only shift palettes every 6 frames say, then you see a jerky ever tenth of a second. If instead you shift the palette by 1/6 every frame (so after a shift of 1/6, you are using 5/6 of colour x and 1/6 of colour x+1), you get a much smoother effect. The computation is trivial, since you are only changing the palette, so you have at most 768 bytes to recalculate. You can also change palettes every frame by outputting those 768 bytes (in fact I think you can only output the changes), which is trivial to do fast.