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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Bad / “blurry” pixel rendering of a 2d sprite

Discussion in '2D' started by iegor3, Jun 23, 2015.

  1. iegor3

    iegor3

    Joined:
    Jan 17, 2015
    Posts:
    3
    Hello,

    I'm testing things in unity but I've run into this problem and i can't solve it...
    I have the following configuration:



    Images of the problem:



    As we can see in the problem images the pixels are blur or strange and i need the pixels not to be clipped or strange... i read that a possible solution to that is to create a script for Pixel Perfect but i can't get it work... ¿Any suggestion? Thanks!!

    Skype: iegor3
     
    Last edited: Jun 23, 2015
  2. Shadeless

    Shadeless

    Joined:
    Jul 22, 2013
    Posts:
    136
    Hi there,

    Achieving a pixel perfect look comes down to the cameras orthographic size, and the pixels per unit ratio.
    The guys at Unity very recently (19 June) posted on the blog about this. Give it a thorough read. :)
    http://blogs.unity3d.com/2015/06/19/pixel-perfect-2d/

    I use a pixel per unit of 10 on all my sprites, and set my Snap Settings to 0.1 and use Ctrl key to position stuff around.
    (I make sure that none of my transform are at a position that has more than 1 decimal. So if I have 56.23 I set it to 56.2).

    As for the orthographic size, as it says on the article. It depends on the resolution. For 1280x720 I use an orthographic size of 18. There are multiple values that work for every resolution, depending on the zoom level that you want. :)

    But remember that it will only be pixel perfect if you're viewing it at that Resolution. You will want a script that changes the orthographic size depending on the Resolution of the screen if you want it to work for more resolutions. And also if your editor window is smaller, it will appear imperfect in the editor.

    The reason that I use a pixel per unit value of 10 is because I have a moving camera and somehow it's a magic number that the camera likes.

    Hope this helps. :)
     
    theANMATOR2b, TempestMia and sluice like this.
  3. iegor3

    iegor3

    Joined:
    Jan 17, 2015
    Posts:
    3
    Thanks for the reply! I will try to follow all you said.
     
  4. Cherno

    Cherno

    Joined:
    Apr 7, 2013
    Posts:
    515
    I ran into the same problem today. It occurs when a large sprite with FitlerMode Point becomes too small. My solution was to simply make the sprite image smaller, however it was just a GUI frame image so probably not applicable in your case.
     
  5. iegor3

    iegor3

    Joined:
    Jan 17, 2015
    Posts:
    3
    Thanks for the responses.

    I tried to set the camera ortographic size to the right value and yes it appears to be pixel perfect but it's too big.
    Here an image:


    The image of what i want:

    I need to get the view as the image above but with a good view of the pixels.

    Thanks!
     
  6. Loius

    Loius

    Joined:
    Aug 16, 2012
    Posts:
    546
    Your game view is set to "Free Aspect", which means it's going to display at "whatever resolution it happens to be". You'll have to set it to your exact resolution - something like this image - to get rid of the various smoothing / filtering effects that are going on in the resolution conversion.

    (click the "Free Aspect" button in the top left to change it; you can add a specific resolution such as 800x600 like I've done)

    upload_2015-6-28_13-19-5.png
     
    theANMATOR2b likes this.
  7. Durium

    Durium

    Joined:
    Feb 1, 2020
    Posts:
    30
    This made it way better! I am still seeing that the pixels are weird though.. Some lines are smaller or thicker than other... hmm any ideas?