Search Unity

[Unity 5.4] Photographic Tonemapping Washes Out Colors In Build

Discussion in 'Image Effects' started by DaBossTMR, Aug 3, 2016.

  1. DaBossTMR

    DaBossTMR

    Joined:
    Dec 23, 2012
    Posts:
    38
    Hello everyone,

    Ever since I installed Unity 5.4, I have been working peacefully in the editor. However, today when I created a build, I realized that something about the graphics were a bit off. After a bit of tinkering around, I realized that the cause (or at least part of it) was from the Tonemapping script (set on Photographic mode). The image attached below will explain what I am experiencing. Just a heads up: this problem did not occur in Unity 5.3.x builds, so it is a result of upgrading to Unity 5.4 and pretty sure it's not my graphics card. I am also aware that there are graphical tweaks/improvements.

    EDIT: It seems that instantiating the camera in a build seems to break the image effect somehow. But, I need to instantiate the camera because the player needs to spawn.

    Here are my camera setup:
    • Tonemapping set on photographic
    • Camera HDR enabled
    • Deferred enabled
    • The only other image effects enabled are: Bloom, Global Fog, and Sun Shafts.
    • Caused by instantiating the camera?

    Thanks for reading!

    Attached image:
    Click image to expand
     
    Last edited: Aug 3, 2016
  2. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    Hi, can you log a repro project for this so we can investigate. It seems like a serious issue.
     
    shkar-noori likes this.
  3. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    Actually I found one in our database :) No need to log it.
     
    DaBossTMR likes this.
  4. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    same problem here! any workarounds?
     
  5. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    Not any nice ones. The issue is that when the prefab is being instantiated the image effect is being added to the list of effects, then on enable happens and the same effect is added a second time :( This was caused by another bug fix. #sideeffects :(

    I've tracked the issue and am putting a fix in now (also wrote a test so it won't regress :) ).

    Work around would be: Keep effects disabled on camera, then after instantiation turn them on. This fix will go in a patch release asap.
     
  6. DaBossTMR

    DaBossTMR

    Joined:
    Dec 23, 2012
    Posts:
    38
    Alright, thanks! I will try that workaround now.

    Also, I seem to be getting this error with Sun Shafts and another custom image effect. I used a workaround that someone posted, but it's strange because it should have been fixed already? Is this somehow related to the image effect duplication?

    If it helps, here is the code for the workaround, so you can get a better idea of what fixes it:
    This coroutine is called once on Awake().
    Code (CSharp):
    1.  
    2. private IEnumerator Unity54Fix_SunShafts() {
    3.      if(sunShafts != null) {
    4.          sunShafts.enabled = false;
    5.          yield return new WaitForEndOfFrame();
    6.          sunShafts.enabled = true; //Removing this will spam "self -> GetEnabled()"
    7.          yield return null;
    8.          sunShafts.enabled = settingsInst.videoSettings.sunShafts; //Enabling/disabling the sun shafts based on the in-game settings.
    9.          //Error spam is fixed.
    10.      }
    11.  }

    This issue isn't too much of a problem since I already found a (thankfully short) workaround, but it would be nice if it wasn't necessary. #sketchyworkarounds :)
     
  7. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    It might be, but I can't tell without stepping through the code. I would guess likely, but can't be 100%.
     
    DaBossTMR likes this.
  8. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    Fix is in 5.4.0p1 :) Should be released next week.
     
    shkar-noori and DaBossTMR like this.