Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Pixel Perfect Camera / Pixel scaling

Discussion in '2D' started by MartinMouritzen, Jan 17, 2022.

  1. MartinMouritzen

    MartinMouritzen

    Joined:
    Jul 3, 2017
    Posts:
    9
    Greetings.
    I am making a retro pixel art game, and I feel like I've now read every single post about pixel scaling, and I've tried both the 2D Pixel Perfect camera and a "Pixel Perfect Camera" in the asset store.

    However, no matter what, my pixels get's distorted, and in a game with this low resolution, it is really noticeable.

    I am at my wits end here, and would so so love to find a solution.

    Not sure what's relevant but here's some info about my game:

    Main camera:
    upload_2022-1-17_21-55-50.png

    Grid & Snap settings:
    upload_2022-1-17_21-52-6.png
    (that's 0.0625, because I did 1 / 16, which other threads suggested based on my PPU)

    I set my sprites to 16 PPU, Point (no Filter) and no compression.
    upload_2022-1-17_21-54-51.png



    This is the result I am getting, where all the pixels should of course be the same scale, but some are 4x4, some are 5x5 and some are even 5x4

    upload_2022-1-17_21-49-19.png

    Thanks for reading so far, and please any suggestions are more than welcome!
     

    Attached Files:

  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
  3. rarac

    rarac

    Joined:
    Feb 14, 2021
    Posts:
    570
    dont break your head with this, pixel perfect in unity is possible but worthless endeavor, its better if you use another engine that is pixel perfect by default. Unity is a 3d engine and 2d is only a bonus feature, you can use it to make pixel art games but for true pixel perfect you have to really know what you are doing and you might aswell code your own engine at that point.

    If you really want to use unity you can, just dont mind to much about small distortions that will happen by 1 pixel or another, even if you finally manage it the players wont even notice the difference
     
  4. MartinMouritzen

    MartinMouritzen

    Joined:
    Jul 3, 2017
    Posts:
    9
  5. MartinMouritzen

    MartinMouritzen

    Joined:
    Jul 3, 2017
    Posts:
    9
    I appreciate what you're saying. And I could probably ignore it for the game itself, but especially the UI elements looks horrible when distorted. :(
     
  6. rarac

    rarac

    Joined:
    Feb 14, 2021
    Posts:
    570
    i dont know much about pixel perfect camera but I see your reference resolution is 4:3, if you have a 16:9 screen it will never yield a pixel perfect result, also even if its 16:9 it wont be pixel perfect unless the screen native resolution is multipliable by an even number. For example a 960x540 resolution game will translate well to 1920x1080 because (540x2 = 1080, so 2 pixels x2 = 4 pixels, but it wont translate to 1280x720 because 540x1.5 = 720, and 2 pixels x1.5 = 3 pixels and there is no way to convert 2 pixels into 3 without anti alias, destroying the pixel art.
     
  7. CyRaid

    CyRaid

    Joined:
    Mar 31, 2015
    Posts:
    134
    I find that always making sure every game object stays on an int xyz (no fraction) it seems to work nice. Just gotta be weary if you use physics that depend on fractional movement. In my case I did the jumping and moving manually, classic style.
     
  8. SHetsko

    SHetsko

    Joined:
    Jan 29, 2021
    Posts:
    1
    wut