# Add a pixel perfect camera

> Set up your sprites for compatibility with the Pixel Perfect Camera component.

The pixel perfect camera in the Universal Render Pipeline (URP) automatically adjusts the camera resolution so that sprites render with perfect pixels at different screen resolutions. This prevents pixel art looking blurry, or distorting when sprites move or rotate.

> **Important:**
>
> The pixel perfect camera is included by default when you [set up a project for 2D games with the Universal 2D template](/engine/6000.5/manual/unity2d/2d-game-development/setup-project-2d-game.md). Don't install the separate [2D Pixel Perfect package](https://docs.unity3d.com/Packages/com.unity.2d.pixel-perfect@latest), which works only with the Built-In Render Pipeline.

Follow these steps:

1. Set up your sprites for the pixel perfect camera.
2. Add a Pixel Perfect Camera component to your main camera.
3. Set snap settings so sprites move in pixel-perfect increments.

## Set up your sprites

Follow these steps:

1. Select all your sprites in the **Project** window, and set their **Pixels Per Unit** properties to the same value.
2. In the **Advanced** section of the Editor window, set **Filter Mode** to **Point**.
3. Set Compression to **None**.
4. Select **Open Sprite Editor**.
5. For each sprite in the texture, in the Editor overlay, set **Pivot** to **Custom** and **Pivot Unit Mode** to **Pixels**. The pivot point now snaps to pixels.

## Add the Pixel Perfect Camera component

Follow these steps:

1. Select the main camera in the **Hierarchy** window.
2. In the **Inspector** window, select **Add Component**.
3. Type `pixel`, then select **Pixel Perfect Camera**.
4. Set **Assets Pixels Per Unit** to the same value as the **Pixels Per Unit** property of your sprites.
5. Set **Reference Resolution** to the pixel art resolution of your game. For example, if you set **X** to 320 and **Y** to 180, Unity sets the camera view to 320 sprite pixels in width and 180 sprite pixels in height.

In the Editor view, Unity displays the following:

* A dotted green outline of the area set in the **Reference Resolution** property.
* A solid green outline of the area visible in the **Game** view.

> **Note:**
>
> If you use the Cinemachine package, for more information about making Cinemachine compatible with the pixel perfect camera, refer to [Make Cinemachine compatible with the pixel perfect camera](https://docs.unity3d.com/Packages/com.unity.cinemachine@latest/index.html?subfolder=/manual/CinemachinePixelPerfect.html).

## Set snap settings

Follow these steps:

1. In the **Scene** view, open the **Grid and Snap** overlay ().
2. In the **Grid and Snap** overlay, select the dropdown.
3. Set **Grid Size** to 1 divided by the **Asset Pixels Per Unit** value of the Pixel Perfect Camera component. For example, if the **Asset Pixels Per Unit** is 100, set the **X**, **Y**, and **Z** values of the **Grid Size** property to 0.01 (1 divided by 100).
4. Enable **Grid Snapping** ().

To snap sprites to smaller increments of the grid, press **Ctrl**+**\[** (macOS: **Cmd**+**\[**) to decrease the grid size, or **Ctrl**+**]** (macOS: **Cmd**+**]**) to increase the grid size.

## Additional resources

* [Pixel Perfect Camera component reference for URP](/engine/6000.5/manual/unity2d/2d-urp/2d-pixelperfect/ref.md)
* [Configure a pixel perfect camera](/engine/6000.5/manual/unity2d/2d-urp/2d-pixelperfect/configure.md)
