Alpha in the same background??

Post Reply
elnanni
Posts: 23
Joined: Sat Nov 14, 2009 1:41 am

Alpha in the same background??

Post by elnanni » Sat Nov 21, 2009 2:15 am

Hi, it's me again :S. It's coding weekend so I hope to find some of the Gurus :D.

I was able to draw my isometric tiles in background 1, but now I have another problem, if I set a transparent color, in this case #00FFFF - RGB15(0, 31, 31) - this transaprency shows background 0, but what I want is to show the tile behind, here's te code:

Code: Select all

void drawBg32x32Iso(int *tilePos, int tile, int offSet){

  if(*tilePos % 32 == 0 && *tilePos != 0) *tilePos += 96;
  *(BG_MAP_RAM(0) + *tilePos + 32 * offSet) = tile;
  *(BG_MAP_RAM(0) + *tilePos + 1 + 32 * offSet) = tile + 1;
  *(BG_MAP_RAM(0) + *tilePos + 2 + 32 * offSet) = tile + 2;
  *(BG_MAP_RAM(0) + *tilePos + 3 + 32 * offSet) = tile + 3;
  *(BG_MAP_RAM(0) + *tilePos + 32 + 32 * offSet) = tile + 4;
  *(BG_MAP_RAM(0) + *tilePos + 33 + 32 * offSet) = tile + 5;
  *(BG_MAP_RAM(0) + *tilePos + 34 + 32 * offSet) = tile + 6;
  *(BG_MAP_RAM(0) + *tilePos + 35 + 32 * offSet) = tile + 7;
  *(BG_MAP_RAM(0) + *tilePos + 64 + 32 * offSet) = tile + 8;
  *(BG_MAP_RAM(0) + *tilePos + 65 + 32 * offSet) = tile + 9;
  *(BG_MAP_RAM(0) + *tilePos + 66 + 32 * offSet) = tile + 10;
  *(BG_MAP_RAM(0) + *tilePos + 67 + 32 * offSet) = tile + 11;
  *(BG_MAP_RAM(0) + *tilePos + 96 + 32 * offSet) = tile + 12;
  *(BG_MAP_RAM(0) + *tilePos + 97 + 32 * offSet) = tile + 13;
  *(BG_MAP_RAM(0) + *tilePos + 98 + 32 * offSet) = tile + 14;
  *(BG_MAP_RAM(0) + *tilePos + 99 + 32 * offSet) = tile + 15;
  *tilePos += 2;

}

...

  dmaCopy(tilesPal, BG_PALETTE, tilesPalLen);
  dmaCopy(tilesTiles, bgGetGfxPtr(bgTiles16x12), tilesTilesLen);

  int tilePos;
  int tile;
  tilePos = 0;

  drawBg32x32Iso(&tilePos, 0, 0);
  drawBg32x32Iso(&tilePos, 16, 1);
  drawBg32x32Iso(&tilePos, 0, 2);
  drawBg32x32Iso(&tilePos, 16, 3);
  drawBg32x32Iso(&tilePos, 0, 4);
  drawBg32x32Iso(&tilePos, 16, 5);

  int row;
  int col;
  for(row = 0; row < SCREEN_HEIGHT; row++)
    for(col = 0; col < SCREEN_WIDTH; col++)
      *(bgGetGfxPtr(bgMain256x256) + col + (row * SCREEN_WIDTH)) = RGB15(0, 0, 31) | BIT(15);
Is there a way to achieve this or will I have to use PaLib :S?? Hehe, just kiding, is there a way, or will I have to do it pixel by pixel :S???

This is the image:

Image
http://mmabj.blogsome.com/images/bug3.jpg

elnanni
Posts: 23
Joined: Sat Nov 14, 2009 1:41 am

Re: Alpha in the same background??

Post by elnanni » Mon Nov 30, 2009 7:23 pm

No answer yet :(?

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: Alpha in the same background??

Post by elhobbs » Mon Nov 30, 2009 7:46 pm

example images are even better when you can see them...

elnanni
Posts: 23
Joined: Sat Nov 14, 2009 1:41 am

Re: Alpha in the same background??

Post by elnanni » Mon Nov 30, 2009 9:07 pm

Hehe, never thought that could be a problem, he.

Any way, just refresh the forbiden page and the image should be shown.

So, looks like I was not able to explain myself, ok.

I have this tiles

TTBBBBBBBBBBB
BBBBBBBBBBBTT

and

TTGGGGGGGGG
GGGGGGGGGTT

T = Transparent
B = Blue
G = Green

For example, and as this is an Isometric tile, so I need an offset in order to make it look like an isometric map, so I want to do this:

TTGGGGGGGGGBBBBBBBBB
GGGGGGGGGBBBBBBBBBTT

So, as you can see, what I want is that my transparent color show the tile behind it, and not the background behind my tiles background.

Hope this explanation helps to explain my problem. If not, just refresh the URL of the image I provided before.

StevenH
Posts: 133
Joined: Sun Feb 22, 2009 7:59 pm

Re: Alpha in the same background??

Post by StevenH » Mon Nov 30, 2009 10:29 pm

Short answer: No.

Long answer: No, but if you work on your tiles carefully you can achieve what you want, but it means that the number of tiles you are going to use will increase by a fair bit.

For example, where you have the following tiles:

Code: Select all

TTGGGGTT  TTBBBBTT
GGGGGGGG  BBBBBBBB
TTGGGGTT  TTBBBBTT
TTTTTTTT  TTTTTTTT
Split this into 4 tiles (4x2) for each iso tile, and then look at all the possible tile combo's you may have and create these tiles as well:

Code: Select all

BBGG  GGBB  BBBB  BBBB  GGGG  GGGG
GGGG  GGGG  BBBB  BBBB  GGGG  GGGG

BBGG  GGBB  BBBB  BBBB  GGGG  GGGG
BBBB  BBBB  BBBB  BBBB  GGGG  GGGG
You then use these tiles in the places where you need to have the alpha blending.

If you use more than 2 tiles then you will need to add those splits in as well, so the number of translation tiles slowy get worse

----

The way to do isometric on the GBA/DS according to Square Enix (more specifically FFTA) is to use 1 background layer for a pre-rendered iso image with a second layer used for any area's of the map that you can walk behind.

Another way that's been shown to me is to use 2 background layers for the background tiles, another for the foreground items, leaving one for any text or any other information you want to display.

elnanni
Posts: 23
Joined: Sat Nov 14, 2009 1:41 am

Re: Alpha in the same background??

Post by elnanni » Sat Dec 12, 2009 5:04 am

Ok, so I was able to do it, I used two text backgrounds to achieve this, but I really did not like the way I did it.

In the less priority bg I draw this tiles:
Image

Then the bg with more priority has this:
Image

And combined looks like this:
Image

But I didn't like the way it's done :S, now I'll try to draw pixel by pixel :(, I tried to get each pixel from the tiles bgGetGfxPtr pointer but did not work :(...

I'm starting to get mad :S, any kind of advice will be nice :S...

WinterMute
Site Admin
Posts: 2003
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Alpha in the same background??

Post by WinterMute » Thu Dec 31, 2009 4:00 am

Help keep devkitPro toolchains free, Donate today

Personal Blog

elnanni
Posts: 23
Joined: Sat Nov 14, 2009 1:41 am

Re: Alpha in the same background??

Post by elnanni » Fri Jan 01, 2010 5:43 am

It's an interesting project :D. I like people sharing knowledge :D. It's not what I'm loking to achieve but it's good :D.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests