Shadow/highlight

Shadow/highlight (shortened to S/H) is, to put it roughly, a feature that lets you do 50% white and 50% black translucency to some limited extent. It's a pretty powerful feature, but it can be a bit hard to figure out how to make good use of it which has resulted in this feature going underused.

So here's an explanation of both how it works and some tips on how to make good use of it so you don't have to waste time figuring it out yourself.

Enabling S/H

Shadow/highlight is enabled by the same register that controls the screen resolution, so go check how to change screen resolution. Once enabled it'll "just work".

Simple example (change resolution as needed):

    ; The "_SH" part is the important one here
    SetGfxMode GFXMODE_320x224_SH

How it works

Shadow/highlight works per pixel. There are two things that affect the color of the pixel: first is whether a sprite is displayed, some colors have special meaning.

Then all layers are put together (sprites, plane A, plane B) and their priority flag is used to check if pixel becomes darker or not (note: this includes transparent pixels in plane A and B, but not transparent pixels in sprites)

Iwis says

If both rules above end up being "pixel is darker" (i.e. sprite palette 3 color 15 on top of everything being low priority), then the pixels is still just 50% darker, not made even darker.

On top of that: brighter + darker gives a normal pixel, not some ugly muddled color (in other words: highlight from sprite undoes shadow from layers).

S/H ideas

The fact that layer priority influences the outcome of S/H tends to make it hard to figure out a way to easily exploit the feature. The following setup would make for a good starting point, with the idea being that you build your effects on top of this:

Now for some ideas on what kind of effects you could use it for: