Search Unity

Very high contrast and saturation on android build (LWRP)

Discussion in 'Android' started by Quittern, Jun 5, 2019.

  1. Quittern

    Quittern

    Joined:
    Oct 9, 2018
    Posts:
    5
    Our team recently discovered that whenever we build our game for android, we get a really high saturation and contrast that looks really really bad. The first time I noticed it I thought it was only something odd in one particular test scene, because our main test device is an iPad and the game looked right whenever we build for ios.

    We changed to 2019.1 a few weeks ago, but I'm not sure if we had the problem before that or if that's when it started. All android builds worked fine like a month ago at least.

    When we build the entire game to android, every scene but one had the issue, and that scene did not have any post process in it, so we tried removing the post process on the cameras in all the scenes, but that actually just made the problem appear in all the scenes, including the one that looked fine before.We use the standard post process for unity.

    We tried comparing our build settings to the LWRP example project and found nothing obvious, and we've tried googling but this does not seem to be a common issue because I found nothing.

    Any takers on how to solve this?
     
    wbourchier likes this.
  2. Quittern

    Quittern

    Joined:
    Oct 9, 2018
    Posts:
    5
    Update with screenshots of the issue and settings.

    This is part of a scene what it looks like in the editor (and it looks the same in an ios-build):

    upload_2019-6-7_9-37-34.png

    This is what it looks like in the android build:

    upload_2019-6-7_9-36-28.png

    Player settings:

    upload_2019-6-7_9-33-59.png

    upload_2019-6-7_9-34-16.png

    LWRP settings:

    upload_2019-6-7_9-28-1.png
     
  3. weiping-toh

    weiping-toh

    Joined:
    Sep 8, 2015
    Posts:
    43
    It seems as though lighting has been omitted from the shaders compiled for Android. Or perhaps that the shader is not supported for that particular GPU and is reverting to an unlit fallback
     
  4. Quittern

    Quittern

    Joined:
    Oct 9, 2018
    Posts:
    5
    Hm, not sure what you mean. Like the standard unlit shader in LWRP? Because the contrast and saturation effect is on everything in the game, even UI and terrain, trees etc, and even if everything would have unlit shaders it would just look flat and not that dark and saturated. However, the shader compilation takes like and hour so maybe that's an indicator of something, but it's been like that for a while before this problem occured.

    I did just notice though that there's no saturation and contrast issue when building in gamma, so it's got to have something to do with linear color space.
     
  5. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    911
    This issue was fixed in 2019.1.4f1.
     
  6. Quittern

    Quittern

    Joined:
    Oct 9, 2018
    Posts:
    5
    Thanks, but we tried to build in 2019.1.4f1 as well and still had the issue. The 2019.2b seems to work however, so we're gonna wait for that to come out of beta instead.
     
  7. TilmiteinemL

    TilmiteinemL

    Joined:
    Sep 17, 2018
    Posts:
    4
    I still got that issue in 2019.2b. On all devices using Vulkan, everything looks as it should, just with OpenGL3 things get that too high contrast.
     
  8. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    911
    @TilmiteinemL on which devices do you get this?
    Is postprocessing enabled?
     
  9. TilmiteinemL

    TilmiteinemL

    Joined:
    Sep 17, 2018
    Posts:
    4
    @aleksandrk Yes it is! The normal postprocessing stack. It doesn some stuff though when i enter different PP-volumes, the effects just dont get displayed properly.
     
    Last edited: Aug 2, 2019
  10. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    911
    @TilmiteinemL I'm working on a fix for this :)
    I'll post here when it's fixed.
     
  11. TilmiteinemL

    TilmiteinemL

    Joined:
    Sep 17, 2018
    Posts:
    4
    @aleksandrk Nice :) Devices were: LG Nexus 5 and Nexus 6 (all running OpenGL due to their old Android Version). Every device that supports Vulkan didnt show the issue (Nokia 5, Galaxy Tab 2016, Pixel 1st Gen).
     
  12. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    911
    @TilmiteinemL
    It's fixed for Universal RP (7.1.1 should have the fix in place).
     
  13. rjosebfs

    rjosebfs

    Joined:
    Dec 4, 2015
    Posts:
    2
    Are there any plans to back port the fix to other versions of 2019?
     
  14. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    911
    @rjosebfs Partially. The bug had two parts, one in the pipeline itself, and one in the post processing stack. The pipeline part is going to be back ported (if not already), but the post processing part is trickier. It would double the variants for the Uber shader in PPv2, and it's already quite a lot of them there.
     
  15. pajamajama

    pajamajama

    Joined:
    Oct 22, 2012
    Posts:
    55
    @aleksandrk my project is locked to 2019.1 for some time, so I'm trying to patch this asap.

    I pulled these changes into my local embedded lwrp package v5.16.1
    https://github.com/Unity-Technologi...mits/30f5ed8a99c36bd3f46637445ff37e9cc71b3584
    FinalBlitPass.cs is now in universal pipeline, but in 5.16.1 I found it in lwrp.

    Those changes fixed the darkness of everything but the screen overlay UI. I can't find any other related issues. Is this known? Is FinalBlitPass happening after UI in the newer versions?

    Thanks for the help!
     
  16. rjosebfs

    rjosebfs

    Joined:
    Dec 4, 2015
    Posts:
    2
    So in the future we would likely be able to work around this by disabling post processing for those devices?
     
  17. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    911
    Either that or render in gamma space. You can check with https://docs.unity3d.com/ScriptReference/Display-requiresSrgbBlitToBackbuffer.html if the device support automagical conversions, or try and modify your local PP stack with https://github.com/Unity-Technologi...mits/a9fa23d6fc992e21e4b6aaf27f5664149d053cbf and https://github.com/Unity-Technologi...38421f9#diff-0fc38bcad4c9bdbb2263ff5f4e949b4a (only the ShaderPreprocessor.cs changes). But this will double the amount of variants in the Uber shader.

    No, it would be very nice if you could submit a bug report.
     
  18. deverolirc

    deverolirc

    Joined:
    Jan 19, 2014
    Posts:
    325
    Hi @aleksandrk

    I am seeing this in 2018.3, is this the same issue or something else?
     
  19. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    911
    @deverolirc perhaps. 2018.3 is not supported anymore, so please consider upgrading to 2018.4 :)
     
  20. TilmiteinemL

    TilmiteinemL

    Joined:
    Sep 17, 2018
    Posts:
    4
    @aleksandrk I upgraded my project from LWRP to Universal now to see if the fix worked. Everything seems fine, but now I dont get any PP-effects shown at all anymore, but I noticed that the camera itself has some PostProcess-Options now (Volume Mask and a Trigger to render PP-Effects), that were not there before. (Post Processing stack is up to date according to the Package Manager).
     
  21. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    911
    Universal has a new post processing stack, which is embeddedn in the Universal package itself.
    You probably have to configure it anew, idk if there's an upgrader for it.
     
  22. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    37
    This darkening affect all SRP with Android-Linear-OpenglES3-pre Android 9. Even simplistic pipe like https://github.com/phi-lira/HelloSRP
    This bug block android release of my game, hope unity fix this bug as fast as possible.
     
  23. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    37
    I figured out what was happened. In unity 2019, when using custom render pipeline, the AndroidBlitType parameter forced to Newer Blit and hided from settings. This cause darkening on Android-Linear-OpenglES3. If i manually edit ProjectSettings.asset and set BlitType to Always(0) all looks fine.
    Don't know why unity hide this parameter, don't know why they force it ti Newer. And very angry on unity testing team. They don't find that critical bug, that basically do not allow you to release on android.


    BlitType.png

    2019.png

    Edit.png
     
    pajamajama likes this.
  24. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    911
    @BattleAngelAlita SRPs are supposed to handle this on their own, this is why the BlitType option is hidden and is set to "Never" when SRP is active.
    When you set "BlitType" to always, it, well, always renders to a temporary render texture and then does a full-screen blit to the backbuffer. This is costly.
     
  25. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    37
    Yes, i can do sRGB<->Linear conversion for framebufffer by myself. But problem is that uGUI became darker too, and i have no access to uGUI rendering at all.
     
    pajamajama likes this.
  26. superjayman

    superjayman

    Joined:
    May 31, 2013
    Posts:
    124
    Where is clear documentation for this new PP stack? Can you explain the differences between all versions of PP stack and their compatibility.
     
  27. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    911
  28. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    37
    4 month old critical bug.. Nice.
     
    pajamajama likes this.