Avara
Avara copied to clipboard
Color values used directly from PICT resources are subtly darker (incorrect gamma)
See above image. On the right, color values are pulled directly from PICT resources via ALF and given to OpenGL. On the left, colors are first correctly converted into sRGB from AppleRGB.
AppleRGB (the colors that the original PICT resources used) was a pure power 1.8 gamma colorspace, where modern sRGB is -2.2 with a linear segment. In order to accurately represent colors as they appeared on original Macintoshes, you must first convert AppleRGB to Linear RGB, and then convert that to sRGB. This preserves the correct gamma for the colors selected way back in the day:
Linear = AppleRGB color ^ 1.8
Then Linear RGB to sRGB:
See also
https://github.com/arescentral/antares/pull/401/files#diff-77b31dcbb618b23f1665042fcbb07d7f506195c7683b5170f311e46def0dd7daR54-R69
for a shader example of this math.
We don't need this color correction on newly created levels which never existed as PICT resources or files, only on levels which are converted from PICTs. This color calculation should live in the level converter and apply to any colors pulled from PICT resources, rather than adding the conversion to the port, which will use standard RGB for colors going forward.
More examples (corrected on the left):
Below you can see how the same calculation (negatively) affects a level developed outside of PICT resources (corrected on the left):
I also want to add that color values stored in the source code (e.g. the original, non-colorblind hull colors) also should be updated into the correct color space.