Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug 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:
    19
    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:
    19
    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:
    192
    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:
    19
    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:
    3,037
    This issue was fixed in 2019.1.4f1.
     
  6. Quittern

    Quittern

    Joined:
    Oct 9, 2018
    Posts:
    19
    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:
    5
    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:
    3,037
    @TilmiteinemL on which devices do you get this?
    Is postprocessing enabled?
     
  9. TilmiteinemL

    TilmiteinemL

    Joined:
    Sep 17, 2018
    Posts:
    5
    @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:
    3,037
    @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:
    5
    @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:
    3,037
    @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:
    3,037
    @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:
    66
    @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:
    3,037
    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. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    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:
    3,037
    @deverolirc perhaps. 2018.3 is not supported anymore, so please consider upgrading to 2018.4 :)
     
  20. TilmiteinemL

    TilmiteinemL

    Joined:
    Sep 17, 2018
    Posts:
    5
    @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:
    3,037
    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:
    400
    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.
     
    Opeth001 likes this.
  23. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    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
     
  24. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,037
    @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:
    400
    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:
    185
    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:
    3,037
  28. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    4 month old critical bug.. Nice.
     
  29. Deleted User

    Deleted User

    Guest

    Uhm … on my ProjectSettings.asset androidBlitType is already set to 0, nevertheless, the editor always shows "Never", and of course, everything is ugly dark. @BattleAngelAlita did you do anything else to set "Always"?
     
  30. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    After saving project unity automatically set this parameter to BlitType Newer. So i asked my programmers to put this lie in build script
    Code (CSharp):
    1. PlayerSettings.Android.blitType = AndroidBlitType.Always;
     
  31. Deleted User

    Deleted User

    Guest

    Thank you, I will test it out.
     
  32. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,126
    How can i Upgrade to the URP 7.1.1 version ? im stuck in 7.0.1 version (using Unity 2019.3.0b4)
     
  33. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    Opeth001 likes this.
  34. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,126
  35. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    this is latest stable version ...
    also i tried these (7.1.2) on 2020.1.0a5 ...
    but got same problem [linear - glES 3.1] on android 5.1 and 6.0 and 8.1 [phones and emulators] :[

    the Memu emulator is really good choice to testing your games ;)
     
    Last edited: Sep 30, 2019
  36. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,126
    i tested on 3 samsung devices and in all of them it works without bugs but with Very Bad Performance, between 17~60fps in the same map area. but without the URP it's always stable never goes down the 55fps even on old devices. (android 6 )
    but when testing on Oneplus2 it's a total different Game, Dark Colors and anything blue, red or yellow become emissive. looks like a Sci-fi Version of it XD. (i think the LWRP/URP is declared stable and ready for release too fast)

    anyway i know Unity it's taking too much time to do some essential fixes, time that some studios dont have and cant publish their games just for that.
    but from my experience it's the best Game Engine you can found!! it's not yet perfect but it's not sooo far from it.
    if we guys look at the new features like : ECS and it's performance by default, the Jobs (Parallelism), Burst, new Renderer Pipeplines and much more. it's going so fast and they cant fix everything in few weeks or months.

    i hope Unity Teams will fix them as fast as possible.

    I Love Unity and i dont see my future without it!!!
     
  37. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    i think that Samsung phones have Vulkan and Oneplus 2 doesn't have it , and just used glES 3.x ...
    this problem is exists on Open glES 3.x only on android 8.1 and below ... not sure about that :[
     
    Opeth001 likes this.
  38. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    does it fix method for URP?
    and can you give me some info to how to implement this code on project to run it on building?
    thanks.
     
    Opeth001 likes this.
  39. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,126
    Yep in my Case i dont have high contrasts anymore but still having other problems related to the subscene.

    @BattleAngelAlita are you having the same high contrasts problems with the new URP version 7.1.2 ?
     
  40. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    @Opeth001
    I write my own pipeline.
    Unfortunately this darkening is not problem of SRP. Darkening affect UGUI, and from SRP there is no access to UGUI at all.
     
    Opeth001 likes this.
  41. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
  42. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Same problem on 2018.4 latest LTS. Does anyone have a work around?
     
  43. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    yes ... rollback to built-in and save your life :|
     
    theforgot3n1 likes this.
  44. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    I am on built in, the issue isn't present when building with Vulkan.

    My setup is the following:

    Built in pipeline
    2018.4 LTS
    Linear Rendering
    Built in Post, only color grading.
    Android Platform
    Samsung Galaxy S8
    Open GLES 3.0
    Blit Type "Always"

    Upgrading Unity to 2019 is not an option, doesn't seem to fix the issue anyways.
     
  45. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    i mean rollback to Standard RP ... don't waste your time on LWRP or URP ...
     
  46. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    Just test 2019.3. And it seems like unity has remove this AndroidBlitType workaround.
     
  47. Quittern

    Quittern

    Joined:
    Oct 9, 2018
    Posts:
    19
    On 2019.2.3f1 everything seems fine for phones with android version 9.0, but not for those with 8.1. Alltough the first two scenes in our game looked right on my motorola g5(8.1), but all other scenes still have the bug. One of the scenes that looked right this time used to have the contrast-bug, and both of them have post process activated.

    Do the SRP Batcher option have anything to do with anything? We disabled that because of other light bugs, and that's the first time that my phone have had any scene working correctly in regards to this thing.
     
  48. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,037
    @Quittern no, SRP Batcher shouldn't have any effect on this.
     
  49. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,126
  50. CityTroll

    CityTroll

    Joined:
    Oct 31, 2019
    Posts:
    2
    unity 2019 3.0b8 and urp 7.1.2
    still have this bug

    when do you fix this bug???

    this bug is very critical
    linear space render output and gamma space render output have big different
    i don't want use gamma space render