Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to solve pixel perfect jittering?

Discussion in '2D' started by Deleted User, Jun 12, 2023.

  1. Deleted User

    Deleted User

    Guest

    Hi,
    If you've made a pixel art game in unity, you've got the jittering issue.
    Anyone able to solve this problem?
    How to make pixel perfect camera smooth?

    Code (CSharp):
    1. if(isGrounded)
    2.         {
    3.             if (x == 0)
    4.             {
    5.                 pixelPerfectCamera.enabled = false;
    6.                 ChangeAnimationState(IDLE);
    7.             }
    8.             else
    9.             {
    10.                 pixelPerfectCamera.enabled = true;
    11.                 ChangeAnimationState(RUN);
    12.             }
    13.         }
    14.         else
    15.         {
    16.             pixelPerfectCamera.enabled = false;
    17.             ChangeAnimationState(JUMP);
    18.         }
    I tried to solve the problem like this. But it is doesn't feel right.
    Should I use a different game engine for pixel art game?
     
  2. venediklee

    venediklee

    Joined:
    Jul 24, 2017
    Posts:
    143
  3. Deleted User

    Deleted User

    Guest

  4. venediklee

    venediklee

    Joined:
    Jul 24, 2017
    Posts:
    143
    It works fine for me with a basic setup.

    Make sure of these:

    • your sprites are 8x8 or its multiples like 16x8 etc.(since your assets pixels per unit is set to 8
    • your snap settings in the scene is correct
    • your objects in the scene are snapped after setting the snap settings
    • game view zoom is set to 1x(this may not have an effect, I am not sure, but do it anyways)
    • game resolution is a multiple of the reference resolution on pixel perfect camera
    • your sprites are uncompressed and with point filter(no filter)

     
  5. gooby429

    gooby429

    Joined:
    Aug 13, 2019
    Posts:
    110
    you can try settings your pixel perfect camera pixels per unit to a higher multiple of 8 (in your case). i use 8x8 sprites in my game as well and found 24 works nice, but you can try 16, 32, etc. as you see fit
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,468
    Start with the basics of the movement. How are you moving this? If you're adding forces to a Rigidbody2D then you should always use Interpolation setting on the Rigidbody2D so it updates per-frame instead of every FixedUpdate.
     
  7. karderos

    karderos

    Joined:
    Mar 28, 2023
    Posts:
    376
    to be like celeste will be a grand endeavor, unity is a 3d engine and the 2d features are just a bonus, its going to be extremely hard to be absolutely pixel perfect