Shadow and highlight is a rendering feature on the SEGA Mega Drive's VDP. It originates from the arcade hardware the system was built off of.
S/H (As it will be called from here on out for simplicity) allows for a very limited form of translucency, offering 50% black and 50% white.
This very simplified guide will list all the quirks of S/H and how to use it!
To start, we need to understand the Mega Drive's resolutions. Most people know that the MD has a resolution of 320x224, seen here
However, there are other resolutions too! There's 320x448, which is used in games like Sonic 2 for the splitscreen multiplayer. However, that resolution does get halved back into 320x224.
Lastly, the strangest of them all, 256x224. Again, with the Sonic 2 example, this resolution is used in the Special Stages to save on tiles with the halfpipe.
So what does this have to do with S/H, you might be asking? Well, it's because S/H is technically, a resolution. Each of the resolutions mentioned above have S/H versions. By setting bit 4 in the resolution, S/H will be enabled. For this guide we'll be using 320x224 and it's S/H mode since that's the most standard.
Now to set the resolution we need to do some VDP magik.
Now you can use these two lines of code where ever you need them! Let's test it on Sonic 1.
Normally, this is what the game looks like. It uses 320x224 with no S/H.
Let's see what were to happen if we enabled S/H. We'll put the code to enable it under the 'Level:' routine.
Build, and...
Success!
Now you may have a few questions about what's going on. Why is everything darkened? We only enabled S/H. Why are some palmtrees normal?
Well, this is the part where we need to go in depth about S/H, and it's unfortunate limitations.
The MD has 3 windows for graphics. Plane B, A, and sprites. Plane B and A use what's known as tilemaps, and are usually used to construct levels and backgrounds in games.
In S/H, with plane A, any tiles that are low priority (They go behind sprites) will be completely shadowed. While tiles that are high priority (And go on top of sprites) will render normally.
Plane B also plays a part in S/H. While unaffected if the tiles are low priority, if tiles are high priority, they can make shadowed plane A tiles render normally. This can be seen in S/H Sonic 1's Marble Zone.
So how does one solve this? Sadly, there isn't much that can be done, really all you can do is set all plane A tiles to high priority, but that could be problematic as it may get in the way of sprites.
I did this as much as I could in Sonic the Ghosthog without being obstructive to the player.
Some information here may not necessarily be correct, by the way. Most of the information I'm giving is largely based on experimentation with Sonic 1.
While tilemaps are shaded by the whole tile, sprites can use S/H pixel by pixel. But again, there are limitations.
1. Sprites must be low priority to use S/H, like tilemaps. And if you want a sprite to be effected by S/H that also needs to be low priority.
2. Sprites must be using palette line 4 to use S/H
3. Colors 14 and 15 are used for highlight and shadow, respectively. This means that S/H sprites are monochromatic and can only be black and white.
Now that you understand the fundamentals of S/H you should be able to use it for yourself in your own homebrew and ROM hacks.
But, before that, there's a really odd bug that should be mentioned.
On palette lines 1, 2, and 3, color 14 on sprites (Not tilemaps) is not effected by S/H. You miight have noticed it if you've ever used night mode in S/H and one of Tails' oranges were rendered as normal.
You can even see it the Sonic 1 S/H demo we just made, on Green Hill's collapsing cliffs.
The darkest red of Sonic's shoes and some enemies are effected as well, and so are the rings. But they're harder to notice because they just match the next shade of red and yellow in the palettes.
Enjoy playing with the shadow and highlight mode!~