VDP Documentation/Shadow and highlight
From Sonic Retro
|SCHG: VDP Documentation|
This article is a work in progress.
One of the capabilities of the VDP is shadowing and highlighting (often shortened as S/H, from hereafter named that way). In this mode, each pixel can have either one of three states, depending on a specific set of rules: normal, shadowed or highlighted. The set of rules defining this is simple, however it isn't explained well in the official documentation.
In order to enable S/H, you need to set bit S/TE in mode register #3. This is bit 3 from VDP register $0C, also used to set the horizontal resolution and interlaced mode.
move.w #$8C08, ($C00004) ; Enable S/H (H40 and interlace ignored)
The rules that define the status are shown in the list below. The pixel status depends on the combination of whatever is to be shown by the tilemaps there and also the sprites covering that pixel.
- If any of the tilemaps has high priority, the default state is normal, otherwise it's shadowed.
- If there's a sprite with palette 3, pixels of index 14 will be transparent and highlight (shadow + highlight = normal).
- If there's a sprite with palette 3, pixels of index 15 will be transparent and shadow (shadow + shadow = shadow).
Indices 14 and 15 of palette 3 only have special meaning on sprites. In any other case, colors are shown normally (with the S/H effect, of course). Priority rules still apply, so if a low priority sprite would get obscured by a high priority sprite, it won't be able to affect the light status. Also it's possible for the special S/H colors in a sprite to hide a sprite below it, despite the fact they aren't opaque.