Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    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:
    251


    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:
    212
    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:
    251
    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:
    8,716
    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:
    251
    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:
    251
    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:
    212
    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:
    251

    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:
    251


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

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    251


    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
unityunity