Hello,
i've got some problem with my textures.
They're 8bit pngs. I'm putting them in this way:
{syntaxhighlighter brush: cpp;fontsize: 100; first-line: 1; }CIwTexture* b2dlib_tex = NULL;
CIwImage image;
s3eFile* pFile = s3eFileOpen(pathList[a], "rb");
int16 sX = 0;
int16 sY = 0;
if (pFile){
image.ReadFile(pFile);
s3eFileClose(pFile);
b2dlib_tex = new CIwTexture;
//b2dlib_tex->SetFormatSW(CIwImage :: ABGR_8888);
b2dlib_tex->SetImage(&image);
sX = int16(b2dlib_tex->GetWidth());
sY = int16(b2dlib_tex->GetHeight());
b2dlib_tex->SetMipMapping(false);
//b2dlib_tex->SetFormatHW(CIwImage::PVRTC_4);
texList.push_back(b2dlib_tex);
// Upload the result
b2dlib_tex->Upload();
} return CIwSVec2(sX, sY);{/syntaxhighlighter}
For example the ground in the game is made directly from texture. I mean my texture uploading function returns the size of loaded image. Then i convert it to vertices and make box2d object with this size. Texel image size is very small when it appears on the screen so i upscale the vertices. I render it using screen space sub pixel and QUAD_LIST. I've got rasterisation = hw in my icf file and in every frame i call IwGxSetTransformHW();
IwGxSetRasterisationHW(); (i don't know if it's enough to call it once in init()).
In addition, on iphone it looks worst - poor color and low contrast.
The boxes in the screenshot are 32x32 8bit pngs.. they look horrible.
What could i do to make it better?
regards,
Mike












I've get rid of irregular boxes, now they're ok. First problem was SW transform, and the second - box's size was to big, it was 32x32pix, and now it's 24x24 and everything looks much sharper.
But i've got still unsolved problem with the ground. I've noticed that its upper edge is the most rugged when the angle of ground is 0' - i mean horizontal, when the angle goes up for exemple to 45 degrees, the ground edges look smoother.
Why can it be?
regards
it's a version with HW and sharper boxes. How can I improve it?
----------------------------------
the third version is with material bilineral filtering and alphamode_blend turned on. it looks much smoother on iphone, but the colors are still not good enough comparing to PC.
if it could look better please tell me so i knew if there's a point in working on it
Try changing your surface format to RGB_888 in Configuration->Surface. The iPhone is 888 by default. Things will always look slightly different on device to PC. Without a device screenshot it's hard to say whether you're seeing a bug or not. It doesn't sound like you're doing anything wrong.
You were right Mark. It looks much better with RGB_888 pixel format in emulator.
I've got a problem when debuging my game:
"IwAssert failure (GX, 822).
Message: Game has not been configured to support HW transform.
Callstack:
IwGxSetTransformHW"
although there's
"IwGxSetTransformHW();
IwGxSetRasterisationHW();"
in rendering function.
The same with icf file:
"[gx]
Rasterisation=HW
# HW mode requires slightly more datacache
DataCacheSizeHW=384000"
...
it seems not to be working.
Image quality is brillant on retina.
Mark, can you tell me what should i do to use HW rasterisation and transform propertly?
I add a texture this way:
"b2dlib_tex = new CIwTexture;
//b2dlib_tex->SetFormatSW(CIwImage :: RGB_888);
//b2dlib_tex->SetFormatHW(CIwImage ::PVRTC_4);
b2dlib_tex->SetImage(&image);
sX = int16(b2dlib_tex->GetWidth());
sY = int16(b2dlib_tex->GetHeight());
b2dlib_tex->SetMipMapping(true);
texList.push_back(b2dlib_tex);
// Upload the result
b2dlib_tex->Upload();
"
As you see the line with setformatHW is commented. It causes error.
I will be grateful if you can help me to get rid of that error,
Mike
To use HW transform, you need to set it via the icf setting:
[gx]
Rasterisation=HW
Transform=HW
Lighting=HW
You can't use the PVRTC compressor at runtime - it takes a lot of ram and a lot of time. You need assets stored in PVRTC format to upload. The only way of doing this with Airplay at the moment is using ResManager.
Thanks Mark!
Something strange going out there is that enabling hw lighting slow the game by half, although I've got lightening set off. When i just moved this line away it came back to norm.
I've got about 7-10 different textures rendered at once(i don't mean objects, but kinds of texture). Three of them are 1024x300px backgrounds (1 bmp and 2transparent pngs). The rest are small textures smaller than 100x100px. Do you think there's a point in using ResManager in my case? Would it seemingly push the performance up?
The second thing is that i'm experimenting with transform mode, cos one time hw appears to be faster but sometimes the sw. In a case with iPhone i was expecting hw to be better, but now i see it's not that easy.
Mike
ResManager is just a way of batching and loading resources... it's useful if you want PVRTC and could help with loading times (because textures are stored in gl-friendly format). It shouldn't be too difficult to add, so I'd say go for it.
Iw2D doesn't necessarily benefit from HW transform that much (because it builds batched streams on the CPU side). I'm surprised that HW lighting makes any difference whatsoever though. Are you running in GL1?
I'm using IwGx and i did't set gl version in my icf. I thought it will choose 2.0 itself. I tried with setting GLESVersion=2 and imagine that it's still the same. The fps is really poor. Definitely not playable. From 60fps to around 15fps in the worst drop. It runs smooth and suddenly drops to under 20fps. It's strange. With resManager i'm gonna have some serious work, because i've made my own texture containers connected with object classes, but as you say - it's probably the best way to handle audio/video/image sources, so i will try to change my code.
Ah okay, sorry. If you're using IwGx you should make sure that IwGxLightingOff() has been called - SW lighting early outs very aggressively, where the driver might not. You'd hope a modern driver could handle this though!
15-60 is a big variation... is it correlated with render load?
There are several points in the level where it really likes to hang for a while.
The issue with fps going down to 15 wasn't really fault of lightening, cos i've noticed that everytime i delete the app from iphone and install it againt, for a first run it does some strange things with fps etc. If i kill the game and run again it works smooth, and the problem occures again only after next reinstallation (after updating code and compiling). But at the other hand, i'm sure that these drops become much longer and worst if i use lighting = hw. I hope that i will be able to finish the game without cuting background resolutions to increase the fps. Now it's really smooth with 10/10 iterations and 1/60 world step and 60 fps. There is around 50 b2d objects in memory and up to 30 per "view". It's really nice.
Oh, yes, that's caused by the media library being indexed. If you watch the console using iPhone Configuration Utility, you'll see trace relating to it.