Transparency on Pane A

SGDK only sub forum

Moderator: Stef

Post Reply
matteus
Very interested
Posts: 336
Joined: Mon Feb 04, 2008 1:41 pm

Transparency on Pane A

Post 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
djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post 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?
matteus
Very interested
Posts: 336
Joined: Mon Feb 04, 2008 1:41 pm

Post 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
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

Ideally i should correctly support the transparent color of PNG file, that would definitely help :)
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

By the way, the result is really impressive now, fast and smooth animation =)
matteus
Very interested
Posts: 336
Joined: Mon Feb 04, 2008 1:41 pm

Post 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;
            };
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

Maybe a simple compression scheme as RLE could help too. RLE should be fast enough to not slowdown massively the animation :)
matteus
Very interested
Posts: 336
Joined: Mon Feb 04, 2008 1:41 pm

Post 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 :)
matteus
Very interested
Posts: 336
Joined: Mon Feb 04, 2008 1:41 pm

Post 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?
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef »

Just by using the PNG alpha layer, it seems to be the easiest way of handling it without any confusion :)
Post Reply