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

White Edges on Sprites Loaded from PNG at Run-time

Discussion in '2D' started by akasurreal, May 13, 2017.

  1. akasurreal

    akasurreal

    Joined:
    Jul 17, 2009
    Posts:
    441
    When I use use Texture2D.LoadImage at run-time, I have white edges around my sprites that I don't get if I load the same exact sprites in the Editor. I know this has to do with pre-multiply alpha and there are ways to pre-process the source image to avoid this, but the Editor does not have this issue and I would prefer not to have to do extra processing on all my images. Also, this is for a tool that allows users to select their own sprites, so I don't have control over those images, nor do I want to explain some processing step to my non technical users.

    I have seen a few other threads and unity answers posts regarding this, but the only thing I am seeing is source image processing which as mentioned above is not an option.

    I have tried messing with the alpha settings on the texture to no avail. Is this some kind of limitation of run time texture/sprite loading or some setting I can fix? The editor handles these files perfectly, so I know Unity is at least capable of doing what I want on some level.

    Thanks for any help!
    (Unity 5.6.0p4)


    Other similar issues:

    http://answers.unity3d.com/questions/52623/pixel-wide-border-artifact-on-texture-loaded-from.html

    http://answers.unity3d.com/questions/1237452/sprite-black-borders-on-imported-transparent-png-f.html

    http://answers.unity3d.com/questions/10302/messy-alpha-problem-white-around-edges.html
     
    Last edited: May 13, 2017
  2. DanRP

    DanRP

    Joined:
    May 26, 2013
    Posts:
    33
    I'm having the same issue...
     
  3. ObelardO

    ObelardO

    Joined:
    Feb 20, 2015
    Posts:
    3

    Attached Files:

    e140games and akasurreal like this.
  4. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    228