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.

DS development > Paletted transparency not at Color0

#169408 - DiscoStew - Thu Jul 09, 2009 4:18 am

Before I go about devising a plan involving the switching around of palette indices to get correct transparency, I'd like to know if it is possible in a 4/8-bit texture palette to have the transparent color not be located at Color0? You may wonder why I'm not wanting to make an external conversion program for this, and it is because I'm using "legacy" assets that I want to retain in their pure form, but to have them working on the DS as if they were meant for the platform.

If there is no other spot but Color0 for this, then I'll just get working on internal palette swapping to create the same effect.


EDIT:

I was also thinking just now if it is possible that rather than an index to base transparency off of, what about a specific color? Does the palette only use the regular 15 of the 16 bits, or can that last bit be used as an alpha value? Again, I'm only interested in 4/8 bit palette modes.
_________________
DS - It's all about DiscoStew

#169415 - Dwedit - Thu Jul 09, 2009 12:49 pm

You will need to modify the assets at some point. At the very least, swap color #0 with the transparent color.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#169420 - elhobbs - Thu Jul 09, 2009 5:02 pm

like dwedit said - you need to convert the assets to ds format at some point so the system can use them. it does not matter if it is internal or external. for 3d textures that use 4 or 8 bit palettes you can only use index 0 for transparency - they needs to use GL_TEXTURE_COLOR0_TRANSPARENT.

so you can palette swap index 0 and swap your indices at load time

or

there is also these texture formats
Code:
   GL_RGB32_A3   = 1, /*!< 32 color palette, 3 bits of alpha */
   GL_RGB8_A5    = 6, /*!< 8 color palette, 5 bits of alpha */


or

your other option is to convert them all to GL_RGBA
Code:
   GL_RGBA       = 7, /*!< 15 bit direct color, 1 bit of alpha */

#169424 - DiscoStew - Thu Jul 09, 2009 10:15 pm

Alright. Since I have to keep the original formats because of palette effects, I'll just have deal with palette swapping, and store what it originally was internally as a reference for when palette effects come into use.
_________________
DS - It's all about DiscoStew