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

2D Sprite loses details when size is reduced

Discussion in '2D' started by AndressMartin, Jul 23, 2018.

  1. AndressMartin

    AndressMartin

    Joined:
    Jun 24, 2017
    Posts:
    15
    So, I have this simple sprite, which I created in proportion to a 1080p canvas in Photoshop, so I knew exactly the size that the character would have in-game. Here is the image:

    1c08c7f7-8798-4fb3-ad0f-417f7495d0cb.jpg

    However, when I imported it to Unity & resized the camera to make the character as small as I wanted it to be, I noticed that the sprite lost its shape and overall details because of the distance:

    Untitled-1.jpg

    If I draw in a bigger file size, will I fix this problem, or is this something that I have to configure in Unity?
     
    Last edited: Jul 24, 2018
  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    "pixels per unit" on the sprite importer tells you how many pixels in the image represent 1 unit in the coordinate system. Set the camera up first to whatever coordinate system you're wanting to use, even if its 1920x1080 which would be an orthographic size of 540. Then for that you'd set the pixels per unit on the sprite importer to 1. If you plan to have a larger world you may want to reduce the ortho size and bump up the pixel units.
     
    AndressMartin likes this.
  3. AndressMartin

    AndressMartin

    Joined:
    Jun 24, 2017
    Posts:
    15
    Thank you for the answer! Sorry for the late reply.
    Interesting, I knew about the 540 camera size for that resolution, but I thougth that was something that I had to watch out for when doing pixel-art and that I could resize my camera without a problem if I was using hand-drawn assets.

    I also found a couple of articles that suggest that nowadays artists should strive for 2x or even 3x their target resolution to make HD assets. I didn't consider that as well, this might be one of the reasons that a portion of this asset fades in the distance.
     
  4. kapopixel

    kapopixel

    Joined:
    Apr 2, 2017
    Posts:
    54
    @AndressMartin, this is probably the most asked question about 2D game development and Unity has no explicit tutorial or documentation about this. I think, they don't because they don't want to scare newbies and persist easy-looking image of 2D game development.

    Unfortunately there is no solution to this. You can easily downscale your images in Photoshop and they will look great; but when you do this in Unity, they will look messed up. When you start moving your camera they will even get worse, you will see a lot of small white points moving and your lines are changing on your beautiful sprites.

    Even you set your scene as @imaginaryhuman suggested, you will have huge problems when your are displaying your game in different resolution other then your reference resolution such as awkward resolution of iPhone X (1125 x 2436). They will tell you to set your textures to bilinear filtering mode, but this does not help even a bit. Because this is how it works and this is a problem due to pixel to unit (1:1) thing and it is not directly related @2x @3x sprites as you think. The most recent thread asked about this is:
    https://forum.unity.com/threads/2d-hq-graphics-on-varying-screen-sizes.526524/#post-3561441
     
    AndressMartin likes this.
  5. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    There is a new 'pixel perfect camera' package you can install to you project which helps to simplify this somewhat.
     
    AndressMartin and kapopixel like this.
  6. AndressMartin

    AndressMartin

    Joined:
    Jun 24, 2017
    Posts:
    15
    Sorry for the late reply, I always forget to check the forums.

    Thanks for the link for that thread @kapopixel , It's been really helpful!

    Actually, increasing the size of my assets (drawing in 2x or 3x the size of my target resolution) seems to have improved the problem somewhat, but, exactly as you mentioned, things get noticeably weird if I change the resolution.

    I will post an update if I find something relevant to add that hasn't been pointed out yet or if I manage to fix my problem entirely.

    @imaginaryhuman Thanks for poiting that out, I saw that somewhere but I forgot to check it! :)