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 > Blending in an image

#41865 - ymalik - Mon May 02, 2005 4:52 pm

I have a start screen, but I want the screen to be first white, and then blend into the color of the final start screen. How can I do this without saving many palettes?

Thanks,
Yasir

#41871 - poslundc - Mon May 02, 2005 5:41 pm

Use REG_BLDMOD to lighten your background layer, and change the value stored in REG_COLEY on each frame to change the lightening amount and achieve a fading effect.

Dan.

#41872 - Miked0801 - Mon May 02, 2005 5:41 pm

Take your start and gola palettes. Figure out how many steps you want to take to get from start to finish. Then

palIncrementFixed = ((FinishPal - StartPal) << 16) / steps

Add the fixed value each tic to the start and you'll get to your dest.

Or just use the bldy register to do it for you (for white start/end palette only) (edit: As per "I type faster than Mike" Poslundc) :)

#41874 - ymalik - Mon May 02, 2005 5:53 pm

poslundc wrote:
Use REG_BLDMOD to lighten your background layer, and change the value stored in REG_COLEY on each frame to change the lightening amount and achieve a fading effect.

Dan.


That sounds good. I'll try it out. Thanks!

#41877 - ymalik - Mon May 02, 2005 7:00 pm

I'm reading Cearn's tutorial, and he says that blending will only the "A layers must be in front of the B layers," but I only have one layer. What should I do in this case? Also the value REG_COLEY (since I'm going from white to original color) should be between 0 and 1, where 0 is white and 1 is the original color of the image, correct?

#41882 - ymalik - Mon May 02, 2005 7:32 pm

Nevermind. Through guess work, I can manage things.

#41884 - ymalik - Mon May 02, 2005 7:45 pm

Guess work works pretty well! I start at 31 and keep on decrementing until I reach 0 for REG_COLY.