Actions

SCHG

Difference between revisions of "VDP Documentation/Shadow and highlight"

From Sonic Retro

m (Small things)
(Huh, $04 is NOT bit 3 being set...)
Line 7: Line 7:
 
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.
 
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.
  
<asm>    move.w  #$8C04, ($C00004)    ; Enable S/H (H40 and interlace ignored)</asm>
+
<asm>    move.w  #$8C08, ($C00004)    ; Enable S/H (H40 and interlace ignored)</asm>
  
 
==Status rules==
 
==Status rules==

Revision as of 05:26, 13 June 2009

Template:SCHG VDP 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.

Enabling S/H

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.

<asm> move.w #$8C08, ($C00004)  ; Enable S/H (H40 and interlace ignored)</asm>

Status rules

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.

  1. If any of the tilemaps has high priority, the default state is normal, otherwise it's shadowed.
  2. If there's a sprite with palette 3, pixels of index 14 will be transparent and highlight (shadow + highlight = normal).
  3. 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.

Sonic Community Hacking Guide
General
SonED2 Manual | Subroutine Equivalency List
Game-Specific
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic CD (2011) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (Master System) | Sonic 3 | Sonic 3 & Knuckles | Chaotix | Sonic Jam | Sonic Jam 6 | Sonic Adventure | Sonic Adventure DX: Director's Cut | Sonic Adventure DX: PC | Sonic Adventure (2010) | Sonic Adventure 2 | Sonic Adventure 2: Battle | Sonic Adventure 2 (PC) | Sonic Heroes | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Colours | Sonic Generations | Sonic Forces
Technical information
Sonic Eraser | Sonic 2 (Nick Arcade prototype) | Sonic CD (prototype; 1992-12-04) | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Tails Adventures | Sonic Crackers | Sonic 3D: Flickies' Island | Sonic & Knuckles Collection | Sonic R | Sonic Shuffle | Sonic Advance | Sonic Advance 3 | Sonic Battle | Shadow the Hedgehog | Sonic Rush | Sonic Classic Collection | Sonic Free Riders | Sonic Lost World
Legacy Guides
The Nemesis Hacking Guides The Esrael Hacking Guides
ROM: Sonic 1 | Sonic 2 | Sonic 2 Beta | Sonic 3

Savestate: Sonic 1 | Sonic 2 Beta/Final | Sonic 3

Sonic 1 (English / Portuguese) | Sonic 2 Beta (English / Portuguese) | Sonic 2 and Knuckles (English / Portuguese)
Move to Sega Retro
Number Systems (or scrap) | Assembly Hacking Guide | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | SMPS Music Hacking Guide | Mega Drive technical information