kyubuns / AkyuiUnity

Adobe XD to Akyui to Unity UI
https://kyubuns.dev/akyui/
MIT License
416 stars 43 forks source link

Have color difference #48

Open kane9527-e opened 1 year ago

kane9527-e commented 1 year ago

1.Import xd file :https://drive.google.com/file/d/1LAmtfFHxfgmo15xldfqP9qzH8GD26wmf/view?usp=sharing

  1. Observe the prefab and find that there is color difference with some elements in the XD file Version: main What is the reason for this? I don't quite understand. Please answer it, thank you! f1e45408ddf18cd8b573c23bb9955cd
ghost commented 1 year ago

@kyubuns, @kane9527-e, it looks like AkyuiUnity is brightening the UI when it is converting the .xd file to Unity.

kyubuns commented 1 year ago

This problem is caused by AdobeXD not managing color profiles correctly. https://adobexd.uservoice.com/forums/353007-adobe-xd-feature-requests/suggestions/17480899-color-management-set-color-profiles

I was left with the belief that AdobeXD would one day "normalize", but since I no longer expect AdobeXD to add new features I am trying to figure out if this problem can be absorbed on the AkyuiUnity side, but the color profile issue is too complex to make any promises....

ghost commented 1 year ago

@kyubuns, in all of the cases you have seen this bug, do all Akyui/Unity UI files look brighter than the original Xd files? If so, you could add a shading process while transforming the XD file.

kyubuns commented 1 year ago

I am not yet aware of the whole issue and will investigate it in due time.

ghost commented 1 year ago

I am not yet aware of the whole issue and will investigate it in due time.

@kyubuns, do you mind if I help you investigate this? If you create a repository with screenshots of several UIs in XD and the same UIs in Unity, I can look for any differences between the Unity prefabs and Xd files and give feedback on how the bug can be fixed. If you create a private repository, I will need to be invited as a collaborator if you want my help.

ghost commented 1 year ago

I apologize if my previous comment had a rude tone; I edited it, so it would be less rude and more clear.

kyubuns commented 1 year ago

I apologize if my previous comment had a rude tone; I edited it, so it would be less rude and more clear.

No, I appreciate your cooperation, I just don't know when I will be able to get started on this task. And I don't want to leave unnecessary conversations on the issue.

ghost commented 1 year ago

And I don't want to leave unnecessary conversations on the issue.

I meant that the conversation can be on the repository itself.

ghost commented 1 year ago

@kyubuns, @kane9527-e, I think I found a fix! https://community.adobe.com/t5/adobe-xd-discussions/color-profile-problem/td-p/9946275

kane9527-e commented 1 year ago

Setting the SRGB as the monitor profile, this decision is bad. My team uses Windows and Mac together

ghost commented 1 year ago

Never mind.

ghost commented 1 year ago

@kyubuns, I could look into possibly installing Unity to help find a fix, but I'm not sure if my computer can handle a large game engine right now...

ghost commented 1 year ago

(Irelevant)

@kyubuns, I could look into possibly installing Unity to help find a fix, but I'm not sure if my computer can handle a large game engine right now...

However, because I'm a web developer, I can use my knowledge of built-in image filters (offered by web browsers) to see if a certain combination of filters will fix the issue. @kane9527-e, when you have a chance, do you mind taking a screenshot of the entire UI in Xd and a different screenshot of the prefab in Unity, please? That way I can get a fuller picture of what is going on.

ghost commented 1 year ago

(Irelevant) @kyubuns, @kane9527-e, I'm working on an image filtering website where two image URLs (the before and after pictures respectively) can be passed as inputs along with the required filter configurations. My website will also allow us to create permalinks, so we can share configuration settings. This will allow us to see whether AkyuiUnity will be able to "absorb the issue" or not; if so, then we know how to fix the bug.

ghost commented 1 year ago

@kyubuns, @kane9527-e, y'all can disregard my previous comments. I was doing more research, and I found that Akyui will need to limit its color gamut to sRGB, which is an international standard used by web browsers, Unity, and possibly other game engines. This means that the Xd -> Akyui conversion process will need to dull the Adobe RGB color space to sRGB, and the Akyui -> [game UI] conversion process will need to make adjustments to the UI colors, so the UI is compatible with Unity and other game engines. In a nutshell, unless a UI format using the sRGB space is used as the input format, or there is a new and wider color spectrum standard, there is no way to avoid unexpected UI color issues.

References:

kane9527-e commented 1 year ago

Thank you for your answers, but due to the color problem, I can only temporarily give up using this scheme in the project, but I still thank the author and your contributions

ghost commented 1 year ago

@kane9527-e, you are welcome; I am sorry that a permanent fix could not be found...

ghost commented 1 year ago

@kyubuns, do you want me to add a warning about this issue in Pull Request #49?

kyubuns commented 1 year ago

Thanks for doing the research. I don't plan to write in the documentation until I close this PR, as people who are having problems should come to the Issue first. When I myself really give up, this PR will be closed.

ghost commented 1 year ago

Understood.

ghost commented 1 year ago

If you want me to conduct more research, don't hesitate to let me know.

kane9527-e commented 1 year ago

Whether to consider adding linear space and gamma space to judge whether the color of the generated image is correct automatically according to the project settings or the options provided

kane9527-e commented 1 year ago

Similar to shader code

if !defined(UNITY_COLORSPACE_GAMMA) && (UNITY_VERSION >= 550)

                o.color.rgb = GammaToLinearSpace(v.color.rgb);
                o.color.a = v.color.a;

endif

ghost commented 1 year ago

Similar to shader code

if !defined(UNITY_COLORSPACE_GAMMA) && (UNITY_VERSION >= 550)

o.color.rgb = GammaToLinearSpace(v.color.rgb); o.color.a = v.color.a;

endif

@kane9527-e I don't think Unity defines UNITY_COLORSPACE_GAMMA or UNITY_VERSION for the C# preprocessor. See the Unity docs for more info.