Search Unity

Question Pixel art feels "blurry" when moving the camera

Discussion in '2D' started by luccapedrini, Jul 20, 2020.

  1. luccapedrini

    luccapedrini

    Joined:
    Mar 19, 2020
    Posts:
    2
    Hello, first of all I would like to say that I implemented everything that I found online specially what the documentation say about seting up cinemachine + pixel perfect camera.

    When I set up cinemachine to follow my player the tilemap gets a this laggy kinda blurry effect:
    https://imgur.com/a/XbL3NYd

    It's hard to detect at a first glance, but when you play with this happening for some time it's definitely noticeable. I've tryed another engine that has pixel compatibility out of the box and the difference is there, I came back to unity again because I really like the how the physics and rigidbody mechanic is in Unity.

    I would really like to continue developing in Unity, is there any way of fixing this?

    Let me know if you need the project to reproduce it, I have made a small one for this purpose.
     
    Kreidel likes this.
  2. cyclSunity

    cyclSunity

    Joined:
    Jun 10, 2020
    Posts:
    123
    Is your sprite filter type Point? Click your sprite > Filter Type, change it to Point. Hope this helps :)
     
  3. cyclSunity

    cyclSunity

    Joined:
    Jun 10, 2020
    Posts:
    123
    Also, I looked at your Imgur link, and I don't see any blur. It looks like a great game!
     
  4. luccapedrini

    luccapedrini

    Joined:
    Mar 19, 2020
    Posts:
    2
    Yes it is
    Like I said it's kinda hard to tell, but if you move around there is definetly some lag/blur it's hard to explain because I dont know exactly what it is. My friend was the first one to spot this so I dont think that it is a problem with my perspective on the issue, when I put unity and the other engine side by side (or one after another, thats how I tested) it's easier to see.

    And thank you for the compliment on the game :)
     
  5. cyclSunity

    cyclSunity

    Joined:
    Jun 10, 2020
    Posts:
    123
    Not trying to be mean, but if it's kinda hard to see, then maybe it can stay the same and seem normal to players.
     
  6. cyclSunity

    cyclSunity

    Joined:
    Jun 10, 2020
    Posts:
    123
    And also when you finish the game, can I have a link to an installer or the ZIP file? Thanks! :)
     
  7. Kreidel

    Kreidel

    Joined:
    Mar 13, 2019
    Posts:
    4
    Try to put compression to none
     
  8. EndlessSpiral

    EndlessSpiral

    Joined:
    Oct 29, 2018
    Posts:
    1
    We’re you able to find a solution to this? I’m running into the same thing. It’s not the end of the world, but definitely makes it feel a bit less polished.
     
  9. Chubzdoomer

    Chubzdoomer

    Joined:
    Sep 27, 2014
    Posts:
    131
  10. seanrich92

    seanrich92

    Joined:
    Oct 13, 2020
    Posts:
    6
    Hopefully unity can address this. I also have this problem where my tilemaps look blurry whenever the character moves and cinemachine is in smart/fixed update mode. However when changing to late update mode for cinemachine everything looks crisp except that the player is now the one that is blurry, even when changing my character movement update to late or update.
     
  11. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,459
    May I ask what's to address? You using a Rigidbody2D? If so, you're using interpolation to get per-frame updates right?

    FixedUpdate defaults to 50hz. This isn't your frame-rate, it's completely out of sync with it. Do you know this?

    Basically, you're asking for Unity to address this but it's not clear that you understand what you're asking Unity to do nor what your settings are.

    This is the problem with tagging onto existing threads; the assumption that because the description of symptoms sounds the same, it's the same root issue which may or not be the case. It's why we ask that devs create their own threads, put in some detail of what they're doing, what they've tried etc.

    Also,if there is a problem with Cinemachine then, so you know, here's the forums for it: https://forum.unity.com/forums/cinemachine.136/
     
  12. seanrich92

    seanrich92

    Joined:
    Oct 13, 2020
    Posts:
    6
    Apologies for being unclear with my intentions, but what could be addressed are what you mentioned such as the difference in updates (fixed vs late) that lead to this blurriness especially in the official unity docs and remedies that can help alleviate this issue so all 2D developers can benefit from this. I'll write my thoughts and my solution to this issue for others.

    My setup:
    Unity 2019.4.40f1
    Used before 2D Pixel Perfect Package 2.1.0

    Issue:
    The pixel perfect package does not fully address this and even causes issues of sudden jitter in the game. When moving the camera along with the character that is updating at fixed update, the camera causes other sprites/tiles/etc to have a certain blurriness most likely because of the rendering, which is why the late update works for them but not for the player that moves at the fixed update. Also if the PPU does not match the correct camera size, it leads to some pixel distortion (which can be addressed by pixel perfect package but causes additional issues).

    Solution for problem (maybe not the same with anyone elses):
    The only thing that alleviated this issue was having the rigidbody2d interpolate setting turned on and be moved at fixed update (not late update) which causes the cinemachine to also move at a late update. Additionally, the different PPU pixel distortion was addressed by a shader/material that does the same as this shader toy (https://www.shadertoy.com/view/ltBGWc). You can see the PPU scaling problem here side by side as well. With this shader, sprites/tiles can achieve pixel perfect at any camera size. Hopefully this helps some people who encounter the same issues and are looking for a solution.
     
    Last edited: Sep 19, 2022
    Dark_Seth likes this.
  13. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,459
    So I'm trying to not be overly critical here but instead politely state that misunderstanding fundamentally how something works (in this case physics) nearly always ends up with statements saying Unity should address/fix it even though there's plenty of material online about this subject. Using a higher level system (Cinemachine etc) that is driven by a lower level system (physics) that you might not understand is the issue.

    To qualify what I mean here, you cannot and shouldn't ever "move physics" at late-update. Physics only ever updates when the simulation runs which by default is the FixedUpdate; this is why Rigidbody2D interpolation exists because FixedUpdate isn't in sync with frame-rate. Anything else is just using physics wrong. You can, of course, ask 2D physics to run per-frame, it's a project setting in 2D physics.

    To be clear then, your "solution" here is just physics 101 i.e. if you want per-frame Transform updates then use Rigidbody2D interpolation. This isn't anything to do with Cinemachine nor PixelPerfect.

    https://learn.unity.com/tutorial/update-and-fixedupdate
    https://gamedevbeginner.com/how-to-use-fixed-update-in-unity/
    https://gamedevplanet.com/the-difference-between-update-and-fixedupdate-in-unity/
     
  14. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,459
    btw, I will add that I'm not disagreeing and that discovery of this material can be difficult at times. There's certainly a problem when devs don't know this stuff because there's a reason. I guess all I'm saying is that the reading material is there, it's just not easy to ensure everyone knows all they need to know when they come to use something.

    It certainly is the case that if there's an option to perform an action in something like FixedUpdate via Cinemachine/Animation (etc), there should be a link in its docs for further reading for sure!
     
  15. Dark_Seth

    Dark_Seth

    Joined:
    May 28, 2014
    Posts:
    140
    This has always been a issue.There are so many issues with Cinemachine + PixelPerfect camera. Especially if your PPU is 8 or 16. Do pixelsnapping on sprites. But with cinemachine is get worse. I am working on a different solution to this.
     
  16. ExpiditionVortex

    ExpiditionVortex

    Joined:
    Nov 27, 2017
    Posts:
    4
    Any updates?
     
  17. Dark_Seth

    Dark_Seth

    Joined:
    May 28, 2014
    Posts:
    140
    Nothing. Still same issue. Seems Unity can't handle this at this stage
     
  18. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    1,261