Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Artifacts around edges of sprites, only on iOS, since Unity 2021

Discussion in 'iOS and tvOS' started by aromana, Nov 30, 2021.

  1. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Hi, I upgraded my project to 2021 (from 2020.3), and now my project has visual artifacts on the edges of various sprites, particularly ones that are transparent. These artifacts only appear in the built player on iOS, not in the editor or on Android.

    Here are several examples:

     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,001
  3. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Thanks. I'm not using a custom shader, just the built-in
    Sprite-Unlit-Default
    and URP, so I'm not sure that thread applies to me. I'll create a test project to see if I can reproduce the issue and then file a bug if so.
     
  4. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Ahhh, very interesting. This issue seems to be related to the URP "HDR" option...
    in a blank 2D URP project in Unity 2021:

    HDR checked in URP Asset = no artifact
    HDR un-checked in URP Asset = artifacts

    This makes no sense to me, because the texture isn't an HDR texture — it sRGB mode selected in the texture settings...
     
  5. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    For now, the workaround seems to be as simple as enabling HDR in URP settings. I've filed a bug for this with a minimal repro project as Case 1384814.
     
    JesterGameCraft and AcidArrow like this.
  6. xyome

    xyome

    Joined:
    Jul 4, 2014
    Posts:
    9
    Hey, I suggest you try to put your iOS device in "Dark Mode" to see if it still happens. There are weird rendering issues when your device is in Light Mode in the latest 2020 and 2021 builds.
     
  7. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,001
    Yup! This is it.

    I had my phone on Dark mode, so I wasn't seeing any issues, but switching to light mode breaks a whole bunch of transparency stuff.
     
  8. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Oh god... you're right. Toggling back and forth between light mode and dark mode breaks my app *in real time*. Light mode = broken, dark mode = fine.

    Does anyone know if there's a bug tracking this already? Thankfully, I did seem to discover a workaround which is to enable HDR mode. Anyone know of other workarounds? (To avoid the overhead of HDR pipeline when I don't need it?)
     
    AcidArrow likes this.
  9. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,001
    I can’t find anything with a quick search of the issue tracker, so probably not?
     
  10. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    753
    Is this the issue?

    https://forum.unity.com/threads/alpha-13-ios-shader-issues.1196518/

    https://issuetracker.unity3d.com/is...ndered-with-different-colors-in-the-ios-build
     
    AcidArrow likes this.
  11. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    MousePods likes this.
  12. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,001
    MousePods likes this.
  13. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,571
    I spent many hours trying to solve the same issue (was happening with unlit, mobile particle, and font shaders), and did not find any forum threads to help. Eventually I solved it by adding DisplayP3 to the Color Gamut in Player Settings and placing it first on the list. I will be submitting a bug report when I have got my update out that has been delayed by this problem.
     
  14. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,001
    That sounds similar to the "enable HDR" fix.

    Please be warned that things will start looking a little different after you add DisplayP3. At least they did for our game.
     
  15. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,571
    Yes, my game actually looks a bit better, although it could affect others negatively. But looking a little different is rarely good for artistic intent.
     
  16. xyome

    xyome

    Joined:
    Jul 4, 2014
    Posts:
    9
  17. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Seems like Unity is aware and already working on the fix. Unity QA replied to my bug report and said:

    Hi,

    Thanks for getting in touch, as you may already know, we're aware of this issue and you can check the status here:
    https://issuetracker.unity3d.com/product/unity/issues/guid/1379817

    Do reach out if I can answer any questions or be of further help.

    Cheers,
    Edvinas
    Customer QA Team
     
  18. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Hmm, this workaround did not work for me with Unity 2021.2.4f1 + 2D URP.
     
  19. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,001
    They back ported the bug to 2020.3.23f1...

    I'm always floored to see how bugs are back ported to LTS faster than fixes are.
     
    peon_1, Moonjump and aromana like this.
  20. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,571
    It is 2020.3.23 that I had the issue, but also previously saw it in an earlier version (2020.3.21 I think).
     
  21. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,001
    I definitely did not have this issue a few versions back.

    Maybe 2020.3.20? I don't remember exactly.
     
  22. PhureStudios

    PhureStudios

    Joined:
    Jul 3, 2015
    Posts:
    1
    Any fix on this as of now? Working with Unity version 2021.2.7f1.4128.

    Should I simply update Unity to a few versions later or does the problem still exist in the latest version as well?
     
  23. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Yes, this was fixed in 2021.2.8. The bug that tracked it is here.