don't click here

Sega MD/Genesis "Water" effect in Sonic Games

Discussion in 'General Sonic Discussion' started by Marrr, Feb 21, 2010.

Thread Status:
Not open for further replies.
  1. Marrr

    Marrr

    Member
    13
    3
    3
    This is something that's been bugging me for years and years, but I've never found a place to ask the question where there would be a good chance of it being answered, now I have so here we go!

    In the original 16bit Sonic games, was the water/transparency effect used in such levels as Labyrinth, Aquatic Ruin etc a programming "trick" or hardware effect? and how did this effect limited the number of colours which could be displayed on screen?


    so did several of the palette entries need to be "reserved" (a bit like the old Amiga display mode HalfBrite... if any of you remember that!) to enable the effect or could you use the full 64 colours and the water effect at the same time?


    Also, did anybody else notice that in Sonic 3, where the water levels didn't have the flickery 'wave' at the top have a palette glitch in some cases (most notably Carnival Night) when you jumped in and out of the water? It was almost like the background colour 'flickered'. Does anybody know why this was? I never noticed it happening on Sonic 1,2 or CD.


    A bit OT, but were there any other Sega MD/Genesis games which used this effect? I only ever recall seeing it on Sonic.
     
  2. DimensionWarped

    DimensionWarped

    Erinaceous! Oldbie
    I thought water wasn't really a question of transparency as much as it was a change of palettes used when rendering below a certain level. I could be wrong, I'm not the most savvy person out there when it comes to how old games accomplished what they did.
     
  3. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,971
    76
    28
    USA
    rom-properties
    Water is implemented using raster effects. Specifically, the Genesis VDP has a register that lets you specify how many scanlines are drawn before the "Line Interrupt" (68000 Level 4) is triggered. The Sonic games set this register to the line number where the water should start, and afterwards they disable it until the next frame.

    Note that the entire 64-color palette is too big to be transferred completely during the horizontal blanking interrupt, so it has to be spread out over several lines. They masked this somewhat by adding extra sprites to the water line.
     
  4. Marrr

    Marrr

    Member
    13
    3
    3
    Ah, so that explains why on Sonic 3 where there was no sprites masking the water line you could see that different objects weren't always 'immersed' in water at the same level (the colour change effect was higher or lower sometimes on the background art than the sprites).

    So, if I get this right, the palette was changed when the line interrupt occured and then was changed back, so the MD was changing palettes very rapidly during the blanking interval to create the effect?
     
  5. Endri

    Endri

    Officer I don't have my drivers license with me. C Tech Member
    The code run at 1/60 of a second, so I assume this is fairly fast. Unless I'm mistaken.
     
  6. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,971
    76
    28
    USA
    rom-properties
    In Sonic 1 and Sonic 2, the line interrupt routine issues a DMA Memory to VRAM copy to copy the underwater palette to CRAM. This takes a few lines worth of execution time since it's in active display. After the active display area is drawn, the VDP issues a VBlank interrupt (68000 Level 6), during which the game copies the regular palette to CRAM using DMA (assuming the screen isn't fully underwater). The VDP can transfer more data using DMA during VBlank, since it doesn't have to draw anything to the screen.

    Sonic 3 splits up the underwater palette copy to multiple lines by itself instead of telling the VDP to copy everything at once in order to reduce the color artifacting on the water level line. I believe it does a full transfer during VBlank though, since the screen is turned off during that period.
     
  7. Tom41

    Tom41

    Pheer the baby EggRobo! Oldbie
    291
    0
    0
    UK
    In theory it's possible to switch the palette between scanlines several times per frame - I believe Eternal Champions CD uses this effect to achieve 256 colors on screen at once. But doing this usually slows down the game; the processor really isn't up to it.

    Would be nice to have multiple palettes at the same time (gradient) for the water in Sonic games though. Kinda like Ristar how the underwater area gets darker when you swim down.
     
  8. DigitalDuck

    DigitalDuck

    Arriving four years late. Member
    5,351
    438
    63
    Lincs, UK
    TurBoa, S1RL
    The best use of multiple palettes at the same time would be for water in 2-player splitscreen mode.
     
Thread Status:
Not open for further replies.