#154127 - abszero - Fri Apr 11, 2008 7:32 pm
Sorry to bring up alpha blending again - I know it's been overdone but I've been beating my head against it for a couple days now and something must be wrong.
The setup is that I've got two layers I've been working with and now I want to add a third layer, filled with a flat color, that is blended and windowed above the other two. The effect should be that the entire original display (bottom two layers) is shaded except for the portion inside a window.
I sorta have windowing working in general, but the blending is not going well. So for now I will focus on JUST THE BLENDING, WITHOUT WINDOWING </clarity>.
The three layers are configured as below under Mode 5:
Top layer, with the blending and windowing
BG0: BG_COLOR_256, BG_PRIORITY(1);
Middle layer, binary mode for text
BG3: BG_BMP8_256x256, BG_PRIORITY(2);
Bottom layer, tile mode for backgrounds (all pixels are opaque so the backdrop isn't seen)
BG1: BG_COLOR_256, BG_PRIORITY(3);
There are additionally sprites that exist at priorities 2 and 3 which should also appear shaded by the transparent layer.
My blending register is configured thusly:
#define WINDOW_BLEND_AMOUNT 8
#define BLEND_VALUE(x) (x) | ((0x10 - (x)) << 8)
BLEND_CR = BLEND_ALPHA | BLEND_SRC_BG0 | BLEND_DST_BG1 | BLEND_DST_BG3 | BLEND_DST_SPRITE;
BLEND_AB = BLEND_VALUE(WINDOW_BLEND_AMOUNT);
Though I have also written some code that runs through all the possible BLEND_DST combinations and none of them work the way I want.
Any thoughts? I read something somewhere that sounded like the blend destination might have to be exactly one priority level greater than the source. Is that the case / my problem? Thanks for any suggestions.
The setup is that I've got two layers I've been working with and now I want to add a third layer, filled with a flat color, that is blended and windowed above the other two. The effect should be that the entire original display (bottom two layers) is shaded except for the portion inside a window.
I sorta have windowing working in general, but the blending is not going well. So for now I will focus on JUST THE BLENDING, WITHOUT WINDOWING </clarity>.
The three layers are configured as below under Mode 5:
Top layer, with the blending and windowing
BG0: BG_COLOR_256, BG_PRIORITY(1);
Middle layer, binary mode for text
BG3: BG_BMP8_256x256, BG_PRIORITY(2);
Bottom layer, tile mode for backgrounds (all pixels are opaque so the backdrop isn't seen)
BG1: BG_COLOR_256, BG_PRIORITY(3);
There are additionally sprites that exist at priorities 2 and 3 which should also appear shaded by the transparent layer.
My blending register is configured thusly:
#define WINDOW_BLEND_AMOUNT 8
#define BLEND_VALUE(x) (x) | ((0x10 - (x)) << 8)
BLEND_CR = BLEND_ALPHA | BLEND_SRC_BG0 | BLEND_DST_BG1 | BLEND_DST_BG3 | BLEND_DST_SPRITE;
BLEND_AB = BLEND_VALUE(WINDOW_BLEND_AMOUNT);
Though I have also written some code that runs through all the possible BLEND_DST combinations and none of them work the way I want.
Any thoughts? I read something somewhere that sounded like the blend destination might have to be exactly one priority level greater than the source. Is that the case / my problem? Thanks for any suggestions.