Page 1 of 1

Transparency on Pane A

Posted: Tue Mar 04, 2014 7:57 pm
by matteus
I'm struggling to get transparency working on Pane A.

I have some extremely basic code (i'm aware the alignment maybe off at present!).

Code: Select all

    VDP_drawImageEx(APLAN, &border, TILE_ATTR_FULL(PAL3, FALSE, FALSE, FALSE, ind), 0, 0, TRUE, TRUE);
    //u16 newInd = ind;
    ind += border.tileset->numTile;
    VDP_drawImageEx(BPLAN, images[173], TILE_ATTR_FULL(pal, FALSE, FALSE, FALSE, ind), 6, vpos + 4, TRUE, TRUE);
Here are the source images too

http://www.mediafire.com/view/4avi5n3db ... border.png

http://www.mediafire.com/view/o4pzxep76 ... st0040.png

Can't seem the get transparency to work within the border though :(

I end up with this

Image

Posted: Wed Mar 05, 2014 2:51 pm
by djcouchycouch
I'm just guessing here but if most of the black pixels in the image are transparent but the black pixels close to the icons and border are not, then maybe it's using a different black in the palette?

Posted: Wed Mar 05, 2014 4:02 pm
by matteus
djcouchycouch wrote:I'm just guessing here but if most of the black pixels in the image are transparent but the black pixels close to the icons and border are not, then maybe it's using a different black in the palette?
I thought the same :) I ended up setting the background colour to the first colour of the 3rd palette (the 3rd palette is assigned to PANE A) via VDP_setBackgroundColor(32); and it now works!

One problem resolved :D

But I still have a problem with PANE B where all of my animation frames have have a Palette position 0 containing a colour that needs to be displayed! I spend a large amount of time rearranging the palettes via GIMP, which is painful to do!

Update video: http://youtu.be/3n5rci_SC2o

Posted: Wed Mar 05, 2014 10:15 pm
by Stef
Ideally i should correctly support the transparent color of PNG file, that would definitely help :)

Posted: Wed Mar 05, 2014 10:15 pm
by Stef
By the way, the result is really impressive now, fast and smooth animation =)

Posted: Thu Mar 06, 2014 11:20 am
by matteus
Stef wrote:By the way, the result is really impressive now, fast and smooth animation =)
Thanks Stef! I could not have done this without you, Chilly's and djcouchycouch's help :)

Can't wait to get some more frames drawn and then I'm going to look into lowering the rom size by removing the need to load and display the same frame again and again in some sections.

Code: Select all

struct Frame
            {
              //number of frames to display for
              int noOfFrames;
             // palette->data
             data ;
             // number of tiles
             int noOfTiles;
            };

Posted: Thu Mar 06, 2014 11:40 am
by Stef
Maybe a simple compression scheme as RLE could help too. RLE should be fast enough to not slowdown massively the animation :)

Posted: Thu Mar 06, 2014 12:50 pm
by matteus
Is that the -3 option? Can't remember off the top of my head but I did try some of the other tile compression methods and experienced tile corruption. I'll look again :)

Posted: Thu Mar 06, 2014 12:53 pm
by matteus
Stef wrote:Ideally i should correctly support the transparent color of PNG file, that would definitely help :)
Definitely! Would help me out loads! Is that via palette based transparency or using of the png alpha layer?

Posted: Thu Mar 06, 2014 1:15 pm
by Stef
Just by using the PNG alpha layer, it seems to be the easiest way of handling it without any confusion :)