5
\$\begingroup\$

(This is assuming all graphics are stored in 4 bpp)

I understand that the SNES has a 256 color palette split into 16 palettes (each with 16 colors), and 8 of these represent palettes usable by sprites. Each sprite has a number representing which of these 8 palettes it uses. My question is how and when are the colors of these 8 palettes set typically.

Does the SNES copy the palette of a sprite into one of these 8 palettes when it is rendered? If so that would mean that only 8 sprites could be rendered simultaneously, and two sprites using the same colors would not share the palette which would be a waste of memory.

\$\endgroup\$
14
\$\begingroup\$

You're thinking of paletting from a modern perspective. That is, you're thinking of palettes as a part of the image, with each image owning its own palette.

In SNES-style hardware, palettes are global. You don't design your palette for your images, you design your images for your palettes. Well, it's a complex interplay between the two, but the needs of the palette primarily inform the art design of an image.

You don't get to change palettes in the middle of rendering a frame on the SNES. You set the palette at the beginning of the frame and then render everything in the frame with it. If you have a bunch of different sprites, then they need to be designed to share a lot of colors.

No SNES game developer would be so wasteful as to assign each sprite its own individual 8-color palette index (except maybe for the main character). Multiple sprites will use the same palette index. You have different palette indices for variety of sprites, but a lot of sprites are going to have to share. Which means that a palette has to serve the needs of multiple sprites.


The palette gets set by... the game setting the palette. This ain't rocket science.

At some point in time, the artists got together and came up with the available color palette. They probably went through several iterations of palettes, so that they could get the most out of the limited color palette space. They probably got together with the game designers so that they could have sprites that conflict in their palette, simply by forcing the developers not to put conflicting sprites in the same level.

Once all that was nailed down, they just did their work, making each sprite work with the palette colors they worked out Again, this probably involved many iterations.

The tools they used to create those images were not programs like Photoshop. Look around the Super Mario World rom-hacking scene for examples of the kinds of art tools they would use to generate sprites. Those tools are given a palette to work with, and you build your image only from those colors.

The source of the palette was not imaging software; it was designed explicitly by the developers.

For the SNES, image data and palette data live in different places. Images tend to live in large blocks of data in the ROM. Palettes tend to be hard-coded or otherwise live in tables in entirely different places in the ROM. The link between the two is merely a well-educated coincidence.

Take Super Mario World, for example. A sprite is a game construct that is attached to a level. But the images those sprites use depend on certain colors being in certain palette indices. How does that happen? Exactly and only because that level just so happens to put those colors there. That is, each level has a setting for which palettes to use (a palette of palettes). And if the level loads the right palette for the sprites that level uses, then everything appears fine.

This is one way such linkage happens. But individual games can do things a different way. Indeed, even in SMW, there are some palette entries that simply don't change from level to level, and many sprites use colors from them. So many sprites will be unaffected by level-specific palettes.

That's (part of) why you'll notice that many enemies show up in lots of levels, while others only show up in a few.

In any case, the point is that images and their palettes live in different places, and they get to the system in different ways. Games are carefully coded, in terms of level design or whatever, to use sprites when the right palette is available.

\$\endgroup\$
7
  • \$\begingroup\$ Interesting. So in that case is the global palette typically set when a level is loaded, or does the entire game use one palette? \$\endgroup\$ Dec 25 '15 at 18:58
  • 2
    \$\begingroup\$ @user3124047: Palettes are often animated. But they change between frames, not within frames. \$\endgroup\$ Dec 25 '15 at 19:19
  • 3
    \$\begingroup\$ Technically, it is possible to change the palette mid-frame, and apparently some NES games did that. (Other systems of the same era generally allowed it too, if only because they didn't do anything to specifically prevent writing into the palette registers while the frame was being drawn. It was a particularly popular effect on the Amiga, because the display chipset had a special scanline-synced coprocessor for just such tricks.) \$\endgroup\$ Dec 25 '15 at 23:01
  • 1
    \$\begingroup\$ @IlmariKaronen SNES, too, has a similar feature, called HDMA. \$\endgroup\$
    – nitro2k01
    Dec 26 '15 at 0:28
  • 2
    \$\begingroup\$ Do not ask questions on the comments, make a new question for that \$\endgroup\$
    – rlam12
    Dec 26 '15 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.