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.

Graphics > BG Transparency Effect

#164958 - brave_orakio - Thu Dec 04, 2008 2:17 am

Hi guys, I was wondering if there was any way to make certain parts of a BG transparent while the others are opaque(For GBA in case you're wondering what system)?

Also, if you are familiar with any game with a day and night cycle, what does this game use? A transparent background or a change in palette to simulate the day/night effect?
_________________
help me

#164960 - DekuTree64 - Thu Dec 04, 2008 3:15 am

1. Normally, no. But I think you can make a window with blending enabled inside and disabled outside. And you could make that an OBJ window, or do HBlank resizing of it to make shapes other than a rectangle.

2. Not sure if I've seen any GBA games do dynamic day/night, but Seiken Densetsu 3 on SNES does, and I'm pretty sure it uses palette modification.
If it were up to me, I'd make a day palette and night palette for everything (and morning/sunset if you have time), and interpolate between them. Or if you don't have time to do hand-made palettes, modify the palette in code.

An overlay might be ok if you only plan to use it a few times, but it would probably look pretty washed out since the GBA can't do per-color channel blending. So to get any sort of a blue tint, you'd have to be alpha blending against some single shade of blue.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#164963 - brave_orakio - Thu Dec 04, 2008 6:00 am

Hey thanks! I'll look into the Window of GBA and see what I can do with it.

Actually I was thinking of Seiken Densetsu 3 When I asked that question. Thanks again!
_________________
help me

#164970 - Miked0801 - Thu Dec 04, 2008 5:47 pm

In Harry Potter 3, for night scenes, we just palette tweened to a night palette if available, or just took the red and green channels down to 50% if not. Just tweaking the red/green gave a nice effect and can be done cheap. The same code can be changed to take down the blue to give a nice sepia effect (used as well for flashbacks.)

#164980 - brave_orakio - Fri Dec 05, 2008 2:45 am

What does palette tween mean? I'm not familiar with the process.

Yes it is possible for me to take down the Green and Red palette. I'll check that out as well.

Although I tried Seiken Densetsu 3 again and I noticed that the Dusk part seems to use an overlay and some palette change then only a palette change when it's completely night.
_________________
help me

#164986 - nanou - Fri Dec 05, 2008 4:40 am

brave_orakio wrote:
What does palette tween mean? I'm not familiar with the process.

Tweening is usually the computation of intermediate frames between keyframes in animation. It makes sense to apply it to palettes, too, where you want to progress from one palette to another with a smooth fade. I.e. blend the two palettes according to time progression and the result is the palette you use during the transition. I think that's what Miked0801 is talking about.
_________________
- nanou

#164989 - brave_orakio - Fri Dec 05, 2008 6:00 am

Ah I see, thank you. I think that seems a bit more complicated than lowering the red and green values.
_________________
help me

#165002 - Miked0801 - Fri Dec 05, 2008 6:26 pm

Not really, you either linear interpolate between a starting and ending palette over time (tween), or you lower the red/green channels of a palette over time. Either way, you need to keep the original palette for calculations so they both take roughly the same amount of work. A tween gives you more flexibility though - you can leave certain palette entries alone or increase/change them in other ways (think lamps increasing in intensity as other lights fade in a room.)

Palette tweening (and cycling) are very powerful, cheap techniques to do amazing things - in the right hands.

#165035 - brave_orakio - Sun Dec 07, 2008 1:58 am

Indeed! Thank you very much!
I am trying to learn these techniques because I want to see what my options are when I implement certain parts of my game. Thank you very much!
_________________
help me

#165111 - tepples - Wed Dec 10, 2008 3:45 am

DekuTree64 wrote:
Not sure if I've seen any GBA games do dynamic day/night, but Seiken Densetsu 3 on SNES does

As does the Super NES version of Donkey Kong Country. I know Animal Crossing for DS does, and I'm guessing the Harvest Moon games might too.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#165113 - nyarla - Wed Dec 10, 2008 4:01 am

Yoshi Touch & Go on the DS also does tweening between morning/day/evening/night palettes.. it looks great :)

#165159 - brave_orakio - Thu Dec 11, 2008 3:45 am

Nice, thank you! I'll go look for videos and hope I see the transitions.
_________________
help me