| View previous topic :: View next topic |
| Author |
Message |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Tue Jun 13, 2006 12:15 pm Post subject: Gimp plugin |
|
|
http://perso.orange.fr/franck.charlet/PSPTex.zip
PSPTex is a save plugin for GIMP 2.2.x allowing to create textures for the PlayStation Portable.
It can save raw RGBA (5650, 5551, 4444 or 8888) & indexed (T4, T8) textures (with 5650, 5551, 4444 or 8888 palette modes support) as well as DXTC (DXT1, DXT3, DXT5) compresssed ones, it supports the PSP textures swizzle mode and can generate mipmaps, it also have a color key feature to handle transparency and can convert grayscale pictures into alpha channel only textures.
(Note: if the plugin doesn't work under windows you'll need to copy the gimp dlls into the system directory).
Last edited by hitchhikr on Fri Sep 15, 2006 3:57 am; edited 6 times in total |
|
| Back to top |
|
 |
white rabbit
Joined: 06 Jul 2005 Posts: 60
|
Posted: Tue Jun 13, 2006 10:53 pm Post subject: |
|
|
Thanks for that - I was thinking of making a texture editor, but was putting it off with all the work required.
I'll give that a go tonight! |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Wed Jun 14, 2006 2:26 am Post subject: |
|
|
| I modified the description as this is not a texture editor but only a plugin allowing you to save pictures as raw datas in formats suitable for the psp. |
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Wed Jun 14, 2006 10:24 am Post subject: |
|
|
Do you plan on releasing the source some time? _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Wed Jun 14, 2006 4:29 pm Post subject: |
|
|
| Prolly in a couple of days, just the time to cleanup the source code. |
|
| Back to top |
|
 |
