SpriteManager 2 pixel perfect blurry and stretched

I'm just starting to use SM2 v1.75 and I'm currently testing pixel perfect sprites.

I have 3 40x40 sprites and want to apply them to 3 GameObjects (cubes).

The camera is set up in Orthographic mode. I've unchecked Generate Mip Maps on the three original sprites.

The result is as follows: unity editor sprite issue

If you need more detail than the inline image, you can access the full size here: http://dl.dropbox.com/u/3655087/sm2-sprite-issue.png

The atlas in use is on the right of this image. The game window on the left shows the sprites are stretched vertically (2x the original height). SM2 appears to be auto-detecting the height incorrectly and setting Y to 2 in the PackedSprite.

If I do not use pixel-perfect and set the height to 1 then I get the correct size.

In both cases the sprites are very low quality relative to the original.

It's probably something really simple that I'm missing. Can anybody suggest what might be wrong for both the height and the quality of the sprites?

UPDATE #1:

Thanks to Brady's response below I've realised the mistake of not having a power of 2 texture in place (It was an iPhone target at the time of writing).

This solved the stretched textures, however I cannot get the Atlas generation to behave as I expect.

  1. If you assign a 40x40 image to a PackedSprite and it is the only PackedSprite in the atlas the edges of the image are blurry. This is the same as edges of the "Pixel perfect sprites" in the attached image.

  2. If you assign a 32x32 image to a PackedSprite and it is the only PackedSprite in the atlas, the edges are fine and the sprite renders as I'd expect.

  3. If you have more than one PackedSprite included in an atlas the edges are blurry as per #1. i.e. an otherwise working pixel perfect sprite is degraded once a second image is added to the atlas. For completeness the second image added was a 64x64 gradient png.

I've also witnessed the atlas generation duplicating the sprites included in a texture. Not to the extent it increased the size of the texture but filling unused space. The general problem is atlas generation is not consistent between executions for the same set of included PackedSprites/assets.

Cheers.

The issue of the "washed out" appearance of the sprites is due to the fact that the "Main Color" setting of your atlas material is set to full-white. By default, it is set to gray (50% white), which, because of the way the blended shader works, results in the sprite having the coloring of the original graphic when the sprite's own color is set to full-white. This is the default and unless you desire to have a sprite of full-white color appear highlighted (which can be very useful), it should be left at this value. In other words, under most circumstances, the "Main Color" of the material should be left at gray, and the individual sprite colors are what should be adjusted.

The issue of the sizing of the sprites is due to the fact that it appears Unity 3 has marked your atlas texture to be compressed. And since you are likely using an iPhone build target, this means the texture must be square (since PVRTC compression requires a square texture). Therefore, Unity is resizing the atlas texture so that it is 2x taller than it should be so that it can be square. If you require PVRTC compression, use the "Force Square" option when building your atlas instead. This will preserve the original aspect ratio of your graphics, while generating a square texture that can be compressed by PVRTC. Otherwise, select "Truecolor" in the import settings for the atlas to keep Unity from resizing the texture.

To answer your updated issues, I think your blurriness could be a result of bad texture import/filtering settings (see the “Texture Sharpness” paragraph on the first page of the SM2 docs). Make sure your atlas itself is set to be uncompressed for the same reasons mentioned above.

On duplication of a sprite in the atlas, I don’t see how that would be possible. Are you sure you didn’t have two identical assets that were getting included? Out of the thousands of SM2 users out there, I’ve never before heard of duplicate inclusion on the atlas.