Articles / 2D and pixel art

What Is Unity's Pixel Perfect Camera? PPU and Reference Resolution Explained

Learn how to keep pixel art sharp and clear, along with two important settings, in this beginner-friendly guide.

What is the Pixel Perfect Camera?

The Pixel Perfect Camera is a camera component for 2D games in Unity. It helps keep pixel art crisp and clear at different resolutions and ensures stable movement. In the official documentation for Unity's Universal Render Pipeline (URP), this feature is covered under 2D Pixel Perfect. To use it, add the component to the Main Camera GameObject in your Scene.

Pixel art looks its best when every pixel has the same size on screen. However, depending on the camera settings and screen resolution, pixel widths can become uneven and outlines can look blurry. The Pixel Perfect Camera helps prevent these issues by automatically adjusting how the image is scaled.

Why does pixel art lose its sharpness?

For example, suppose you create pixel art at 320 × 180 pixels and display it on a 1920 × 1080 screen. The screen is exactly six times larger in both dimensions, so each source pixel is displayed as a clean 6 × 6 block of screen pixels.

On a 1366 × 768 screen, however, the image cannot be scaled by six. The available scale is approximately 4.27×. When the scale factor is not an integer, some source pixels may be displayed as four screen pixels wide while others are five pixels wide. This makes the pixel widths look uneven and is one of the main causes of distorted-looking pixel art.

The Pixel Perfect Camera avoids this problem by rendering at the largest integer scale that fits the screen. In the example above, it renders at 4× and handles the remaining space, for example by adding black bars.

To use the Pixel Perfect Camera effectively, it is important to understand two values: PPU and Reference Resolution. We will look at each one below.

What is PPU (Pixels Per Unit)?

Unity uses units as the units of measurement for distances in the world. PPU indicates how many pixels correspond to one world unit. In the Pixel Perfect Camera Inspector, this setting is named Assets Pixels Per Unit.

For example, consider a 32 × 32 pixel Sprite:

PPUSprite size in world unitsDisplayed size
321 × 1 units1× (original size)
162 × 2 units2× larger
640.5 × 0.5 unitsHalf size

If different Sprites use different PPU values, their sizes in the world will not share a consistent scale, making them harder to work with. For this reason, it is common to use a consistent PPU throughout the project. A typical approach is to match the PPU to the size of the primary tile in your pixel art: use 16 for 16 × 16 tiles, or 32 for 32 × 32 tiles.

PPU is set in two places: the Camera and the Sprite

There are two PPU settings: the value on the Pixel Perfect Camera and the Pixels Per Unit value in each Sprite's import settings. When these values match, the Sprite is displayed at its intended size. If they differ, the on-screen size changes, and a non-integer scale can make pixel widths uneven. As a general rule, it is safest to use the same value for both.

What is Reference Resolution?

Reference Resolution is the original resolution that your assets are designed for. In other words, it defines the dimensions, in pixels, that you use as the baseline when designing your game. For example, if you set it to 320 × 180, the game is designed around a view that is 320 pixels wide and 180 pixels high.

If the actual monitor has a higher resolution, the Pixel Perfect Camera scales the image up by an integer factor (2×, 3×, and so on). This is how it keeps the pixels sharp instead of blurry.

What is the difference between higher and lower values?

  • Higher values (for example, 480 × 270 or 640 × 360): More pixels fit in the view, allowing you to show finer artwork and more visual detail.
  • Lower values (for example, 256 × 144 or 320 × 180): Individual pixels appear larger, creating a more traditional retro-game look.

For a 16:9 monitor, using a 16:9 Reference Resolution helps reduce the likelihood of black bars. The following are common resolutions that scale to fill a 1920 × 1080 screen by an exact integer factor: 320 × 180 (6×), 480 × 270 (4×), 640 × 360 (3×), and 960 × 540 (2×).

How PPU and Reference Resolution work together

These two values determine the size of the game world visible through the camera.

Visible world size (units) = Reference Resolution ÷ PPU
Orthographic Size = Reference Resolution height ÷ (2 × PPU)

For example, if the Reference Resolution is 320 × 180 and PPU is 16:

  • Visible area: 20 world units wide × 11.25 world units high (320 ÷ 16, 180 ÷ 16)
  • Equivalent Orthographic Size: 5.625 (180 ÷ (2 × 16))

The Pixel Perfect Camera component performs the calculations needed to scale the viewport when the resolution changes. The calculations above are intended as a guide to help you understand how much of the world is visible.

Screen resolution and integer scaling

