Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Pixel Perfect Preview Package

Discussion in '2D Experimental Preview' started by rustum, May 28, 2018.

  1. unity_DvOu0m5-K1bRbQ

    unity_DvOu0m5-K1bRbQ

    Joined:
    Nov 10, 2018
    Posts:
    1
    Sorry to be a bother but I'm having a bit of trouble interfacing with this great package. I'm looking for the equivalent of OnRenderImage for a pixel perfect camera with upscale render texture enabled. That's to say a place where I can run a shader on the low-rez texture, and not the full resolution version in OnRenderImage. Any help would be appreciated. Thanks!
     
  2. exzizt

    exzizt

    Joined:
    Sep 30, 2017
    Posts:
    36
    You can resolve the banding issue by enabling 32-Bit Display Buffers in the Player Settings.

    Good luck getting any help on these forums!
     
  3. zapposh

    zapposh

    Joined:
    Nov 12, 2016
    Posts:
    46
    Since upgrading to Unity 2018.3.x, I can never launch my game first time round in the editor without getting error messages:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.U2D.PixelPerfectCamera.PixelSnap () (at Library/PackageCache/com.unity.2d.pixel-perfect@1.0.1-preview/Runtime/PixelPerfectCamera.cs:111)
    UnityEngine.U2D.PixelPerfectCamera.OnPreCull () (at Library/PackageCache/com.unity.2d.pixel-perfect@1.0.1-preview/Runtime/PixelPerfectCamera.cs:151)

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.U2D.PixelPerfectCamera.OnPreRender () (at Library/PackageCache/com.unity.2d.pixel-perfect@1.0.1-preview/Runtime/PixelPerfectCamera.cs:165)

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.U2D.PixelPerfectCamera.OnPostRender () (at Library/PackageCache/com.unity.2d.pixel-perfect@1.0.1-preview/Runtime/PixelPerfectCamera.cs:177)

    If I then stop, and play again, the errors are gone and all works fine, as before.
    It happens every time, in every project, the first time I press play after loading Unity.
    Any ideas?
     
  4. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    132
    I think this package is abandoned?
     
  5. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    140
    Arbitrary zooming is the first thing we would do when we get our hands on Pixel Perfect Camera again. For now, if you are willing to modify the scripts yourself, you can try multiplying the calculated ortho size with an arbitrary 'zoom level' in PixelPerfectCameraInternal.cs, after line 166:
    Code (CSharp):
    1. orthoSize *= zoomLevel;
    You can then achieve zooming by animating the zoomLevel variable, and when you're done, reset it to 1.0f.
     
    Lars-Steenhoff likes this.
  6. HOvadia

    HOvadia

    Joined:
    Dec 25, 2014
    Posts:
    1
  7. Sly88

    Sly88

    Joined:
    Feb 22, 2016
    Posts:
    13
    I don't know if it is a good place but I will try :)

    I have some problem with the outline effect on my UI elements.
    The outline looks good only on base ratio. When I change screen resolution the outline looks weird, the outline has different sizes on edges( I attached screens).

    I use Filter Point on my assets because it is pixel art.
    Maybe you had a similar problem and you know how to fix it.
     

    Attached Files:

  8. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    140
    Hi! Manually tweaking the camera's ortho size won't work as Pixel Perfect Camera is also changing that value. Please refer to my previous post on this page and see if that workaround works for you.
     
  9. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    603
    I wanted to say that I'm excited about this package! I had several Game Maker Studio projects with faux-NES-style, low-res pixel graphics. Once Unity rolled-out their new tile map editor, I decided to try and port these projects to Unity, but could never figure out how to get the look just right and still get the smooth scrolling that I could get in GMS. This package finally solves this problem for me.

    I have one slight problem, though- My Vsync is at 60 frames per second and as long as my camera moves at a rate where the pixels per second divides evenly into the frames per second then my scrolling is buttery-smooth (aside from some random rendering spikes that I'll worry about later). 1 pixel per frame is great, but 1 pixel per 2 frames looks very nice also. If the pixels per second doesn't divide evenly, I get scrolling that is slightly jittery. It's not terrible but its not as nice.

    This is only a concern for me because some people have different monitor refresh rates. If I tune everything so that it's smooth for me, than it might not look good for others. Obviously I can include the option to check Screen.currentResolution.refreshRate and change the camera speed accordingly, but moving, for example, 72 frames per second vs 60 is different enough to change the feel of the game-play. Is there a common solution for this problem, or is it one of those great, unsolvable limitations of the universe? To be clear, I had the exact same problem in GMS but have never addressed it.
     
  10. alpineboarder

    alpineboarder

    Joined:
    Apr 11, 2013
    Posts:
    6
    Anyone else noticing bad jitters on the Z axis with this package's pixel snap enabled? Is it only XY compatible?

    (Attaching main cam to a character controller and moving it around at all speeds I'm noticing this, Never jitters on the XY oddly enough)
     
  11. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    140
    These two APIs rely on the viewport size to give you the correct result. Depending on your settings, Pixel Perfect Camera may alter the VP size. So you have to make sure to only call ViewportToWorldPoint / ScreenToWorldPoint after Pixel Perfect Camera has applied the modification to camera VP size. Calling them in the Update() callback of your MonoBehaviour should be fine after the first frame.
     
  12. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    140
    Are you moving your character in 3D space instead of on a 2D camera-facing plane? The Pixel Perfect Camera is not designed for 3D view or perspective camera.