logoalt Hacker News

RobRiverayesterday at 4:56 PM2 repliesview on HN

Omg I love this! I have been finding excuses to do little animation engine features that arent on the critical path of development for the sake of creative self-indulgence. Such features shipped was alpha channel based fading using the fundamental opengl fade parameter (under the hood its a linear interpolation of alpha values over 256, pieced together over a provided pair of timestamps).

I tell you what I'll do today on my dev time, I'll try implementing grayscale without aby research on pause and then compare notes (I'm assuming this wc code is available somewhere, which may be a bad assumption)


Replies

bombcaryesterday at 5:06 PM

WC code is likely not (legally) available, but Wolfenstein and Doom both did similar palette tricks and are documented in the Black Books for each - https://fabiensanglard.net/three_books_update/index.html

Code for those is available.

show 1 reply
netcoyoteyesterday at 7:13 PM

While I don't have the original code, it's something along the lines of this:

    // for each palette entry:
    pal.r = pal.b = pal.g = (byte) (0.299 * pal.r + 0.587 * pal.b + 0.114 * pal.b)
show 2 replies