With a Reference Resolution of 320 × 180, the maximum integer scale for each monitor resolution is as follows:

Screen resolutionLargest integer scale that fitsRemaining space (width × height)
1920 × 10806×None
1366 × 7684×86 × 48 pixels
2560 × 14408×None
3840 × 216012×None

When there is unused space, the Pixel Perfect Camera can handle it in either of the following ways:

  • Show black bars in the unused areas and display only the area defined by the Reference Resolution.
  • Keep the integer scale but expand the visible area to fill the screen without black bars.

The Crop Frame settings, explained in the next section, control how the viewport is handled.

Key Pixel Perfect Camera properties

The Pixel Perfect Camera Inspector includes the following properties. Names and available options may vary slightly depending on your Unity version.

PropertyDescription
Assets Pixels Per UnitThe number of pixels that make up one world unit in the Scene. Match this value to the Pixels Per Unit values of all Sprites in the Scene.
Reference ResolutionThe original resolution your assets are designed for.
Crop FrameControls how the viewport is handled when the aspect ratio differs.
Grid SnappingControls pixel snapping and render-texture upscaling behavior.
Current Pixel RatioThe size ratio of rendered Sprites compared with their original size.

Crop Frame

Crop Frame crops the viewport according to the selected option and adds black bars to match the Reference Resolution. The bars ensure that the Game view fits within the full-screen resolution. In our tool, the Black bars option under “Frame handling” provides a similar display.

Grid Snapping

The Grid Snapping property provides two options:

Pixel Snapping: When enabled, Sprite Renderers snap to a grid in world space at render time. The grid size is based on the Assets Pixels Per Unit value. This prevents subpixel movement and makes Sprites appear to move in pixel-by-pixel increments. It does not affect the Transform positions of GameObjects.

Upscale Render Texture: By default, the Scene is rendered at the pixel-perfect resolution closest to the full-screen resolution. When this option is enabled, Unity renders the Scene to a temporary texture at a resolution as close as possible to the Reference Resolution while maintaining the full-screen aspect ratio. It then upscales that texture to fill the screen. The resulting pixels are unaliased and unrotated, which may be a desirable visual style for some projects.

Current Pixel Ratio

This property shows how many times larger or smaller Sprites are rendered compared with their original size. It is useful for checking the current scaling when you change the monitor resolution or Reference Resolution.

Preparing your Sprites

For best results, prepare your Sprites as follows before using the Pixel Perfect Camera:

  1. After importing your Sprites, set the Pixels Per Unit value to the same value for all of them.
  2. In the Sprite Inspector, set Filter Mode to Point.
  3. Set Compression to None.
  4. In the Sprite Editor, set Pivot to Custom and Pivot Unit Mode to Pixels. This lets you set the pivot in pixel coordinates. When you drag the pivot, it automatically snaps to pixel corners. If Sprite Mode is set to Multiple and the texture contains multiple Sprites, configure the pivot for each Sprite element.

Unity Snap Settings

To keep Sprite movement aligned to pixel increments, configure the project's Snap Settings as well.

  1. Open Edit > Snap Settings from the menu.
  2. Set Move X/Y/Z to 1 ÷ PPU. For example, if PPU is 100, use 0.01.
  3. Snap Settings are not applied automatically to GameObjects that are already in the Scene. Select each existing GameObject and choose Snap All Axes.

Recommended setup workflow

  1. Choose a PPU: Base it on the pixel dimensions of your primary tile, and use the same value for your Sprites.
  2. Prepare your Sprites: Set Filter Mode to Point and Compression to None.
  3. Choose a Reference Resolution: Consider the level of detail you want and the aspect ratio of your target display (often 16:9).
  4. Test on common monitor resolutions: Check whether the image scales by an integer factor at resolutions such as 1920 × 1080, and see how much unused space remains.
  5. Choose how to handle unused space: Use Crop Frame to decide whether to crop the viewport and add black bars.

Changing these values late in development may require you to redraw artwork or adjust your screen layout. It is best to decide on them early in the project.

Try it with our tool

Our Pixel Perfect Camera Preview tool lets you enter PPU and Reference Resolution values and see how Sprites and terrain will look on screen. You can also check integer scale factors for different monitor resolutions, black-bar dimensions, and whether Sprite sizes align with the pixel grid. Use it to experiment before settling on your settings.

This article is based on the Unity documentation: 2D Pixel Perfect (Universal RP 14.0). Property names and available settings may differ between Unity versions. Be sure to consult the documentation for the version you are using.

← Back to all articles