Search Unity

Art is Distorting in 2.5D Project

Discussion in 'General Graphics' started by Payaso_Prince, Apr 10, 2021.

  1. Payaso_Prince

    Payaso_Prince

    Joined:
    Jul 17, 2017
    Posts:
    92
    Hey guys!

    I am working a game that uses 2D images in a 3D environment. I'm having a massive problem with the image quality when the camera is zoomed out further. I've looked into this issue quite a bit and can't seem to find a concrete resolution. Really hoping someone can assist with this.

    I'm saving this character art as a .PSD at 1920 x 1080 and importing into Unity with these settings:

    • Texture Type: Sprite (2D & UI)

    • Pixels Per Unit 100

    • Filter Mode Point (no filter)

    • Generate Mip Maps disabled

    • Compression None


    Also, the game is set to Full HD 1920 x 1080 and I have turned off anti aliasing.

    However, the art starts to distort and lose quality when the camera is pulled back a bit.
    This screenshot is from running the game maximized:




    While I was investigating this I found some people had luck resolving this with the Pixel Perfect Camera Component. I have attached it to my camera and it doesn't seem to be changing anything. I believe the settings in Pixel Perfect Camera to be correct as well:

    • Assets Pixels Per Unit is set to 100

    • Reference Resolution is 1920 x 1080
    This is a huge obstacle for me and any sort of guidance would be GREATLY appreciated! Thanks so much for taking the time to read. :) - Leo
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,342
    1) The Pixel Perfect Camera and similar assets only work if your game is 2D. Or more specifically if your game is using an orthographic projection. It's impossible to be pixel perfect in a 3D perspective camera if you're moving the camera around.

    2) Your sprite is around 650 pixels high and you're displaying it at around 120 pixels high. Pixel Perfect Camera and related assets and tools are for displaying low resolution pixel art. Like for the aesthetic of an emulated old 2D console game, usually displaying a small sprite at 4x the resolution or more. That's not what you're doing here at all. Here you have a sprite and you're displaying at less than 1/5th the resolution.

    You want mip maps. You want bilinear or maybe even trilinear filtering. But you'll probably be annoyed that the sprite looks a little blurry in that case compared to if you scaled it down in Photoshop or Gimp. I explain why and how to fix it here:
    https://bgolus.medium.com/sharper-mipmapping-using-shader-based-supersampling-ed7aadb47bec

    And someone posted a sprite shader using a version of the solution described in the above article here:
    https://forum.unity.com/threads/how...en-while-rotating-solved.651841/#post-4397548
     
    Payaso_Prince likes this.
  3. Payaso_Prince

    Payaso_Prince

    Joined:
    Jul 17, 2017
    Posts:
    92
    Oh, goodness, wow!

    Bgolus I can't thank you enough for taking the time to give me such an in detail response. You really cleared things up for me immensely!

    I have since switched from point to Bilinear and turned on Mip Maps and that alone has made a colossal difference. That being said, when I play with the settings I can't see a difference in quality when I switch from Box > Kaiser or adjust the Aniso level, even though I'm displaying my sprite at 1/5 of it's resolution. I'm wondering if this because the design is just that simple.

    Here, is the new result. I don't feel that I'm savvy enough to tell, compared to the first image above, would you consider this blurry?



    I took the time to read through everything in the first link you provided. I can see how much of a difference it makes, however, I'd be lying if I said a lot of it didn't go over my head.
    Ultimately, I just need to use the TextureSSAA.shader that you provided to me in the second link, right? I added the shader to my gameobject and it does not appear to be changing anything. Is this because my sprite is not animating yet, i.e, does this shader only make animations less blurry?

    Thanks again SO much for your time. You're my hero! :)
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,342
    The benefits of Kaiser can be hard to notice. I literally never use it for anything. A small few people are very bullish on its importance, but you won't find many Unity devs say that since the Kaiser filter was broken for the last half a decade and made textures look way worse until just recently. (As mentioned in that long article I posted.)

    See the article I linked to again. I go into why anisotropic filtering sometimes doesn't seem to have an effect on quality. TLDR; surfaces facing towards the camera get no benefit.

    I wouldn't. No. What is too sharp vs. too soft is entirely subjective though.
     
    Payaso_Prince likes this.