Search Unity

Blurry Graphics

Discussion in 'UGUI & TextMesh Pro' started by tawsm, Aug 29, 2014.

  1. tawsm

    tawsm

    Joined:
    Nov 12, 2013
    Posts:
    43
    I can't get completely blur or bugfree graphics within the new gui system.
    The sliced sprites (in my case the buttons) always make problems when i set the filter mode to point. In trilinear it works, but is all blurry.
    Pixel perfect seems to just blur everything even more, in my case.

    Here are the four example cases:
    Filter Mode: Point (nice crisp results, nearly perfect, but with bugs at the sliced sprites).
    point.png

    Filter Mode: Point, Pixel Perfect (more bugs than before).
    point_pixelPerfect.png

    Filter Mode: Trilinear (bugs are gone, but overall result is blurry, especially the fine lines on the left and the ckeckbox).
    trilinear.png

    Filter Mode: Trilinear, Pixel Perfect (everything is even more blurry, no bugs).
    trilinear_pixelPerfect.png
     
  2. BTables

    BTables

    Joined:
    Jan 18, 2014
    Posts:
    61
    Same problem here,

    For reference what image format are you using to import the sprites?

    I seem to get different results from different lossless formats with point sampling (may be an issue with the illustrator rasteriser tho)
     
  3. tawsm

    tawsm

    Joined:
    Nov 12, 2013
    Posts:
    43
    Good to know that i'm not the only one...
    I only tried png so far. Will test some others asap and report back.

    EDIT:
    Okay, so i tested tiff and targa as well, no differences.
    What i did find out though is, these errors correlate somehow with 1stly, the position of the sprite and 2ndly, the size of the sprite.
    My button e.g. has 270 Width, if i change it to 271 Width or move it 0.5 units in Pos X, the errors disappear.
    This leads me to the conclusion that unity does rounding-errors there. Anyway, until it is fixed, this will be my workaround.
     
    Last edited: Sep 2, 2014
  4. Grizmu

    Grizmu

    Joined:
    Aug 27, 2013
    Posts:
    131
    Try going to Project settings -> Player -> Settings for PC, Mac, Linux -> Other Settings and enable the Direct3D 11, if it's possible for your project. It fixes blurry uGUI text, but it might just work with sliced sprites as well.
     
  5. tawsm

    tawsm

    Joined:
    Nov 12, 2013
    Posts:
    43
    Thx, i will check that out.
    If i set my project to dx11, will it only fix the issue for people playing under dx11, of for dx9-players as well?
     
  6. Giometric

    Giometric

    Joined:
    Dec 20, 2011
    Posts:
    170
    It's the half-pixel offset thing; in D3D9 you have to offset all the content by 0.5 (half a pixel) in both X and Y to get it pixel-perfect again. OpenGL and D3D11 look correct without it. I think it's something that Unity should be dealing with automatically, but you should be able to work around it by adding an empty child GameObject under your canvas with the anchors set to each corner of the screen, and the offsets set to -0.5, -0.5, 0.5, 0.5 (Left, Top, Right, Bottom) in its RectTransform. Doing this requires that the PixelPerfect option on the parent Canvas is not checked, otherwise it will 'correct' the half-pixel offset and look wrong again. Also make sure you only do this when the D3D9 renderer is being used.
     
    tawsm and Panzerhandschuh like this.
  7. Grizmu

    Grizmu

    Joined:
    Aug 27, 2013
    Posts:
    131
    It'll only work for people using D3D11.
     
    tawsm likes this.
  8. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    We have some bugs on this already, but if you can raise another please do. It's good that we catch all corner cases.
     
  9. BTables

    BTables

    Joined:
    Jan 18, 2014
    Posts:
    61
    Confirmed DX11 fixes all my problems, not a great solution tho, looking forward to a fix on this one

    For the manual pixel alignment, does that mean all my rect transforms need to be at exact integers as we have to turn off pixel perfect?
     
  10. tawsm

    tawsm

    Joined:
    Nov 12, 2013
    Posts:
    43
    Thx Griz

    and Giometric
    for the workarounds. Looking forward to the bugfix from Unity though.
    :)
     
  11. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    It's on my list to do tomorrow or Monday :)
     
    Sebioff and amadlover like this.