Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Cinemachine + pixel perfect camera jitters

Discussion in 'Cinemachine' started by hhotep, Jul 22, 2021.

  1. hhotep

    hhotep

    Joined:
    Jun 14, 2021
    Posts:
    2
    Hello! I'm sorry for my bad english. Here's simple setup to catch the problem: simple player movement, pixelperfect camera, cinemachine camera with cinemachine pixel perfect script, resolution 640 x 360, PPU 32. Player sprite jitters when moving, tried changing cinemachine brain properties, nothing helps. If i turn off cinemachine and cinemachine brain, and place camera with pixel perfect under player - no jitter, works fine.
    Here's my simple project with this error.

    Need help, thanks.

    Project: https://drive.google.com/file/d/1uv2-wgpvwH4uabIkJ4Uy861cPiVTaT_s/view?usp=sharing
     

    Attached Files:

  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Thanks for the upload. I opened your project and tried moving the player with the arrow keys. It's perfectly smooth, no jitter. How do I reproduce the jitter?

    EDIT: I can reproduce the jitter now
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    It's aliasing effects because of the damping. With Pixel Perfect, everything has to move in distances that are integral multiples of the pixel size. When you have damping on the camera, it will move in different amounts, which will then be rounded by the pixel-perfect system. This can produce jitter. You can see that the jitter goes away when you set the vcam's damping to 0.

    upload_2021-7-22_16-36-10.png

    If you turn Cinemachine off, you can create jitter by adjusting the player move speed (the player won't jitter in the frame because it's locked to the camera, but the background motion will not be smooth).
     
  4. hhotep

    hhotep

    Joined:
    Jun 14, 2021
    Posts:
    2
    I put damping to 0 as on ur pic, but jittering is still there. Also, i turned cinemachine off, made camera independent of player, and when player moves it jitters. Can you give advice on solving this jitter?
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    You need to carefully control the size of the player movement, so you do not get rounding issues when the positions are clamped to pixel boundaries.
     
  6. Physics_Wizard

    Physics_Wizard

    Joined:
    Sep 11, 2020
    Posts:
    1
    MANY MANY years on, just wanted to say this solved the issue i was having with cinemachine and pixel art, so if anyne finds this in 2023+ it is still worth a shot.