Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Bug Custom 2D Sprite Shader + iPhone13

Discussion in '2022.1 Beta' started by Rachan, Nov 23, 2021.

  1. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    783


    as you see this happen if you using new version of Unity 2021++ and it only happen on iphone13
    there have a white glow on edge of sprites, and you can try test it

    and I found the way to found this problem exact like iPhone13 without use real device (iphone13)
    by open Unity 2021 or more and use a custom sprite Shader in some object and just search it by name



    this have a white glow on sprite, and this sprite draw by custom shader

    you can test by using this simple shader for 2d Sprite
    https://www.hardworkerstudio.com/Download/2DSprite.shader

    if you not search it not happen like this



    I hope the new version of Unity can fix this issue. I love Unity so much!!!

    Thanks!!!
     
  2. mahdi_jeddi

    mahdi_jeddi

    Joined:
    Jul 18, 2016
    Posts:
    246
    Are you using PSD files? Because this looks like the problem you would have when you uncheck the "Remove Matte" in PSD file's import settings. Maybe it's broken in iOS?
     
    Rachan likes this.
  3. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    783
    No I just used .PNG and some objects I also enabled Remove Matte PSD in importer setting but this still happen
    so if I downgrade to lower version of Unity this bug will gone...
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,797
    How many threads are you going to open about this?

    I asked to provide the shader and a png file in another so I could help debug this, but instead of continuing that conversation there you keep opening new threads.
     
    Rachan likes this.
  5. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    783
    Thank you very much for your answer
    I think I enough for this threads, I just waiting for someone to see this because this is a big problem I cannot continue doing my work if this bug is not fix I hope Unity team can see this issue.
     
    Last edited: Nov 24, 2021
  6. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    783
    if you want try to test this, by open Unity 2021 or latest version
    and you can download this my custom sprite shader and add to some sprite
    this shader is very simple and then searching the sprite name
    then you can see how it happen like this


    as this image you can see a little white edge out of these sprite
    or you can try to test on real device (iphone13) it should be the best..

    Thanks
     
  7. mahdi_jeddi

    mahdi_jeddi

    Joined:
    Jul 18, 2016
    Posts:
    246
    In Unity's original Sprite shader they multiply the alpha to the color, which is basically what you're now doing in your custom shader:
    colorTexture.rgb *= colorTexture.a;


    this is because they use this blend mode:
    Blend One OneMinusSrcAlpha


    This is called Premultiplied Alpha, and I think is faster than usual alpha blending.
    The bug looks as if on iOS it's using the wrong blending, and causes the white edges.
     
    Rachan likes this.
  8. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    783

    Thank you very much
    I have to try using texture.rgb * texture.a
    I hope it can fix this issue
     
  9. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    783


    Yes I understand how edge white But what is this?
     
  10. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    783


    Thank you very very much!!!
    I finally can fix it by use your concept by multiply color with alpha of it's texture
    and I go to find default Sprite Shader too I found that use color * with alpha too
    but the blend is set to Blend One OneMinusSrcAlpha instead of use source alpha first

    so I finally did it!!!!
     
    Last edited: Nov 25, 2021
  11. simonwixon

    simonwixon

    Joined:
    Jan 29, 2015
    Posts:
    2
  12. print_helloworld

    print_helloworld

    Joined:
    Nov 14, 2016
    Posts:
    231
    Finally, they can now continue doing their work now that its no longer stopped them