gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > Please recommend a Sprite tool or procedure

#9169 - Foz - Tue Jul 29, 2003 9:57 pm

Hey everyone,

I'm a bit stuck and could use some help.

I am currently using pcx2sprite and I'm getting pretty odd behavior. I use Photoshop to create my half-way decent images. I save them as a PCX file with indexed color. I edit the color table to make color 0 black and then add whatever color I removed to the end of the palette so I am sure that all the colors are there. I don't save the palette separately but I resave the image. I then run it through the tool.

Color 0 on my palette is 0x0000. However, my data seems to have 0xFFFF wherever my transparent color should be. The result is a box around my sprite. I then manually edit the data array with 0x0000 to get the transparency I need, but this is not only painstaking but also inaccurate as some tiles may have a few transparent pixels around them resulting in background color(lets say black for now) showing up sporadically around my sprite. The box is gone but it's pretty ugly.

Am I messing up the color table? (though it doesn't work when I leave it alone either) Am I doing something wrong with the tool? Or should I be using a different tool that works better with Photoshop? Thanks.

#9187 - djei-dot - Wed Jul 30, 2003 12:22 pm

I haven't had any problems with pcx2sprite and transparency color yet, so I guess your problem is not in the tool. To me it looks like when you changed palette colors in photoshop, all that pixels that pointed to the first color became pointing at the last color (they were 'updated' just like the palette colors). Maybe you'll have to do some color replacing to get what you want. I'll be glad to explain my method if you want to.

#9206 - Foz - Wed Jul 30, 2003 5:36 pm

Thanks djei-dot. Please do.

#9323 - djei-dot - Fri Aug 01, 2003 5:09 pm

OK. Here's what I do. It's just an easy copy and paste method and I'm sure there are other methods but this works for me.

I'm using Paint Shop Pro but I guess it will work for Photoshop too.

1-First, decrease your image color depth to 256 or 16 colors. Take a look at your palette.

2-There are three essential colors here. First one, the first color in the index (blue, for example). Second one, the color you want to make transparent (magenta, for example). The third one is a temporary color I'll call red. Red doesn't exist in your palette yet (and won't exist afterwards). Your objective is to switch the blue and magenta colors so that magenta becomes the first color. You might want to take notes of the RGB codes on these colors.

3-If there is a unused color in your palette, edit the palette and make the color red (Note that red can be any color, but it must be unique in your palette).

4-Go to your image and replace all your blue pixels with red ones.

5-Replace all your magenta pixels with blue ones.

6-Now edit your palette again and put the magenta color in the 1st index and the blue color in the magenta index. This way you switch the blue and magenta colors and your blue pixels become magenta again.

7-Finally, replace the red pixels with blue ones.

8-You might want to turn the red color back to white or black but that isn't really necessary if the color is unused.

#9329 - Foz - Fri Aug 01, 2003 6:52 pm

Thanks djei-dot,

The key part was #3 on your list. Photoshop did not produce efficient palettes. Though my first color was my transparent color, that same color was repeated throughout the palette. So when I replaced that color Photoshop just pointed the pixels to a different entry. The GBA was rendering the black because it was taking the color from say index #28 not #0.

Thanks for the help djei-dot. I was really racking my brains, and as always the answer is right in front of your eyes.