# Unity pixel art distorted sprites

I have a problem rendering my pixel art sprites properly in Unity. So far I have one character in a sprite-sheet I made, with frames of size 64x64. The actual sprite is roughly 32x32 but I left room for movement in animations. I import the sheet following pixel perfection procedures I found on the internet using these settings:

As for the orthographic camera I set its size using this formula:

orthoCameraSize = screenHeight / (2 * 32)

If I zoom on the sprite in scene it looks fine but when in game it gets rendered quite poorly (in game / in scene pics below):

What could be the source of the problem? I applied every good practice advice I could find on the web... Thanks for your help!!!!

• An image of the "poor" rendering would help potential answerers helping you out. – Tyyppi_77 Jul 11 '16 at 22:32
• I can double check, but one of my resources said to set the pixels per unit to 100 for 2D images and the camera size to screen height / 2. gamedev.stackexchange.com/a/83437/48257 – ps2goat Jul 11 '16 at 22:41
• Nothing seems "poor" in the image you showed. The sprites look the same to me. – Tyyppi_77 Jul 14 '16 at 13:37
• @Tyyppi_77 Zoom in and look more closely at the headband, the row of pixels above the belt and the top of the left boot. The rows are duplicated. – Philipp Jul 14 '16 at 13:38
• I answered a similar question on StackOverflow - this can be caused when you have a non-integer number of screen pixels for each source texel in the sprite. – DMGregory Aug 19 '16 at 2:26

You should change your formula for the ortho size to Camera Size = x / ((( x / y ) * 2 ) * s )

Where: x = Screen Width (px) y = Screen Height (px) s = Desired Height of Photoshop Square (px)

• I'll have to give this formula a try. I've been doing the screenHeight/2*ppu one I was advised once. Incidentally, how does your formula account for ppu (pixels per unit)? – jhocking Jul 14 '16 at 14:42
• The result from this formula is the same as screenHeight/2*ppu. It's just a slightly more complicated one... – Uknowho Jul 14 '16 at 14:46

Should be the same problem / answer as this:

How do I move the camera in full pixel intervals?

Basically to fix this issue:

1. Your sprites-pixel in Unity-Units should be reasonable. ( For example: If your sprite has a width of 10, it should be as wide as "10 unity-units" for example. Or 100. or 1. or 0.1f. But not 1.5234f)
2. Your sprites should only move in full-pixel-steps if (1.) is not possible.
3. Your Camera should also only move in a full pixel- steps if (1.) is not possible
4. Your Resolution should be in full numbers (x = 50.5f is wrong)
5. Your Resolution should have even numbers
6. Your Camera-Y-Rotation and Camera-X-Rotation should be 0
7. Your Camera-Projection should be Orthographic
8. Your "Size" should be like this : https://indiehoodgames.wordpress.com/2013/07/27/pixel-perfect-calculator-for-orthographic-camera-unity3d/

check the scale slider in game window it must be x1 for better quality

• I think this is a valid answer, but it's a little on the short side and got auto-flagged by our system as a result. I recommend editing your answer to add more details - maybe a link to the documentation about this feature, a screenshot of where to find it & what it looks like in the editor, or an explanation of why scaling using this slider affects visual quality. – DMGregory Dec 20 '18 at 14:02

Try turning off anti-aliasing completely in the project settings.

Edit -> Project Settings -> Quality

Here, disable Anti Aliasing, and Anisotropic Textures.

• thanks Jon. This solution made it a little worse though... – Uknowho Jul 14 '16 at 13:50
• haha. ok can you provide more details on this particular gameobject? Do you have a 1:1 scale value? Do you have an attached animator? Is the animator affecting the scale of the sprite? Is the actual sprite 32pixels wide? Try setting the camera orthoSize to an integer value. – jgallant Jul 14 '16 at 13:52
• The scale is 1.1, it has an animator which changes the sprite without stretching it, the sprite is actually 32x32. I noticed that if I set the scale to 1 it gets rendered much better, but I have to make it bigger somehow in order to match other sprites size... How can I deal with that...? – Uknowho Jul 14 '16 at 13:59
• You can check out something like this: github.com/RyanNielson/PixelCamera2D -- OR alternatively, another approaches: blogs.unity3d.com/2015/06/19/pixel-perfect-2d – jgallant Jul 14 '16 at 14:02

Try setting the compression to rgba 24bit (override default) and filter mode to point.

• You can see in the question itself that the texture has already been imported uncompressed, with point filtering - so this isn't telling the user anything they haven't already done. Plus, the artifacts shown don't look like compression or bilinear interpolation, so it's unclear how this answer is intended to solve the problem. – DMGregory Mar 27 '17 at 22:07