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.

Coding > How do you program the Yoshi's Island effect?

#25234 - LOst? - Thu Aug 19, 2004 6:10 am

In Super Mario Advance 3 Yoshi's Island, the title screen is an island rotating. Now that's just the mode 7 effect. I guess they use some z buffer to store the objects in the right order.

But I have always wondered how the Yoshi's Island logo is working. How do you program a background to do that wave effect? What kind of math do you use since there is limited with CPU time during the HBLANK.

Turning off the Hblank interrupt will make the logo white instead of "orange with animated green wave effect". Turning off the Vcount will stop the logo from waving.

So how do you do the wave effect? And how do you do the color wave effect (orange to green)?

EDIT: The color effect is just the one palette index changing during the Hblank.

#25240 - DKL - Thu Aug 19, 2004 9:03 am

LOst? wrote:
But I have always wondered how the Yoshi's Island logo is working. How do you program a background to do that wave effect? What kind of math do you use since there is limited with CPU time during the HBLANK.


Precalculated sine tables.
Did't see the effect but if all it does is an horizontal wave effect, simply change the x offset according to your table, after each line.
If it does a two dim effect, this is a little more complex. For each pixel in output, get x in the input image by applying a formula with sine values. Do the same for y.

A little like that :
x' = f_sin(x)
y' = g_cos(y)

DKL

#25246 - MumblyJoe - Thu Aug 19, 2004 12:38 pm

I don't have the game so I can't verify that it was done like this for yoshi's island, but I was under the impression that the mosaic effect did something like that...
_________________
www.hungrydeveloper.com
Version 2.0 now up - guaranteed at least 100% more pleasing!

#25250 - DKL - Thu Aug 19, 2004 1:41 pm

MumblyJoe wrote:
I don't have the game so I can't verify that it was done like this for yoshi's island, but I was under the impression that the mosaic effect did something like that...


Yep, it can just be a visual trick too.

DKL

#25260 - DiscoStew - Thu Aug 19, 2004 4:55 pm

I just took a loook at the game, and yes, it does use HBlank while altering the X/Y position. The color alteration seems to just be a simple change from orange, then yellow, then green, then back to orange. I didn't check on an emu, but I'm guessing that the layer with the Title on it is 4-bit, so on the HBlank, just changing the palette appropriately should do that.
_________________
DS - It's all about DiscoStew