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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Unity WebRequestTexture decreases quality?

Discussion in 'Scripting' started by vdKa, Jul 8, 2020.

  1. vdKa

    vdKa

    Joined:
    Jan 22, 2014
    Posts:
    13
    Hi all,
    Basicly we have a game that gets images from host. Than save them to a sprite list for later use. (will be used both on UI (Image) and Gameobject ( spriteRenderer).
    My problem is that my images are pieces of bigger image. What I mean is, when I put them together, images complete the big image. But my problem is, on the merging ( contact) point there a low quality/glitch/pixel error. Something like that. I tried everything but result is the same.


    Code (CSharp):
    1.          
    2. imageTexture= ((DownloadHandlerTexture)www.downloadHandler).texture;        
    3.             //Pivot top
    4.             mySpriteList.Add (Sprite.Create(imageTexture, new Rect(0f, 0f, imageTexture.width, imageTexture.height), new Vector2(0.5f, 1f), pixelsPerUnit));
    5.  
    When I try to render this sprites I get this result:

    1.PNG 2.PNG

    By the way, images are perfectly cutted and perfectly positioned in the game. When I replace sprites with the ones I download manually with the same ones. There is no problem

    3.PNG

    ***What I Tried
    - I saved my texture after I download them. To see that if texture is getting broken when I download it. But there was no error. It happens after Creating the sprite I guess.

    - I tried to save my downloaded textyre to another texture I created with different TextureTypes ( rgba32, alph8 etc) and turn on/off mipmaps. Nothing changed.



    Thank you all for help,
    Have a good day.
     
    Last edited: Jul 8, 2020
  2. Elango

    Elango

    Joined:
    Jan 27, 2016
    Posts:
    107
    Default wrap mode for the loaded textures is "Repeat". It causes a "Bleeding" effect for the top/bottom and right/left pixels. This seems pretty much like it (if your image has transparent edges). Try setting wrap mode to "Clamp" (if you're not already).
    imageTexture.wrapMode = TextureWrapMode.Clamp;
     
    vdKa likes this.
  3. vdKa

    vdKa

    Joined:
    Jan 22, 2014
    Posts:
    13
    That's it. Thank you...