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. Dismiss Notice

does this exist?

Discussion in '2D' started by luniac, Mar 7, 2015.

  1. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    596
    So im making a 2d app and got the TextMesh Pro plugin and its pretty awesome, essentially makes text look perfectly crisp no matter what device resolution im running.

    Does this concept exist for 2d sprites as well to avoid blurriness with higher resolutions, so i can scale my sprites to fit the device but maintain a pixel perfect look?

    Right now i use autoscale FitVisible camera mode by 2d toolkit which is MASSIVELY awesome on it's own when combined with letterboxes because it keeps
    http://www.2dtoolkit.com/docs/latest/reference/tk2dcamera.html

    For android i develop my whole game for the highest preview resolution in editor 800x1280, so my whole game gets downscaled by the 2dtookit camera for any lower resolutions which i think doesn't mess with quality, at least blur wise...

    But if some new phone gets released with higher and higher HD quality, the textmesh text in my game will look excellent while the sprites get blurrier and blurrier.

    I guess what im asking is how to make sprite have pixel perfect quality automatically at any size.
     
  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    A font mesh is scalable geometry, meaning you can resize it and still have enough information inbetween the pixels etc to make it look smooth, due to the edges of triangles. But with a sprite, its based on a bitmap/image, with a fixed amount of resolution, so if you make the sprite bigger there is no extra information to reveal more details. You either need a higher resolution sprite which you then scale down for lower resolutions, or you need to stop using textures and use some kind of vector objects/mesh. Note that even scaling meshes has a certain limit to how much you can zoom in before you see pointed corners and flat edges instead of the illusion of curves.

    You won't therefore be able to use a single texture for all resolutions and have it be pixel-perfect on any more than 1 resolution. In any other resolution it's going to have to bilinear filter and average pixes values to try to get an approximate idea of what the pixel should be. You can use point sampling, though, to make it use the true original colors from pixels, but that means it will also begin to skip entire columns and rows of pixels, and doesn't work well with dynamic zooming because different colors pop in and out of being displayed creating a flicker.
     
  3. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    596
    Interesting interesting, i don't know much about the topic.
    So if i don't use any zooming in my 2d game, point sampling would be preferable to bilinear or trilinear? even though it does look a little more grainy.
     
  4. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    596
  5. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    If you don't zoom the sprite in realtime then point sample can be ok ya. It depends though... if you scale the sprite to an exact multiple of its original size it will look best, otherwise it has to have an unusual number of duplicated or missing columns of data. Especially fine details or one-pixel details will be affected.
     
  6. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    596
    i see, thanks.
     
  7. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    A great reason why development assets should, as much as possible (always), be created at the highest resolution possible - then scaled down for in-game use for the deployment platform.
    And scaling assets down is always preferred for visual accuracy to scaling up.
    Create new build with development assets re-title HD or Remastered! :)