I'm implementing global illumination in my game engine with "reflective shadow maps". RSM has i.a. color texture. To save memory. I'm packing 24 bit value into 8 bit value. Ok. I know how to pack it. But how do I unpack it? I had idea to create a 1D texture with 8 bit palette, with 255 different colors. My 8 bit color would be index of pixel in that texture. I'm not sure how to generate this kind of texture. Are there any mathematical ways to convert 8 bit value into rgb?
@edit
The color is in this format:
RRR GGG BB
@edit2: And I'm packing my colour like this:
int packed = (red / 32 << 5) + (green / 32 << 2) + (blue / 64);
//the int is actually a byte, c# compiler is bitching if it's byte.
@edit3:
Alright, I found a way to do this I think. Tell me if it's wrong.
@edit4 It's wrong...
int r = (packed >> 5) * 32;
int g = ((packed >> 2) << 3) * 32;
int b = (packed << 6) * 64;