Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outfit Colors on Website do not Match In-Game #474

Open
AntumDeluge opened this issue Dec 7, 2022 · 5 comments
Open

Outfit Colors on Website do not Match In-Game #474

AntumDeluge opened this issue Dec 7, 2022 · 5 comments
Labels
component: website Related to stendhalgame.org homepage. type: bug Causes a negative impact or not working as intended.

Comments

@AntumDeluge
Copy link
Member

AntumDeluge commented Dec 7, 2022

🐞 Describe the bug

Outfit colors displayed on entity sprites on website are different than in-game. It appears to be a problem with the light/dark levels.

(left: in-game, right: website)
image

In addition, if lightness level is at darkest custom color for that layer isn't shown.

It is possible that it could be related to games.stendhal.server.entity.Outfit.getData called by some db dumps.

@AntumDeluge AntumDeluge added type: bug Causes a negative impact or not working as intended. component: website Related to stendhalgame.org homepage. labels Dec 7, 2022
@AntumDeluge AntumDeluge self-assigned this Dec 7, 2022
@kiheru
Copy link
Contributor

kiheru commented Dec 8, 2022

The coloring done by the website is only an approximation of the actual client colors . The actual blending mode is Stendhal specific, and the website just tries to do something vaguely similar using what the php ImageMagick can do (see imageprocessing.php). The result is usually okayish, but at extremes it can be badly off.

To properly match the game coloring the website would need to implement the actual algorithm (see TrueColorComposer in Blend.java or 'trueColor' filter in sprites.js)

@AntumDeluge
Copy link
Member Author

Thank you for the information @kiheru, I will look into that.

@AntumDeluge AntumDeluge added this to the 1.42 milestone Dec 11, 2022
@AntumDeluge AntumDeluge removed their assignment Dec 13, 2022
@AntumDeluge
Copy link
Member Author

Beyond my understanding at the moment: https://sourceforge.net/p/arianne/stendhal-website/ci/cdde0d7ec5c8822cc8cebd3d57be92da1c909bd3/tree/scripts/imageprocessing.php#l53

Un-assigning myself in case someone else wants to fix it.

@kiheru
Copy link
Contributor

kiheru commented Dec 14, 2022

The current php code would need a rewrite to do similar pixel level manipulation as the java and js code does. As of it is now, it does not look similar because it does not do the same thing, but uses existing whole image operations for somewhat similar effect. The issue is that the existing operations can't be used to perfectly reproduce the coloring. There are also some adjustments for oddities of the existing operations (buggy saturation calculation, broken alpha channel handling (html specification has the same flaw)), making the code more complicated. So the correct thing to do is to mostly forget about the current code.

Basically, what is needed is a port of the existing code to php. It already does most of the RGB->HSL color space transformation to get the S and L parts of the adjustment color. What is still needed is the H component, the inverse transform, and the TrueColor algorithm itself, and applying it to all pixels of the image.

@kiheru
Copy link
Contributor

kiheru commented Dec 14, 2022

The other option would be doing the coloring in JS on the browser (and displaying a warning if the user has JS or html canvas disabled).

@AntumDeluge AntumDeluge modified the milestones: 1.42, 1.43 Dec 26, 2022
@AntumDeluge AntumDeluge modified the milestones: 1.43, 1.44 Mar 11, 2023
@AntumDeluge AntumDeluge modified the milestones: 1.44, 1.45 Oct 9, 2023
@AntumDeluge AntumDeluge modified the milestones: 1.45, 1.47 Mar 13, 2024
@AntumDeluge AntumDeluge removed this from the 1.47 milestone May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: website Related to stendhalgame.org homepage. type: bug Causes a negative impact or not working as intended.
Projects
None yet
Development

No branches or pull requests

2 participants