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.

DS development > stuck with alpha blending.

#101861 - PypeBros - Fri Sep 08, 2006 1:56 pm

I've been crawling for info on doing alpha-blending between background layers, but i cannot get it working on my DS.

basically,

* i have SUB_BG0_CR= ...|BG_PRIORITY(1)|BG_256_COLOR, which i'd like to remain "solid" pixels
* i have SUB_BG1_CR= ...|BG_PRIORITY(0)|BG_256_COLOR, which i'd like to have translucent, on top of BG0, but which simply stays "solid".

then i do
Code:

  SUB_BLEND_CR = BLEND_SRC_BG0|BLEND_DST_BG1|BLEND_ALPHA;
  SUB_BLEND_AB = 16 | (4<<8);


and there, nothing actually happens. I tried toying with other values for A and B or to swap BLEND_SRC_* with BLEND_DST_* ...

Anyone knows of a demo / tutorial or whatever which would explain that with a bit more details on what the "source" and "destination" actually means here ?

thanks in advance.[/list]

#101975 - PypeBros - Sat Sep 09, 2006 10:09 am

okay ... first of all, my emulator didn't support alpha blending (oh dear).
Then i found a demo for sprite-over-BG alpha blending in PA_lib (fun to see the author saying "no idea of what BD_TARGET is" where it's obviously the backdrop, btw :P)

And that worked fine on my DS. So i guess i'll just study that code to find out how BG-to-BG blending works.

posted my findings on http://sylvainhb.blogspot.com/, if anyone is interested :)
_________________
SEDS: Sprite Edition on DS :: modplayer

#101991 - tepples - Sat Sep 09, 2006 4:41 pm

PypeBros wrote:
okay ... first of all, my emulator didn't support alpha blending (oh dear).

VisualBoyAdvance does. Get α-blending working on the Game Boy Advance platform, and the knowledge should transfer to the DS.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#102206 - Omegas - Mon Sep 11, 2006 8:05 pm

I'm a bit late with this post as you seem to have figured it out already... :) But I made a blending test once and decided to share it now: www.vilminko.net/henri/nds/dualbg_blend.zip

You can play with the blending factors and see what happens... The source code is heavily commented so I hope it might help someone learning to handle backgrounds and other basic stuff too.

#102210 - Lick - Mon Sep 11, 2006 8:59 pm

Wow! Nice one Omegas! Thanks for sharing.. ;)
_________________
http://licklick.wordpress.com