Palette colors can be changed in CRAM while the VDP is in the middle of rendering a frame and then changed back at the end of the frame, a process known as mid-frame palette swapping. This raster effect results in one vertical section of the screen being drawn with one set of palettes, while another section is drawn with another set of palettes. The process can be repeated more than once per frame. This technique can be used to surpass the color limitations of the VDP, although it comes with tradeoffs.
One of the tradeoffs to mid-frame palette swapping is that artifacts will often appear on the screen. These artifacts are known as CRAM dots. Any time a color is written to CRAM while the screen is being actively rendered, that color will appear on the screen in a single pixel rather than the intended color. The more colors written to CRAM at a time, the more CRAM dots will appear. Developers often obscured these dots using sprites, as we will see in some examples below. However, sometimes CRAM dots were left as-is.
Let’s look at an example of mid-frame palette swapping from Burning Force:
If we map out the color palettes for each horizontal line of the display, we get this:
The leftmost 16 columns represent the first palette. This palette is changed three times in a single frame, at the vertical positions where the colors change in the diagram. The second palette is changed twice.
Now, re-watch the above video clip and try to identify where the palettes are changed by mentally aligning the diagram with the video. The first point is just below the cockpit display at the top of the screen (just above the sky). The second point is the horizon—where the sky meets the water. The third point is just above the bottom cockpit display (just below the water). At each of these points, there are noticeable CRAM dots. This is most obvious on the scanlines where two palettes are changed at once, near the cockpit displays. Note that most emulators do not show these dots—the above video was taken from the emulator BlastEm. In the case of Burning Force, the developers did not attempt to hide the CRAM dots. The dots are not so noticeable at the horizon since there is so much animation already and the color of the CRAM dots matches the water, but they are quite jarring near the cockpit display.
If you’re curious how the scrolling water effect works in Burning Force: it’s just palette animation, done by shifting palette colors each frame on a static background plane. It’s the same method used to animate the water in the background of the first stage of Sonic the Hedgehog, but done here at 60 fps with more colors. The tiles themselves are not changing–just the color palette they reference.
An interesting effect that can be done using palette swapping is to create water that covers only the bottom of the screen; anything underwater uses a different palette, typically with a green or blue hue. This creates the illusion of partial transparency.
Gaiares features a very impressive scene with rising water, shown here:
The palette swap occurs at the water line, and it gradually shifts up the screen each frame to give the appearance that the water is rising. Notice the flashing wave sprites that obscure the top of the water—these are used to hide the CRAM dots. An additional nice point to this scene is the line scrolling that occurs underwater (scrolling along a sine wave pattern) to really give the impression of water.
Another well-known example of the water effect is from Sonic the Hedgehog:
The effect here is similar to the one in Gaiares—there is a layer of flashing wave sprites obscuring the CRAM dots. Sonic the Hedgehog in fact came out six months after Gaiares, so Gaiares may have served as inspiration for how the effect was realized in Sonic. Interestingly, the Japanese version of Sonic, which came out a month after the North American version, featured an addition to this stage: a line scrolling sine wave ripple effect underwater.
The water effect can also be found in Castlevania: Bloodlines:
In these three examples, the background plane and sprite tiles themselves are not changing above and below the water. The only things changing are the color palettes.
List of Effects:
- Full-Screen Scrolling
- Row / Column Scrolling
- Line Scrolling
- Multi-Jointed Characters
- Tilting / Rotation
- Shadow and Highlight
- Palette Swapping
- Vertical Scaling
- Sprite Raster Effects
Want to post a comment? You can do so here.