Pixel Perfect and jittering

My player and objects has jittering behaviour when i'm using "Upscale Render Texture" parameter in Pixel Perfect Camera. If damping equals to 0 then player is not jittering but surrounding objects are a little bit.

GIFs:
Damping: 0

[spoiler]

selfassureddefenselesscondor

[/spoiler]

Damping: 2

[spoiler]

repulsivedishonestfowl

[/spoiler]

Objects settings:
Main Camera

[spoiler]

[/spoiler]

Cinemachine

[spoiler]

[/spoiler]

Player

[spoiler]

[/spoiler]

Code:
Player's movement code

[spoiler]

using UnityEngine;

[RequireComponent(typeof(Rigidbody2D))]
public class PlayerMovement: MonoBehaviour
{
    [SerializeField, Min(0f)] private float _speed = 0f;

    private Rigidbody2D _body = null;

    private void Awake()
    {
        _body = GetComponent<Rigidbody2D>();
    }

    private void FixedUpdate()
    {
        var move = new Vector3
        {
            x = Input.GetAxisRaw("Horizontal"),
            y = Input.GetAxisRaw("Vertical")
        }.normalized * _speed;

        _body.velocity = move;
    }
}

[/spoiler]

Static objects snapped to the grid. Is there any way to fix this jittering?

Unity version: 2021.1.0f1
URP version: 11.0.0

Are you moving it by using physics?

Yep. Movement code:

using UnityEngine;

[RequireComponent(typeof(Rigidbody2D))]
public class PlayerMovement: MonoBehaviour
{
    [SerializeField, Min(0f)] private float _speed = 0f;

    private Rigidbody2D _body = null;

    private void Awake()
    {
        _body = GetComponent<Rigidbody2D>();
    }

    private void FixedUpdate()
    {
        var move = new Vector3
        {
            x = Input.GetAxisRaw("Horizontal"),
            y = Input.GetAxisRaw("Vertical")
        }.normalized * _speed;

        _body.velocity = move;
    }
}

edit: I tried to move player transform instead of rigidbody but jittering still here.

Ok have you tried to change the Update method to FixedUpdate in the Cinemachine inspector?
Another thing you can do is to use the experimental PixelPerfect Camera that comes with the URP.

Update method is set to SmartUpdate but I tried to set it to FixedUpdate and LateUpdate but it didn’t help.

I’m already using PixelPerfect Camera from URP package. Any other suggestion? I’m lost :frowning:

Ok but, just to be sure, the picture you posted is using Cinemachine’s PixelPerfect Camera, and you have replaced it with URP’s later, is that right?

It was URP from the start.

Ok I was referring to this component, you can give it a try
7072489--840931--upload_2021-4-24_13-14-42.png

Sorry, I don’t quiet understand what you want me to do. You want me to delete Cinemachine Pixel Perfect from VCam?

Exactly.

And use the other component in the object of your camera.

@ThundThund Still jittering.
images

[spoiler]

[/spoiler]

Mmm that's strange, that worked for me (my game had camera jittering as well). They fixed the pixel perfect camera recently.

Strange indeed. What is your unity version?

7072534--840934--upload_2021-4-24_13-38-32.png

The only difference I see is the Blending Mode.
My Unity version is 2020.3.4.

7072540--840937--upload_2021-4-24_13-40-5.png

I guess your objects aren’t jittering because of the high reference resolution. I tried and it works for me but now rotation isn’t pixelated.

Obviously the jittery movement occurs because when using upscale render all the movements are happening at absolute integer values and theres no smoothing between these steps what really makes this feature useless unless you are using really high pixel resolution so that the steps are smaller and not so noticeable or you make some kind of shader that smooths the movement or use this technique discussed in this thread https://discussions.unity.com/t/829087
Though i wish unity would add some sort of movement smoothing to the upscale render feature making it usable as ive not seen any or many games use this feature because of the jitter and these threads about pixel perfect jittering keeps popping up regular basis because of it.

3 Likes

You need to add the Cinemachine pixel perfect extension to the cinemachine.

Also thanks! Helped changing to Fixedupdate