Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Unity UI Blurry Text At Odd Resolution Sizes

Discussion in 'Unity UI & TextMesh Pro' started by bentontr, Nov 9, 2018 at 8:29 PM.

  1. bentontr

    bentontr

    Joined:
    Jun 9, 2017
    Posts:
    5
    Hello,
    I'm running into an issue with UI text where it is quite blurry at odd resolutions. For example everything is fine at 1024x768, but becomes blurry at 1023x768. I've found that the Canvas has a fractional position at these resolutions because it can't be evenly divided (of course). This is causing all the text to become blurry for some reason.

    This is pretty easy to reproduce if someone else wants to try it out. Has anyone else ran into this problem? Just to be clear this does not have to do with general text clarity, the text itself is fine (normally). A simple solution would be to simply clamp these values, however, it doesn't seem like you can really drive the canvas size or position besides using a scalar (in screen space).
     
  2. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    450
    yes, the UGUI Text often produces blurry text. There are two solutions:
    1. Increase the "Reference Pixels Per Unit" in the Canvas Scaler (will maybe mess up your existing UI)
    2. Do not use the default UGUI Text. Instead go for the (free) asset Text Mesh Pro (if you are using Unity 2017+, import it via the Package manager).
     
  3. bentontr

    bentontr

    Joined:
    Jun 9, 2017
    Posts:
    5
    Thanks for the response, but actually this is also a problem with textmeshpro bitmap fonts as well (Not SDF). Like I said above, this is a very specific issue caused by the canvas have a non-integer position at odd screen resolutions (odd numbers). My font is already pixel perfect, but only when the height and width of the window are divisible by two.

    Here is a simple example using unity UI text:


    One I took at 1024 x 768 canvas position: (512, 384), one at 1023 x 768 (511.5, 384) and the text is blurry.

    Edit: Slight correction, it seems TMP SDF fonts are having a similar distortion in this case.
     
    Last edited: Nov 12, 2018 at 10:03 PM
  4. bentontr

    bentontr

    Joined:
    Jun 9, 2017
    Posts:
    5
    Still don't have a good solution for this. Does anyone have any ideas?