- Home /
How to keep pixel art crisp in unity
My sprites look fine in a photo viewer, but in unity they blur. Can someone please list all of the steps i need to take to make sure that pixel clarity is preserved upon import into unity? I understand this question has been asked multiple times, but i've tried all of the obvious stuff (point filtering, no generate mipmaps) and i'm not sure what else to do.
Bump: Still need help, check my images posted as a comment to one of the answers (which didn't work for me)
point filtering should be all that is needed. To be sure, please post a screenshot of your art how it apears in the external program and in Unity.
Answer by johnd_unity3d · Jan 09, 2017 at 06:08 PM
Filter Mode: Point (no filter) Generate Mip Maps: NO Format: Truecolor
Very important: get your PPU right. You want one pixel on your sprite to equal an integer number of screen pixels. E.g. if the vertical screen resolution is 600, and the camera's orthographic size is 5 you have 10 world units vertically (2 * orthographic size) which means you have 60 pixels (vertically) per world unit. PPU is how many pixels in the sprite correspond to 1 world unit. So if in our example you set PPU to 60 for that sprite, you will have 1 sprite pixel == 1 screen pixel, which would be good. If you set PPU to 30 then 1 sprite pixel == 2 screen pixels, so your sprite will be twice as big but still an integer number of screen pixels, so that is also good. If you set PPU to 45 then 1 sprite pixel == (60 / 45) == 1.33333 screen pixels, which would be bad from a pixel-perfect point of view.
You may also want to use a material derived from Sprites/Default and enable pixel-snap. This should mitigate problems associated with making sub-pixel movements of your sprite or the camera which can otherwise cause artifacts.
Avoid having odd dimensions in your sprite (51x51 pixels is bad, 50x50 is ok).
Avoid having a screen (camera) resolution with odd dimensions (801x601 is bad, 800x600 is ok).
I apologize for putting these as seperate comments, but it wouldn't allow me to post them otherwise. I've tried all of your suggestions and im still seeing the same issue. I've set my orthographic size to 6 which should mean that with the camera as 768 vertically the PPU would be 64. $$anonymous$$aybe I'm just not seeing something. Did I miss something or do something wrong? Thanks
The import settings look fine. It appears from your first screenshot that the Scale (at top of game view) is less than one. I think this is because the size of your game view in the editor is in fact smaller than the resolution you have set (768 vertically you say). I think this is the problem. Even though you set a given resolution, you can drag the game view smaller than that, and Unity will try to scale everything down to fit, but the scaling will not be pixel perfect. Either a) drag your game window so that it is the correct size, or b) (if it won't fit on your screen) select a lower resolution that you can actually fit within your game view (which will mean you will have to do your ppu calculation again).
I tried building and running the game at 1366*768 which is what my ppu is configured for and it's still blurry. Is it possible that the issue is with the map being an atlas of tiles that are saved in photoshop as one file? Because individually the tiles look fine in unity but the image that's made out of the tiles (it's one image) is blurred. Also, my character sprites are fine too once i configured them
O$$anonymous$$, well I've exhausted things I can think of. Regarding whether it's related to using a sprite atlas, I don't know, but this is something you can easily test yourself by extracting it in Photoshop or whatever to a single sprite and reimporting. If I were you I'd try to investigate the problem by simplifying everything - just start with a simple small image imported as a sprite on a scene on its own, with no scripts or plugins. Check all the things we've discussed and see if it looks blurred. Assu$$anonymous$$g it doesn't, start changing things to be more like your problem scene, building up until something makes it go blurry.