views:

555

answers:

2

Hi,

I'm making a 2d game and am using 64x64 textures to draw my characters. It basically looks like super mario brothers, each character has about 10 frames that make up their entire animation sequence.

The pvr tool sounded promising, it crushed my images down to 4kb each which was great. However the quality is very poor. I don't think there's anything I can do about this, but wanted to double check. Each frame is the character in some pose, and transparent pixels filling the rest of the 64x64 space. I somehow get filled pixels in the transparent regions, strange artifacts that make the output pvr kind of useless (this isn't an error, I think it's just the way pvr works). I could probably get away with some mudy-ness in the character themselves, but not random pixels popping up in transparent areas.

Are there any tricks around this? I think we only have about 10mb of memory to play with on the iPhone, so if each of my images is 64x64 pixels uncompressed, I'll run out of space somewhat quickly as each will be an astounding 16k.

Thanks

A: 

At least you should half required memory by using 16 bit textures. In Cocos2D you can do it using

[Texture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA4444]; // add this line at the very beginning

More about pixel format in Cocos2D

Check out Cocos2D sources if you are programming in raw OpenGL

Stanislav
Cool, that would be great, but what are you using to create the RGB4444 images? In photoshop I can only output full 32 bit png files with no chance to output as 16 bit I think.
Mark
Hmm, according to http://en.wikipedia.org/wiki/Portable_Network_Graphics PNG can have only 24/32 bit color. Cocos2D does conversion at runtime. See line 264 and below at http://code.google.com/p/cocos2d-iphone/source/browse/trunk/cocos2d/Support/Texture2D.m
Stanislav
I see makes sense now, thanks!
Mark
A: 

One thing that I found improved things slightly was to use images larger than they needed to be, and then scale them down to actual size. This hides some of the artifacts, but obviously your not going to be saving as much memory.

That said in the end we gave up with using pvr textures for 2d sprites, as we just couldn't get the image quality we required, and no matter how hard we tried there were always some artifacts visible.

Also I believe you actually have 24mb of video memory to play with, so you probably have more space than you think for uncompressed sprites.

Tom