Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Improvement Idea for ImageJoiner Tool

Author
Message
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 7th Apr 2012 22:33
I started using the Image Joiner tool.
I think its a great and useful utility.

However if my artwork is an odd pixel size (like 83x79) when using LoadSubImages, one pixel is cut off from the right hand side, and one pixel from the bottom of the sprite.

All works OK when having sprites an even pixel size (like 84x80).

So I hear you say, where is the problem, create all your sprites at an even size!!!
Not so easy when you have over 300 different sprite files!

So I would suggest that ImageJoiner automatically adds 1 pixel of transparency to odd sized sprites (to make them even) when building the SubImage. This would save a lot of work and hassle!

Thanks!
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 7th Apr 2012 22:44
Actually it seems that the problem is not the odd sized sprites.

It seems that when using LoadSubImage, AppGameKit is doing something to the anti-aliasing, making artwork look wrong.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 7th Apr 2012 22:50
I remember readying another thread about a "blurry" images problem.

Do any of these commands affect the way LoadSubImages work?

SetDefaultMagFilter
SetDefaultMinFilter
SetGenerateMipmaps
SetImageMagFilter
SetImageMinFilter
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 8th Apr 2012 00:41 Edited at: 8th Apr 2012 04:46
I don't think this is a problem with image joiner, more AGK. You will get these issues if you do not adhere to ^2 image sizes. If you use any other size, AppGameKit will pad out the image to the nearest ^2.
Quote: "So I hear you say, where is the problem, create all your sprites at an even size!!!
Not so easy when you have over 300 different sprite files!"

Yes it can be a pain, as you can't always resize an image to the correct size, without badly altering the aspect ratio. I had the same issue with a few projects I started when AppGameKit came out. Adding clear borders to get all the off size sprites the same size and keeping the sprites centralized was tedious work, but I got through it with patience.
The setdefaultmagfilter and other commands do change the way images are treated, but will not fix the problem with non power of 2 sprites. If you set the filter type to 0 you will have a sharp but blocky look to your sprites. If you set it to 1, it will filter the sprite to look blurry. I tend to use 0 as I prefer the sharp look in general. If your graphics are fairly high res though, the blurred look can look better.
Try a changing a couple of the offending sprites to a ^2 size as a test and see what happens.

Oh another thought that (may), help you without having to edit the images. You could try the SetSpriteUVBorder( iSpriteIndex, border ) command.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 8th Apr 2012 12:59
DVader, you are somewhat wrong in your assumptions, but you are right in the end... you SOLVED my problem!!!!!

The single images can be odd sized and non ^2. That is not the problem. The most important thing is that when using ImageJoiner you use a ^2 size, which makes total sense.

What matters is the SetSpriteUVBorder() AppGameKit is offsetting all UV co-ords by 0.5 pixels because of scrolling! Setting SetSpriteUVBorder (iSpriteIndex, 0) fixes this problem! When using at Atlas you cannot do UV scrolling anyway!

Just another AppGameKit quirk that took a lot of investigation
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 8th Apr 2012 23:08
Ah good, thought the last suggestion might solve it. As for Single images being okay as non power of 2, possibly, but not on all platforms and not if you use UV scrolling (I have heard you say you don't use UV scrolling, but it can be useful for a cheap scroll effect, say a river flowing in the background for instance). I have had so many issues like this due to not using power of 2 images I just force myself to keep to that ratio for all AppGameKit related stuff nowadays to avoid problems. I also use the atlas sprite system a lot and it makes all the difference with those. It can be a pain getting all things to fit without wastage inside the limited dimension sizes though. I find it easiest to enlarge the canvas size and keep the image central when doing this in PSP.
Glad I could help anyway. If this has solved your problem you can avoid all that nasty image editing.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 9th Apr 2012 10:30
DVasder, how can you use image scrolling if you are padding your images with transparency to make them ^ 2 ?????
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 9th Apr 2012 13:35 Edited at: 9th Apr 2012 13:38
Quite easily, I did not say they had to be padded on all sides. Grass for instance, would be padded at the top but would go all along the x axis.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 9th Apr 2012 14:53
so its only padded on teh axis where there is no uv scrolling right?
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 9th Apr 2012 23:23
No, it is only padded if the image is less than ^2, and on a device that needs to pad it of course. So on a 128*128 tile if you only use 3/4 of the y height but all of the x width it will work ok with UV scrolling on the x axis. My image would still be 128*128, but the top part, would be blank.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 10th Apr 2012 00:16
I had to scrap the idea of using Atlas textures. SetSpriteShape() Polygon is not working for me.

Wasted so much time
3d point in space
14
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 10th Apr 2012 18:05
how about using the image joiner to resize all your sprites at once for example lets say you have tons of 83 X 79 resize it to 84 X 80 use gimp and resize every picture manually. making the last pixel trasparent.

I actually make most of my pictures 1 pixal short of the border. The last pixal i make black or transparent.

Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps.
Developed the tiled map engine seen on the showcase.
Veterian for the military.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 10th Apr 2012 19:34
I expanded my Photoshop exporter script to automatically align any odd sized sprites to even ones as even normal sprites did not work on ios!!

Login to post a reply

Server time is: 2024-05-08 16:41:14
Your offset time is: 2024-05-08 16:41:14