white rabbit
Joined: 06 Jul 2005 Posts: 60
|
Posted: Wed Jun 14, 2006 7:10 pm Post subject: |
|
|
| Sorry, that's pretty much what I meant - I can edit the texture data outside of the image without too much hassle, but editing an image in a knocked up app is never fun. |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Thu Jun 15, 2006 6:47 am Post subject: |
|
|
| New version released including source code, same url as mentioned before. |
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Sun Jun 18, 2006 6:03 pm Post subject: |
|
|
I've hacked it up a bit and have gotten it running on the linux version of gimp (developer version 2.3.8)
I've ran into a couple problems though...
The image is upside down (height-(y+1) used instead of y) I know this is often done in windows bmp files, but I don't think this is a good thing for the psp? ... was this intentional or is it a bug?
It seems it's supposed to automatically resize the image to a power of 2 width, however it does not appear to be working... I don't have time to look into why right now unfortunatly.
Also, do you have any intentions of adding support for saving the alpha channel? _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Sun Jun 18, 2006 6:45 pm Post subject: |
|
|
| Quote: |
The image is upside down (height-(y+1) used instead of y) I know this is often done in windows bmp files, but I don't think this is a good thing for the psp? ... was this intentional or is it a bug?
|
I'm copying the texture from top to bottom, maybe your uv coordinates are upside down ? In the worst case, flip it vertically within gimp :D
If it's really a problem, i may add an option to allow reverting the textures for saving them, eventually.
| Quote: |
It seems it's supposed to automatically resize the image to a power of 2 width, however it does not appear to be working... I don't have time to look into why right now unfortunatly.
|
No it's not, there's no reason why it should do that, the pow stuff is only used to generate the xxx_TEXTURE_WIDTH constant which is compliant with the textures sizes passed to the psp, the xxx_TEXTURE_REAL_WIDTH contains the real pixels width (as implied), both are to be passed to sceGuTexImage(). The plugin generates a .h file beside the .psptex as an helper.
| Quote: |
Also, do you have any intentions of adding support for saving the alpha channel?
|
There's full support for alpha channel already (unless i screwed something up somewhere). |
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Sun Jun 18, 2006 9:23 pm Post subject: |
|
|
| hitchhikr wrote: |
I'm copying the texture from top to bottom, maybe your uv coordinates are upside down ? In the worst case, flip it vertically within gimp :D
If it's really a problem, i may add an option to allow reverting the textures for saving them, eventually.
|
So it's just my imagination that line 275 is the following? ;)
| Code: | | offset = (((height - (y + 1)) * width) + x); |
| Quote: | | No it's not, there's no reason why it should do that, the pow stuff is only used to generate the xxx_TEXTURE_WIDTH constant which is compliant with the textures sizes passed to the psp, the xxx_TEXTURE_REAL_WIDTH contains the real pixels width (as implied), both are to be passed to sceGuTexImage(). The plugin generates a .h file beside the .psptex as an helper. |
Erm.. don't you need the buffer width to be a factor of 2?
Even if you do, not neccisarily saying it's something it should do for you, just mentioning ;)
| Quote: |
There's full support for alpha channel already (unless i screwed something up somewhere). |
Doesn't seem to work for me... which could be anything from me screwying up to a change in gimp, to you screwying up ;) ... One way or another I'll look into it more after the compo. _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Sun Jun 18, 2006 9:53 pm Post subject: |
|
|
| Quote: |
So it's just my imagination that line 275 is the following? ;)
Code:
| Code: |
offset = (((height - (y + 1)) * width) + x);
|
|
Damn you're right :D
I must have used this for a test purpose but i can't remember which one now, i'll modify that.
| Quote: |
Erm.. don't you need the buffer width to be a factor of 2?
|
Nope, you can do such stuff:
| Code: |
TEST_TEXTURE_WIDTH 512
TEST_TEXTURE_HEIGHT 256
TEST_TEXTURE_REAL_WIDTH 480
sceGuTexImage(0, TEST_TEXTURE_WIDTH, TEST_TEXTURE_HEIGHT, TEST_TEXTURE_REAL_WIDTH, &Bytes);
|
Only the width & height arguments must be power of 2, the tbw one can be anything provided it's aligned on 4 bits i think, it's handy to avoid vram wasting.
| Quote: |
Doesn't seem to work for me... which could be anything from me screwying up to a change in gimp, to you screwying up ;) ... One way or another I'll look into it more after the compo.
|
I'll be interested to know what picture and what mode you used to test it. Notice that in order for the alpha channel to be active you'll need to use something like that in your code:
| Code: |
sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
sceGuEnable(GU_BLEND);
|
|
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Sun Jun 18, 2006 11:01 pm Post subject: |
|
|
| hitchhikr wrote: | | Quote: |
So it's just my imagination that line 275 is the following? ;)
Code:
| Code: |
offset = (((height - (y + 1)) * width) + x);
|
|
Damn you're right :D
I must have used this for a test purpose but i can't remember which one now, i'll modify that.
|
That line was for indexed images I believe, you have the same line somewhere else for RGB images I think.. so make sure you catch both (I had to recompile earlier as I missed the indexed one yesterday ;) )
| Quote: |
I'll be interested to know what picture and what mode you used to test it. Notice that in order for the alpha channel to be active you'll need to use something like that in your code:
| Code: |
sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
sceGuEnable(GU_BLEND);
|
|
Hrm... Well I think I was doing things right earlier, but I'll try to play with it more today and see what is going on, as it would be nice to have alpha channels in some of my graphics I'm converting. ;) _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Sun Jun 18, 2006 11:09 pm Post subject: |
|
|
Lines: 275, 284, 326 & 375.
I'll remake some tests but i remember i checked the alpha channel stuff thoroughly and it worked fine in every modes. |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Sun Jun 18, 2006 11:18 pm Post subject: |
|
|
I forgot to mention, make sure you're using this too:
| Code: |
sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
|
The default is GU_TCC_RGB i think.
Last edited by hitchhikr on Mon Jun 19, 2006 2:07 am; edited 1 time in total |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Mon Jun 19, 2006 1:21 am Post subject: |
|
|
Oki i inverted the y coordinates (i think it was because i first tested'em on tga pictures or something) and i fixed a bug in the palette mask constant (wasn't 0xff for > 16 colors palettes).
EDIT: Also it creates xxx_TEXTURE_HEIGHT & xxx_TEXTURE_REAL_HEIGHT constants. |
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Mon Jun 19, 2006 2:28 am Post subject: |
|
|
Okay, more bugs...
In the event of of an alpha channel you are reading gimp's data as ABGR, but it seems to be BGRA... and you are using 0xff - A for alpha...
changing those two things I now how correctly working alpha :) _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Mon Jun 19, 2006 2:36 am Post subject: |
|
|
Ok, i made a test with this and a texture called test and it worked flawlessly as expected:
| Code: |
sceGuClearColor(0xffffffff);
sceGuColor(0xffffffff);
sceGuClutMode(TEST_PALETTE_FORMAT, 0, TEST_PALETTE_MASK, 0);
sceGuClutLoad(TEST_PALETTE_COLORS, &RES_TEXTURE_PALETTE);
sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
sceGuEnable(GU_BLEND);
sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
sceGuTexMode(TEST_TEXTURE_FORMAT, TEST_TEXTURE_MIPMAPS, 0, TEST_TEXTURE_SWIZZLE);
sceGuTexFilter(GU_NEAREST, GU_NEAREST);
sceGuTexImage(0, TEST_TEXTURE_WIDTH, TEST_TEXTURE_HEIGHT, TEST_TEXTURE_REAL_WIDTH, &RES_TEXTURE);
sceGuEnable(GU_TEXTURE_2D);
vertices[0].tu = 0; vertices[0].tv = 0;
vertices[0].x = 0; vertices[0].y = 0; vertices[0].z = 0;
vertices[1].tu = TEST_TEXTURE_REAL_WIDTH; vertices[1].tv = TEST_TEXTURE_REAL_HEIGHT;
vertices[1].x = TEST_TEXTURE_REAL_WIDTH; vertices[1].y = TEST_TEXTURE_REAL_HEIGHT; vertices[1].z = 0;
sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF | GU_VERTEX_32BITF | GU_TRANSFORM_2D, 2, 0, vertices);
sceGuDisable(GU_TEXTURE_2D);
sceGuDisable(GU_BLEND);
|
|
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Mon Jun 19, 2006 2:41 am Post subject: |
|
|
Do you mean before or after the change I mentioned? _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Mon Jun 19, 2006 2:42 am Post subject: |
|
|
| Before your penultimate post. |
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Mon Jun 19, 2006 3:22 am Post subject: |
|
|
Hm... k.
FYI I've been using 8888 textures during these test, not paletted textures; that may make a difference...
I've been doing essentially the same as what you've said (though I've done a bunch of other stuff too...) and the original code does not work, while changing the two things I mentioned fixes the issues.
If yours works for you, and mine works for me, I think gimp may have changed how it does things a bit.. As I mentioned I'm using 2.3.8, which is the second to newest dev release... (I don't think they make windows builds of development versions) They changed a lot, so perhaps some of the problems may be caused by changes they've made. _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Mon Jun 19, 2006 3:29 am Post subject: |
|
|
| Quote: |
If yours works for you, and mine works for me, I think gimp may have changed how it does things a bit.. As I mentioned I'm using 2.3.8, which is the second to newest dev release... (I don't think they make windows builds of development versions) They changed a lot, so perhaps some of the problems may be caused by changes they've made.
|
That's what i was suspecting.
And it wouldn't surprise me as they always screw everything up from one release to another. Actually there's a 2.3.8 release for windows but even the plugins provided with the distrib don't work. I'll stick to the lastest stable release myself.
EDIT: I tested again with a 8888 texture and it still works perfectly. |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Mon Jun 19, 2006 5:27 am Post subject: |
|
|
| Actually, you could tell me what code you did modify so maybe i can update the plugin to operate differently under 2.3 & 2.2 ? |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
|
| Back to top |
|
 |
