An Introduction to Mode 7 on the SNES

If you ever owned or played a Super Nintendo then you are familiar with ‘Mode 7’. Developers commonly used it to create the effect of a plane stretching out into the distance, something you will also see on the overworld of every Final Fantasy game on the SNES. People like myself who were young when the SNES hit the market probably remember how Mode 7 was part of the marketing campaign. But just what is it exactly?

Tonight I thought I’d provide a (hopefully) simple explanation for gamers in general, not just programmers.

Note: I will be glossing over some technical details since the target audience for the article includes gamers in general.

Were There Really That Many Modes?

Yes. The Super Nintendo has eight ‘modes’, numbered zero through seven—programmers love to start counting from zero instead of one. Each mode has different properties about what it can display, how many colors it can use, what it can or cannot overlap, and so forth. Load up a game in an emulator like Higan or ZSNES and start turning modes on and off. You will see chunks of the background vanish, or character sprites, or effects like fog; these all belong to different modes. Think of the image you see on screen as a cake and the modes are the individual layers.

What is Special About Mode 7?

To answer that we need to first talk a little about SNES graphics in general. Think of the screen as a grid divided up into squares, all with equal height and width. The SNES represents all graphics as tiles in the grid.

Just exactly what we can do with these tiles depends on the mode. Arguably the two most common modes in SNES games are modes zero and one. They have two important differences:

  1. Mode zero provides four background layers but each background can only use four colors per tile. Programmers sometimes call this ‘NES Mode’ because that is the quality you can squeeze out of it due to the limited number of available colors.

  2. Mode one provides only three background layers. However, tiles in the first two layers can use up to sixteen colors while the third layer uses just four colors. The first two layers do not need to use the same color palette, so both of them can use sixteen different colors. So mode one gives sacrifices one background layer but allows a lot more colors.

These types of distinctions extend throughout all of the eight modes. SNES games switch between modes depending on what they want to accomplish visually, since there is no single mode that does everything, although Mode 7 comes close. While we’re on the subject of modes: transparency is another example of a graphical feature that is possible in some modes but not others.

In other words, the eight modes have different capabilities and game developers switch between them when they want to use features that are special to certain modes. And now we can return to the original question, “What is special about Mode 7?”

Mode 7 allows for two-hundred fifty six colors at once, giving artists more potential with regard to level of detail. But Mode 7 has two features which set it apart from the rest. The first is easy to explain: Mode 7 can rotate sprites (i.e. tiles) quickly. Notice that in F-Zero your ship is always anchored to the bottom center of the screen; the game uses Mode 7 to draw the track and every time you turn a corner you are seeing an example of how quickly Mode 7 can rotate sprites. In that game the track is a big sprite, your ship is at the center, and Mode 7 spins the track image left or right depending based on your controls. It creates the illusion that you are moving around the circuit. Technically speaking, though, the circuit is moving around you.

The second special feature of Mode 7 requires explaining some hardware.

Lasers and Beams

The way the tracks in F-Zero stretch out to the horizon is also a feature of Mode 7. But to understand how it works we have to talk about televisions.

Back when we all bought our televisions from the Slate Rock and Gravel company we had device inside each that would shoot a beam at the screen. Controlling the ‘when’ and ‘how much’ of this laser is fundamentally how televisions rendered images. The direction of laser beam was constant; it would start at the top, move across from left to right lighting up the screen or not, and then it would move down one line and start again from the left. It had the motion of a typewriter.

There are two important moments during all of that laser movement. When it reaches the right side there is a short delay while it moves down and back to the left. This pause is called a horizontal blank. When the beam reached the lower-right and need to reset its aim back at the top that created a pause called a vertical blank. The delays of these ‘blanks’ are incredibly short, so short that their lengths are rarely described with units of time. Instead we say things such as, “a horizontal blank is N pixels long,” where N is how many more pixels the television beam would fire at before re-positioning itself on the left side of the screen.

However, the pauses during those blanks are long enough to accomplish a decent amount of work. Mode 7 creates the appearance of a background scaling into the distance by taking the 2D, top-down version of that background image and converting each pixel to a set of coordinates that generates that 3D-ish effect. (The SNES specifically performs an affine transformation.) This conversion takes place during horizontal blanks. If you think about it, it makes the most sense; in order to create that effect the console needs to know if the current scan-line is near the top or bottom of the television. Since the TV always starts at the top the console can use horizontal blanks to recognize when the laser has moved down by one scan-line, which is what it needs to keep track of to scale the background image so that it appears to be fading into the distance.

Conclusion

So there is a brief look into the Super Nintendo’s oft-marketed Mode 7. I will wrap up this article by answering a question I often see: “Can Mode 7 be used for 3D?”

No, it cannot. The SNES cannot create polygons without help from another chip, which I’ll write about another day. Star Fox fans know what I’m referring to.

Advertisements

3 thoughts on “An Introduction to Mode 7 on the SNES

Add Your Thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s