I’m working with some 2d platform project but I have a problem importing the sprite and adjust its Pixel to Units thing. The sprite look pretty ugly and low quality when imported and tweak it. I got the the sprite call abstract platformer from Kenny.nl and it’s a good quality one.
I’ve seen many people get it to work accept me. Is it has something to do with that Pixel perfect thing? It’s seem like people come up with a different Pixel Perfect set up and I’ve tried all of them, still my sprite look worst than the 1985 Mario bros game.
Can I get a tips that work for everyone? I’m tired of watching video people explaining this and that related to pixel perfect and they always ignore most of the important part.
And it seem like I’m not the only one person who ask this question but I never see a good a answer when I googling. So here again PixelPerfect thread.
If I’m missing something, please tell me and I will answer you.
Note: Abstract Platformer from Kenny, Unity 5.3.5, Sprite Pixel: unknown, Camera Size: 720/2 = 360 => 3.6
It’s 512 x 1024 which mean 5.12 * 10.24 = 52.42
The Camera Size I use is 720p which will be 720/2 = 360 <=> 3.6
I’m messing around with number but none of it work great. Some people said that keep thos PPU to the power of 2 (12, 24, 32, 64) It didn’t work.
I also got a black line inbetween the sprite when snapping them that why I’m so unhappy right now.
You can take a look at the sprite: Abstract Platformer · Kenney
EDIT:
I think the black line has gone now when using 52.42 PPU. It’s just so random. Can I get a tips that work with different set up? Because not all sprite will be this size and I have no clue on what Camera size is. I don’t know how is it going to work if I change the resolution.
A couple things to look at. Your filter mode is the cheapest and worst quality one. Try using Bilinear/Trilinear. Try turning on Mip maps if your having trouble with aliasing; another thing to note is that Trilinear is the same as Bilinear if you don’t have mip maps, so don’t get frustrated if you don’t notice a different in those two.
Your pixels/unit may be off depending on your desired world size. Right now, you’re saying that this sprite will be 9x19 meters in size. Is this what you want? Notice also, that scaling an object vs scaling an image have different effects. Try to mess around with those settings.
You specify the pixels per unit that you want, first. If you want 32 pixels of the image to be 1 “meter” in Unity units, then you put 32. Or 64, or whatever. Let’s say you choose 32 pixels per unit for the sake of the example.
If you want this to render at pixel perfect resolution, you have to use the following formula (from here):
If your screen resolution vertically is 768, as an example, then you will say: size = (768 / 32) / 2 = orthographic size of 12. (Ignoring the PPUScale variable for this example).
I’m not at home with my project to explain exactly how I set my project up, but it’s probably worth mentioning that my sprites only appear pixel-perfect in builds, but not in the editor.
@JasonBricco What is PPUScale? It looks great for now but it has a black line inbetween the snapping block. If it was a slick problem then how do you know what number to put in the Manual Slick? @landon912_1 I’m really confusing on PPU and Pixel.
Unity uses meters as the unit for the world (everything in your scene), not pixels. If you adjust an object’s transform position from 0, 0, 0 to 0, 1, 0, you move it up by one meter rather than one pixel.
Pixels per unit tells how many pixels in your image map to one of Unity’s meters. If your image is 64x64, and you put PPU to 64, then your Sprite will be 1x1 meter in size in the scene. If you make PPU be 32, then it will be 2x2 meters.
Unity will display your image based on meters, not pixels. In this way, it can be scaled to different actual pixel sizes. This can lead to it not looking very good.
Orthographic size is half of how many of those meters the vertical size of your screen takes.
Let’s go back to my example. If we set orthographic size to 12, that means the entire vertical size of your screen takes 24 meters. We specified that the Sprite has 32 pixels per meter. That means we can have 24*32 pixels vertically, which is exactly your screen’s resolution of 768 in that example. This means your images will be drawn pixel perfect, because the pixels per meter maps 1:1 to your actual screen pixels.
The PPU scale is simply a way to scale the resulting value. For example, setting it to 2 will result in halving the orthographic size. I tend not to use it personally. It lets you use a more flexible pixels per unit value while achieving the same results, as far as I understand.
Thank!!! It’s looking great now. I use your example as a setup. It’s might be the asset is low quality, I guess. That why the aliasing is not looking great but it’s already pixel perfect.
Do you know where can I get a good sprite for free or at least some inexpensive pack I could use for both hobby and commercial use.
Now everything is set up perfect. I made to code for the player to jump, run and hit already but the only problem is lack of good sprite animation. Is it a wise idea to learn how to make sprite or just buy it off the internet?
The asset store has a lot of great art assets for use in prototyping/developing the game. You could even release them in the commercial product if you don’t care about the fact that other games may be using those sprites as well.