Search Unity

WebGL Streaming Asset Extremely Blurry in Edge Browser

Discussion in 'Web' started by rhamoud, Sep 14, 2018.

  1. rhamoud

    rhamoud

    Joined:
    May 20, 2013
    Posts:
    18
    Hopefully someone has an answer to this puzzling issue I am experiencing in published WebGL builds.

    I am loading a series of images at run-time using WWW.Texture method and for some odd reason only in Microsoft edge browsers the images are coming in very blurry but in Chrome and Firefox they are both crisp and clear (See Examples Below).

    Microsoft Edge Example



    Firefox/Chrome Example
     
  2. rhamoud

    rhamoud

    Joined:
    May 20, 2013
    Posts:
    18
    Any suggestions on why this is happening? Does this not happen for anyone else when loading in a texture at run-time with a WEBGL build?
     
  3. rhamoud

    rhamoud

    Joined:
    May 20, 2013
    Posts:
    18
    In efforts that maybe it is something I am doing wrong in the code here is the function that is dynamically loading in the image file and assigning it to the sprite.

    Code (CSharp):
    1. public static IEnumerator LoadImage(Image image, string fileName)
    2.     {
    3.          string finalPath;
    4.          Texture texture;
    5.          Sprite sprite;
    6.         WWW localFile;
    7.  
    8.         finalPath = System.IO.Path.Combine(Application.streamingAssetsPath, fileName);
    9.         localFile = new WWW(finalPath);
    10.  
    11.         yield return localFile;
    12.  
    13.  
    14.         if (!string.IsNullOrEmpty(localFile.error))
    15.         {
    16.             finalPath = System.IO.Path.Combine(Application.streamingAssetsPath, "image-not-                                    found.png");
    17.             localFile = new WWW(finalPath);
    18.             yield return localFile;
    19.         }
    20.  
    21.  
    22.         texture = localFile.texture;
    23.         sprite = Sprite.Create(texture as Texture2D, new Rect(0, 0, texture.width, texture.height),                        Vector2.zero);
    24.  
    25.         image.sprite = sprite;
    26.  
    27.         texture = null;
    28.         sprite = null;
    29.  
    30.         Destroy(texture);
    31.         Destroy(sprite);
    32.  
    33.         localFile = null;
    34.         localFile.Dispose();
    35.    
    36.  
    37.         Resources.UnloadUnusedAssets();
    38.     }
     
  4. rhamoud

    rhamoud

    Joined:
    May 20, 2013
    Posts:
    18
    still trying to figure out a solution here if anyone has any suggestions???
     
  5. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    700
    Just throwing ideas out there, but try making the image a power of 2 and see if that fixes it. Maybe try using the Texture2D directly with RawImage instead of converting to Sprite.
     
  6. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    340
    Same issue here, it kind of looks like WebGL player is rendering half res on EDGE, not sure why. Has anyone figured it out ?
     
    JamesArndt likes this.