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.

Beginners > Transparency problem.

#14176 - DragonPoof - Wed Dec 31, 2003 8:45 pm

Alright. I've started some GBA devving but this Sprite Transparency is killing me. For some reason I just CANNOT get it to work. I've looked through to previous threads, checked out tutorials and everything. I just can't seem to get it to work in my program (Screen Mode 1. 256 color sprites. Obj is enabled. 1d Mapping.)

Here's what I have so far. I have a simple 16x16 sized sprite in which it's palette 0 is color (255,0,255) [bright pink]. I'm using Photoshop to create the sprites so I've edited my color table so the first color is the bright pink color I want to be transparent. Fine, great, it works awesome. I run my pcx file through Dovoto's pxc2sprite program to convert it. I only have one sprite so I don't need to worry about conflicting palettes. I just read in the palette and then plop my sprite information into the "OAMData".

So, here's the problem: my bright pink color does NOT show up transparent and I really can't figure out why. I set the value of attribute0 of my sprite to all the correct stuff, including MODE_TRANSPARENT (0x400). Even with that in there it still does not show up transparent. Am I doing something wrong? I just cannot seem to find the solution. Maybe when Photoshop saves a PCX file the locations of the colors in the table are not the same as the palette? Does pcx2gba switch colors?

I've even tried explicitly grabbing a color randomly from my Sprite, placing it at the first location of the sprite data array, as well as placing that same color explicitly into OBJPaletteMem[0], and the color still shows up on the sprite and is not transparent.

I must be missing something. I just don't know what it is. If you need more information I would be happy to supply it. Any help is appreciated. Thanks.
_________________
LoomSoft.net

#14177 - sajiimori - Wed Dec 31, 2003 8:57 pm

Without source, I can only guess that it has to do with the fact that colors on GBA are 15 bit, so 255:0:255 is not a color, but 31:0:31 is. Use an emulator to check the actual palette contents against your actual sprite character contents.

Anyway, you don't need that transparent bit set. That's for alpha blending. Regular transparency always applies.

#14178 - Miked0801 - Wed Dec 31, 2003 8:59 pm

First thing I'd do is to check what's being loaded into the VRAM location of the sprite to make sure that the color that the sprite is displaying is truely at palette position 0 in the sprite. If not possible, look at the binary that you are compiling and make sure that the data has a whole bunch of 0s in it (if 8-bit, 0s, if 4-bit, nibble values of 0s.) Truth is I didn't know you could even turn off transparencies in sprites :)

Mike

#14180 - DragonPoof - Wed Dec 31, 2003 9:06 pm

Quote:
Use an emulator to check the actual palette contents against your actual sprite character contents.


Thank you. That's just what I needed to hear. :) Ironically enough, I've been using an emulator for the whole process of trying to get the damn transparency to work. So, it's definitely my own fault. I don't know why I didn't think of checking that stuff in the emulator.

Apparantly I was putting the colors into the palette backwards, thinking color 0 would be the top left color in my color table. It's the bottom right.
/slaps self.

Thanks for that reply. Just what I needed!

[Edit]
Any cool tools out there that reverse palette entries, heh, as well as update all the pixels in the image to reflect it? :) Stupid photoshop.

Or how about a paint program that's good with palettes AND can export in pcx? :P
_________________
LoomSoft.net

#14182 - sajiimori - Wed Dec 31, 2003 10:06 pm

Paint Shop Pro is my favorite for low-res, low-color graphics.

I think there's a tool on gbadev for messing with palettes, but I don't recall the name.

#14194 - Cearn - Thu Jan 01, 2004 1:24 pm

Quote:

Any cool tools out there that reverse palette entries, heh, as well as update all the pixels in the image to reflect it? :) Stupid photoshop.

Or how about a paint program that's good with palettes AND can export in pcx? :P


If by reverse you mean swap the colors of the palette indices and all the pixels with those indices then, yeah, my own bitmap editor does that.
And it's good with palettes. And loads/saves pcx, among other things. (And exports to C-code, but that wasn't asked about).

It's a Win32 program, the zip-file is 208kb. Want to try it?

#14196 - DragonPoof - Thu Jan 01, 2004 5:25 pm

I'd love to give it a try! Got a link? :)
_________________
LoomSoft.net

#14333 - Cearn - Mon Jan 05, 2004 1:19 pm

Sorry, no link. Don't even have my own internet connection yet :(
Either I have to mail it to you or give to gbadev, but it's not quite ready for that yet.