- Home /
Pixels not equal size and thin white stripes between pixels
Hey everyone :)
I'm new to Unity and started developing a small 2D Jump 'n Run Game with some friends.
I have some problems with the camera settings:
1. The pixels don't appear to have equal size. In the black outlines are all one pixel wide and are also shown this way if I zoom onto them in the "Scene" view. In the "Game" view however the pixels are not equal sized. I don't mid this on most objects actually, but some are just a couple pixel big and the object looks overall really odd. I've noticed that it get better once I decreased the field of view. I'm also using the "Pixel Perfect Package". I just can't figure out how to fix this..
References:
In the Scene view:
In the Game view:
2. I get these white lines flashing randomly when moving around the map. I've been told the "Pixel Perfect Packge" could fix this, but I couldn't figure out how aswell...
Any help is very appreciated :)
What dimensions are your game window set to? if you have it set to free aspect or something, then the pixels will look messed up. Set it to the size you expect your game to be run in like 1920x1080 or 1280x720.
This article may also help https://blogs.unity3d.com/2019/03/13/2d-pixel-perfect-how-to-set-up-your-unity-project-for-retro-8-bits-games/
Answer by Bunny83 · Apr 16, 2020 at 12:59 PM
Looks like a beginners mistake to me ^^. Textures are usually stored in sizes that are a power of two (8,16,32,64,128,256, ...). Unity will automatically resample your texture if it's not a power of two. There are two ways to prevent that:
You can change the import settings of the texture and select "Non-Power-of-Two". However this can have some performance issues and older devices might not support those in hardware.
The In general better approach is to make sure your textures are always a power of two in size. Note they don't need to be square (on very old devices this also was a requirement but I think those times are over). So you could have textures that are 256x64 for example.
Sprites are usually imported and packed into an atlas texture. As long as the atlas size is a power of two everything should be fine.
I also recommend this video of 10 common pixel art mistakes
Answer by Gotztama · Apr 17, 2020 at 03:50 PM
@Bunny83 Thanks for the answer :)
I've rescaled the canvas of my idle animation and sliced the animation sheet to 128x128. However, I still got the same issue. I've set my PPU to 32 for everything I use, since the tiles I made are all 32x32. Maybe it has something to do with this? Or maybe somthings wrong with my camera settings?
On the import setting I'm using the "Sprite (2D and UI)" as the texture type, so I don't have the "Non-Power-of-Two" option. When changing it to Default, my texture doesn't show up in the first place.
Do you have any idea what else I could try?
Your answer
Follow this Question
Related Questions
How to fill texture that would be avaliable to ither shaders? 1 Answer
What's the most effecient way to rotate a texture? 1 Answer
Render Android device camera from native pointer 0 Answers
Why does my pixel art get ruined? 1 Answer
Blur / healing brush effect on specific area of a 2D texture 0 Answers