Search Unity

WebGL texture stretch glitch

Discussion in 'Web' started by KHRZ, Feb 5, 2016.

  1. KHRZ

    KHRZ

    Joined:
    Mar 2, 2013
    Posts:
    56
    When I compile my game for WebGL, textures are wrongly stretched like this:


    Correct look:


    How do I fix it? It looks correct in the editor.
     
  2. Ewanuk

    Ewanuk

    Joined:
    Jul 9, 2011
    Posts:
    257
    Some things to check off the hip
    • Your textures are properly set to repeat or clamp
    • Quality Settings (WebGL defaults to Fastest, while your editor may be set to Fantastic, some texture filtering might be the culprit)
    Move that yellow circle up, it seems odd the artifacting starts right around where it ends, does that affect it?

    Is the table/sky 2D or 3D?
     
  3. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    327
    Hello KHRZ.

    I suppose your texture is NPOT (non power of two)?
    Incorrect scaling of NPOT textures in WebGL will be fixed in 5.4 release.
    For now you can use the following workaround: disable the Generate Mip Maps checkbox in your texture Import Settings.
     
  4. KHRZ

    KHRZ

    Joined:
    Mar 2, 2013
    Posts:
    56
    The mipmap/NPOT change didn't fix it, however I had them set to 2D/GUI in import which I changed to Texture, and it fixed the problem.
     
  5. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    327
    This might be a different issue then. Could you please create a bug report, attach your original project to it, and post the case number here? So that we can reproduce your original issue and fix it in the future releases.
     
  6. LeunchuS

    LeunchuS

    Joined:
    Jul 2, 2012
    Posts:
    2
    use textures with H pixels count = W pixels count --> 32*32 64*64 128*128 etc
     
  7. nIcardoza

    nIcardoza

    Joined:
    Jun 12, 2013
    Posts:
    2
    Is this issue fixed in 5.5 ? what is the solution ?
     
  8. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    327
    I believe we have not received a bug report with a repro project for this specific issue. If you experience the same issue, please file a bug report and post the case number here.
     
  9. nIcardoza

    nIcardoza

    Joined:
    Jun 12, 2013
    Posts:
    2
    Ticket Case number : 870951_9junv2juapvv021c
    Let me know if want more info or if you have a solution.