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.

Beginners > Alpha transparency woes (OBJ - OBJ -transparency) :(

#15038 - qw3rty - Fri Jan 16, 2004 12:40 pm

Everything works fine for BG - OBJ transparency (show BG through OBJ / show OBJ through BG), but when it comes to OBJ - OBJ transparency nothing works :

I'm trying to show non-transparent sprites(priority 2 - alpha mode 0) through transparent sprites (priority 1 - alpha mode 1).

I tried setting the second target screen of REG_BLDMOD to OBJ (set BIT12 of REG_BLDMOD) but it didn`t work.
(I tried a LOT of different combinations of bitpatterns in REG_BLDMOD - reasonable as well as absurd ones ;) )

P.S. : The screen mode is mode 0.
P.P.S : BG & OBJ are both in 16-color mode

#15044 - poslundc - Fri Jan 16, 2004 3:34 pm

Object-to-object alpha blending is unsupported on the GBA.

Dan.

#15047 - qw3rty - Fri Jan 16, 2004 4:38 pm

D'OH !
thanks for the reply

#15051 - Miked0801 - Fri Jan 16, 2004 5:56 pm

Use fake transparency - display the "Transparent" sprite every other tic and you'll get a good transparent effect.

#15056 - qw3rty - Fri Jan 16, 2004 6:20 pm

thanks for the advice :)

I have another problem regarding sprite-transparency :

I try to display an opaque sprite above a transparent one (the sprite is transparent for the background below both sprites) - on the emulator everything looks nice, however on the real machine, i see a "shining" square around the opaque sprite -it seems the background-color of my opaque sprite does interfere with the alpha blending below :(

#15071 - poslundc - Fri Jan 16, 2004 9:01 pm

Miked0801 wrote:
Use fake transparency - display the "Transparent" sprite every other tic and you'll get a good transparent effect.


You can also try supertransparency (there is a link at the end of the page that gives a summary of the technique), although I never got it working properly. (Probably will try again at some point.)

I can't comment on the hardware problem you're having as I haven't played around enough with transparency.

Dan.

#15082 - Miked0801 - Fri Jan 16, 2004 10:13 pm

Hehe. Yep, just what we did on some of our games to get shadows, water effects, and "Ghost Monsters". And varying the timing does indeed help with Opaqueness. Good link. Cheap VBlank trick to get good results :)

#15083 - poslundc - Fri Jan 16, 2004 10:43 pm

It's an HBlank trick, actually, although I'm still not 100% certain I "get it". Touchstone, perhaps you'd care to comment? This is from your doc on the subject:

Quote:
The new trick avoid the flicker problem by toggling the visibility of the sprite per scanline instead of per frame. For even frames the sprite is visible on even scanlines and for odd frames the sprite is visible on odd scanlines.


What I don't quite get about it is if even scanlines are drawn darker by the GBA on even frames and odd scanlines drawn darker on odd frames, won't this technique just be turning the sprite on (in effect) whenever either the dark or light scanlines are being drawn?

Which would result in either a near-full-intensity image or near-empty-intensity image. But I don't see how you could determine which one.

Is this the correct goal of the effect?

Dan.

#15849 - qw3rty - Sun Feb 01, 2004 5:55 pm

qw3rty wrote:
thanks for the advice :)

I have another problem regarding sprite-transparency :

I try to display an opaque sprite above a transparent one (the sprite is transparent for the background below both sprites) - on the emulator everything looks nice, however on the real machine, i see a "shining" square around the opaque sprite -it seems the background-color of my opaque sprite does interfere with the alpha blending below :(


I figured out the solution for this problem :

Make sure, the opaque sprite has a lower sprite number as the transparent sprite.

#15875 - RaBBi - Mon Feb 02, 2004 10:37 am

This trick is really interesting, but I don't understand these both terms "even" and "odd".

I don't want a french translation (if you can, thanks anyway ^^) but just a little explanation about them ^^
Does "even" mean "2n" and "odd" mean "2n+1"?

It would help me to understand the entire trick for supertransparency, since I understood yet that's a Hblank trick.

Thanks.
_________________
Sorry for my poor english, but it would be worst for you to understand me if I speak in my native language, French ^^

#15877 - qw3rty - Mon Feb 02, 2004 11:25 am

RaBBi wrote:

I don't want a french translation (if you can, thanks anyway ^^) but just a little explanation about them ^^
Does "even" mean "2n" and "odd" mean "2n+1"?


Yup, that`s the meaning of "odd" & "even" :D

#16069 - delbogun - Sat Feb 07, 2004 5:19 pm

About transparency, does it work on 16-colors (4-bit) tiles and sprites? Because I have problem making it work correctly. Is this correct?:

REG_BLDCNT = 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0100 | 0x0040;
REG_BLDALPHA = 8 + (8<<8);

I want BG0 to be transparent over BG1, BG2, BG3 and the sprite.
BG0 is the top layer and you should see thru it.