0
\$\begingroup\$

I'm trying to replicate a RTC game as a pet project. The thing is, the units have a .BMP palette. From index 0 to 63, palette colors will be combined to the player color, since that parts of the unit are the ones that make possible for us to distinguish the owner of the unit. I know the red color used for player 1 is (255, 32, 32). I have some values extrapolated from the game as the result. I need to find an algorithm that makes possibly to do the following transformation:

Palette (108, 68, 51) 
Red player (255, 23, 23)
 Result (115, 8, 8)



Palette (87, 85, 84) Red player (255, 23, 23) 
Result (214, 16, 16)



Palette (90, 69 ,67)
 Red player (255, 23, 23) 
Result (181, 8, 8)

I suppose the thing has to do with color Value/Saturation/Luma but I couldn't find the correct formula that, at least, gives us a nearby result.

Thanks in advance. I'll keep investigating, anyway I prefer to share this in advance because maybe there's some color expert here.

\$\endgroup\$
1
  • \$\begingroup\$ This would normally not be done with any kind of formula, but with a lookup table. You'd map palette index X to output colour Y, where each player can use their own version of the lookup table [for the ranges that differ between players]. In a modern GPU shader that doesn't use indexed colours, you could accomplish a similar thing using a colour grading lookup table - addressed with a colour rather than an index. \$\endgroup\$
    – DMGregory
    Jun 5 at 23:53

0

You must log in to answer this question.

Browse other questions tagged .