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.

Coding > Transparency question

#10854 - NoMis - Thu Sep 18, 2003 1:53 pm

Hello everybody, i just started gbadevelopment and try to use trancparency. I have 2 backgrounds and a sprite. bg1 is my ground map bg2 is my sky map with some fluffy clouds. Now i wanna see bg1 and my sprite throug my clouds. I made it to see bg1 through the sky but my sprite is on top of the sky now. if i set the prioritys that my sprite is under my sky i loose my transparency effect completle.

Does anybody can help me with this problem.

NoMis

#10855 - niltsair - Thu Sep 18, 2003 2:27 pm

By transparency, do you mean that the sky is half showing on top of what's underneath or that there's hole in it where you can see underneath?

I'll assume it's the first one. Then you need to set the object(OAM) transpareny bit to true and when setting the alpha register, include the sprites as being included in the color to mix together.
_________________
-Inside every large program is a small program struggling to get out. (Hoare's Law of Large Programs)
-The man who can smile when things go wrong has thought of someone he can blame it on. (Nixon's Theorem)

#11025 - Archeious - Tue Sep 23, 2003 7:26 pm

niltsair wrote:
By transparency, do you mean that the sky is half showing on top of what's underneath or that there's hole in it where you can see underneath?

I'll assume it's the first one. Then you need to set the object(OAM) transpareny bit to true and when setting the alpha register, include the sprites as being included in the color to mix together.


I have been trying to find info on the alpha register, will no luck. Do you know of any ggood documentation?

Archeious

#11028 - niltsair - Tue Sep 23, 2003 7:40 pm

From cowbite webpage :
Code:
Address: 0x4000050 - REG_BLDMOD

F E D C  B A 9 8  7 6 5 4  3 2 1 0
X X T S  R Q P O  M M L K  J I H G

0   (G) = Blend BG0 (source)
1   (H) = Blend Bg1 (source)
2   (I) = Blend BG2 (source)
3   (J) = Blend BG3 (source)
4   (K) = Blend sprites (source)
5   (L) = Blend backdrop (source)
6-7 (M) = Blend Mode
         
          There are four different modes:
          00: All effects off
          01: alpha blend
          10: lighten (fade to white)
          11: darken (fade to black)

8   (O) = Blend BG0 (target)
9   (P) = Blend BG1 (target)
A   (Q) = Blend BG2 (target)
B   (R) = Blend BG3 (target)
C   (S) = Blend sprites (target)
D   (T) = Blend backdrop (target)
The effect you wanna use is alpha blend.
_________________
-Inside every large program is a small program struggling to get out. (Hoare's Law of Large Programs)
-The man who can smile when things go wrong has thought of someone he can blame it on. (Nixon's Theorem)