#175905 - Samu - Sat Feb 26, 2011 12:47 pm
Hey there, im new to DS development and i was wondering...
What is the common practice with sprite palettes?
Is a single 16 color palette generally used for each sprite or a master 256 color palette used for all sprites?
Also if using 16 color palettes, asumming more than 16 sprites are required, you must enable extended palettes for sprites?
For tiled backgrounds I was thinking of having a 256 palette per map (or level), which would require extended background palettes. Is there a better, "standard" approach?
Thanks :)
#175907 - Dwedit - Sat Feb 26, 2011 5:21 pm
You could do it like a SNES/GBA and assign sprites or background tiles to use any of the 16 possible 16-color palettes.
Or you could use the Extended Palette feature, and select from many 256 color palettes.
Extended palettes use video memory instead of the usual palette memory, and can't be accessed by the CPU while being used. But you may still need to do palette effects, like palette animation. I think you can temporarily disable extended palettes during vblank time, and do your palette writes then, then re-enable them before the frame starts rendering.
You shouldn't need to write to the palettes to do simple fade effects, since there are separate blending features for that.
The only good reason not to use extended palettes is if you can get by with 16-color palettes, or want your graphics to be backward compatible with the GBA.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."
#175910 - Samu - Sat Feb 26, 2011 10:03 pm
With extended palettes you get 16 palettes of 256 colors. If your graphics use individual 16-color palettes, is there a way to split each extended palette into 16 16-color palettes like the normal palette? Or how can you get around rendering more than 16 sprites which use their individual 16-color sprite?
#175911 - Dwedit - Sun Feb 27, 2011 12:11 am
Normally people just have many sprites share some of the same 16-color palettes, so they don't need more than 16 different palettes on the screen at once. Or they load palettes in and out as needed, and simply don't have too much different stuff on the screen at once.
But if you really need more than 16 palettes, you can use extended palettes, and add 16*X to every non-transparent pixel as you load your graphics data into VRAM.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."
#175915 - sverx - Mon Feb 28, 2011 1:40 pm
You can assign to a sprite 1 out of 16 palettes, 16 colors or 256 colors if using extended palette. If you need more and you've got 16 colors sprite then you can duplicate the sprite and using 256 colors palette you can use 16 palettes (16 colors) for the first set and another 16 palettes (another portion of the same 256 color palettes...) for the second set... and so on :)