Oobles Site Admin
Joined: 17 Jan 2004 Posts: 362 Location: Melbourne, Australia
|
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
|
| Back to top |
|
 |
Oobles Site Admin
Joined: 17 Jan 2004 Posts: 362 Location: Melbourne, Australia
|
Posted: Tue Jun 27, 2006 9:01 pm Post subject: |
|
|
No problem. Will modify the page to link instead of mirroring.
Oobles. |
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Wed Jun 28, 2006 5:07 am Post subject: |
|
|
this is a great plugin under linux thanx alot :) _________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
Findeton
Joined: 31 Aug 2006 Posts: 2
|
Posted: Sun Sep 03, 2006 12:03 am Post subject: |
|
|
| Drakonite wrote: | I've hacked it up a bit and have gotten it running on the linux version of gimp (developer version 2.3.8)
I've ran into a couple problems though...
The image is upside down (height-(y+1) used instead of y) I know this is often done in windows bmp files, but I don't think this is a good thing for the psp? ... was this intentional or is it a bug?
It seems it's supposed to automatically resize the image to a power of 2 width, however it does not appear to be working... I don't have time to look into why right now unfortunatly.
Also, do you have any intentions of adding support for saving the alpha channel? |
I'm also under linux, how can i get it running on the linux version of the gimp? |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Sun Sep 03, 2006 5:55 am Post subject: |
|
|
| You have to compile it and for this you need the gimp devel package or something. |
|
| Back to top |
|
 |
hitchhikr
Joined: 04 Feb 2006 Posts: 83
|
Posted: Fri Sep 15, 2006 3:58 am Post subject: |
|
|
| Fixed some issues when compiling under linux. |
|
| Back to top |
|
 |
|