imchillin / Anamnesis

A standalone tool that allows the user a greater degree of flexibility for making creative and interesting screenshots.
MIT License
808 stars 158 forks source link

Improve color accuracy in extended appearance #1322

Closed Exter-N closed 11 months ago

Exter-N commented 11 months ago

This PR fixes color inaccuracies I noticed while working with the game's shaders.

Corresponding fix in Palette+ : https://github.com/chirpxiv/PalettePlus/commit/04e253629cc6d2cfc679bf3e5ad91f8b92b90e6b

Yuki-Codes commented 11 months ago

wtf why are colors stored that way?

excellent catch if true.

Exter-N commented 11 months ago

"The response for said inquiry is unascertained" as some would say.

The best explanation I can think of is that they're trying to approximate gamma (which is usually exponent 2.2 or 2.4) by working with squared values in most places in the shader, and that some values (such as the ones in the g_CustomizeParameter constant buffer – which is how the shader calls what's called "extended appearance" in Anamnesis) are pre-squared to save a few GPU instructions.

If you want to reproduce the issue, the colors that make it most obvious are permutations of 1, 0.5, 0 (or 255, 128, 0 / #ff8000 if you prefer this form) : in game they'll be pulled towards the secondary (in this example, more yellow, namely 1, √(0.5), 0 / #ffb500) – and Palette+, having that fix, will agree with the color you'll see in game.

Also, the weapon tint doesn't seem to require this transform.