Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Issue with PixelPerfectCamera script and sprite masks...

Discussion in '2D Experimental Preview' started by exzizt, Jan 20, 2019.

  1. exzizt

    exzizt

    Joined:
    Sep 30, 2017
    Posts:
    78
    I'm having very strange behaviour with sprite masks that are caused by the PixelPerfectCamera script on Android devices only (I have only tested the game on PC and Android and it is only being released on Android):
    upload_2019-1-20_15-23-28.png
    As you can see, the sprite mask does not work properly for some reason when stretch fill is disabled.
    What could be the solution to fix this? It is annoying because I have an option in the Options menu to disable stretch fill if the user wants to, as it is a bit of a performance hit (I'm pretty sure) for older phones to have stretch fill enabled.

    Please let me know how to go about fixing this! I will reply as promptly as I can.

    Edit:
    Might as well try and kill two birds with one stone here...
    Another issue I'm experiencing with the camera script on all platforms is when stretch fill is enabled it seems to get rid of the "crisp pixel look" and instead adds an "anti-aliased/bilinear-filtered look" on the graphics, as you can see here:
    upload_2019-1-20_15-23-47.png
    What I want to achieve is the "crisp pixel" look.

    I was able to dive into the code actually achieve this by changing this line of code:
    Code (CSharp):
    1. activeRT.filterMode = m_Internal.useStretchFill ? FilterMode.Bilinear : FilterMode.Point;
    I modified "FilterMode.Bilinear" to "FilterMode.Point", and it worked, however, I noticed it made my phone screen's actual pixels seem to have a weird grid effect and very pronounced. This effect is noticeable in the very first attached image. Any way to solve this?
     
  2. exzizt

    exzizt

    Joined:
    Sep 30, 2017
    Posts:
    78
    Is anyone able to lend a hand?
     
  3. exzizt

    exzizt

    Joined:
    Sep 30, 2017
    Posts:
    78
    Zzz... Anyone?