Pixel Perfect Camera with Cinemachine & Extensions

I am working on a 2D, Top-Down Racing Game and I am trying to get it to look “pixel perfect”!

I have watched what feels like every single tutorial made on this topic, but I cannot get this to work. My character’s movement always looks choppy/jumpy.

The only way to get it to look smooth is to enable Crop Frame X, Y and Stretch Fill on the Pixel Perfect Camera component. But I do not want my frame cropped. If the device is wider or higher than the reference aspect ratio, I simply want it to show more of my level on those sides. No cropping, no black bars, no super secret magic, simply “show more level”.

Here is my setup:

Main Camera Game Object

Camera Component

  • Projection: Orthographic
  • Size: Doesn’t matter, because will get overwritten by Pixel Perfect Camera

CinemachineBrain Component

  • Update Method: Late Update
  • Blend Update Method: Late Update

Pixel Perfect Camera Component

  • Assets Pixels Per Unit: 16
  • Reference Resolution X: 240: Y 520
  • All checkboxes disabled

Follow Player Camera Game Object

CinemachineVirtualCamera Component

  • Follow: Player
  • Lens > Orthographic Size: Doesn’t matter, because will get overwritten by Pixel Perfect Camera
  • Body: Framing Transposer

Cinemachine Pixel Perfect Component

  • No settings

Cinemachine Confiner Component

  • Confine Mode: Confine 2D
  • Bounding Shape 2D: Polygon Collider 2D
  • Confine Screen Edges: Enabled
  • Damping: 0

Cinemachine Independent Impulse Listener Component

  • Defaults

On iPhone 11 Device Simulator, in Play Mode, this gives me an Orthographic Size of 14. That’s exactly what I want. However, my character’s movement looks so choppy/jumpy that its basically unusable.

Also, using Update Method Late Update instead of Fixed Update in the CinemachineBrainComponent means that the Impulse Listener / Screen Shake no longer has any effect. However, changing it to Fixed Update to get the Screen Shake to work changes the Orthographic Size to 18.66667 instead of my desired 14.

Please help!

Have you tried Smart Update for Update Method in Brain?
Could you post a recording of what you are seeing to clarify choppy/jumpy movement?

1 Like

I should add that I am using the Pixel Perfect Camera (Experimental) that comes with URP!

Things I have tried since:

  • Player > Rigidbody2D > Set Interpolate to Interpolate
  • Edit > Project Settings… > Script Execution Order > Move my player movement script above/before anything related to pixel perfect and cinemachine
  • CinemachineBrain > Set Update Method to Fixed Update, Late Update or Smart Update
  • CinemachineBrain > Set Blend Update Method to Fixed Update or Late Update

The movement stutters. Rather than moving continuously and smoothly, it looks like my player rapidly changes between moving slower and moving faster, hence leading to the stutter/jumpiness I described. The movement code seems fine, since when I remove the pixel perfect script, the movement is smooth. It seems to be caused by the player follow camera when combined with pixel perfect.

The problem appears to be common, here are some examples of other users struggling with the same issue:

How can this be resolved, please? Who at Unity is in charge of Pixel Perfect and how can I get in touch?

PS: Now testing without the Device Simulator, just plain old Game View. Issue remains.

There is an bug in the Pixel Perfect Camera behaviour that can result in stutter. I’m told that it’s been fixed, and should be in the next release of URP. The 2D team is in charge of this.

Here is a thread describing that issue. Perhaps it is what you’re seeing.