#21726 - Lord Graga - Thu Jun 03, 2004 11:23 pm
Hey all!
I have a problem: I can't get REG_BLDMOD set correct so that it blends background 0 against the sprites behind it (they have higher priority) (I want it to fade in and out).
Could anyone please supply me with a code example of how to do that?
I am totally lost!
#21730 - dagamer34 - Fri Jun 04, 2004 12:51 am
Sorry, I can't provide you with a code sample but I will try to help.
Are you setting the REG_COLEV(*(vu16*)0x4000052) register? It controls the actual blending levels. Take a look at the CowBite Spec to see how to set the register.
Can you tell us what is happening or give us a picture to help explain your problem?
_________________
Little kids and Playstation 2's don't mix. :(
#21738 - johnny_north - Fri Jun 04, 2004 4:52 am
Code: |
REG_BLDMOD = (BIT2|BIT6|BIT8);
while(i<16){
if(Timer - timer > 40){
REG_COLEV= i<<8|15-i;
timer = Timer;
i++;
}
} |
This code will make bg2 transparently fade against bg0.
This snipet sets the blend mode to 1 (bit 6 - transparency), the first target of the register to bg2 (bit 2) and the second target to bg0 (bit 8). I've chosen to use REG_COLEV to control the blening. The first 4 bits of this register control the transparency level of the first target of REG_BLDMOD. Bits 8-12 control the level of the second target of REG_BLDMOD.
I haven't thouroughly experimented yet, but REG_COLEY might be use for mode 2 and 3.
It appears that mode 0 will blend sprites to the 2nd target if they are above the 2nd target.
Mode 2 and 3 appear to be fade in and out modes respectively. The PERN project contains a table of these values with a small explanation.
BTW - using windows seemed to disable the ability to blend at all. Maybe someone here can confirm or deny.
#21739 - tepples - Fri Jun 04, 2004 5:56 am
You need to set separate blending bits for what's inside the windows.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#21748 - Cearn - Fri Jun 04, 2004 9:19 am
You can also read up on blending here. This also mentions the specific window/blend flags Tepples mentioned, and has a sample for download (see bottom of page)
Note that priorities can also mess up blending, try switching source and target layers. And remember that blending with sprites is messy overall (see fig 2).