Offset-per-tile is a feature of background modes 2, 4, and 6. It allows overriding a layer's horizontal and vertical scroll position on a tile-by-tile basis. This is used by ''Yoshi's Island'' for the dizzy effect and ''Tetris Attack'' to have two different playfields with different vertical positions. This feature can be used to simulate a rotating background for small rotation angles, as seen in ''Star Fox''. See: * [[Uncommon graphics mode games#Vertical Offset-per-tile|Uncommon graphics mode games: Vertical]] * [[Uncommon graphics mode games#Horizontal Offset-per-tile|Uncommon graphics mode games: Horizontal]] == Details on how the feature works == In offset-per-tile modes, BG3's tilemap data is repurposed to hold scroll values (referred to as "offsets" by Nintendo) instead of tile numbers. The PPU will read 2 rows from the tilemap (each containing 32 entries, for 128 bytes total), where the first contains horizontal offsets and the second contain vertical offsets. Mode 4 only reads 1 row, and each entry may be exclusively horizontal or exclusively vertical. * Horizontal entries will replace the BG HOFS value, except for the low 3 bits. The fine scroll of 0-7 pixels is retained, but the upper bits are replaced with the BG3 entry. * Vertical entries will replace the BG VOFS value entirely. Each entry is a 16-bit value:
15  bit  8   7  bit  0
 ---- ----   ---- ----
 V21. ..SS   SSSS Ssss
 |||    ||   |||| ||||
 |||    ++---++++-++++- New scroll value for this tile. For horizontal values, the bottom three bits are ignored
 ||+------------------- Override scroll value for layer 1
 |+-------------------- Override scroll value for layer 2
 +--------------------- Mode 4 only: Scroll direction (0 = horizontal, 1 = vertical)
The leftmost column of tiles is not affected by the offsets. The 0th entry for the offset map applies instead to the second visible column. This allows the first column's offset to be controlled by that layer's normal HOFS/VOFS setting, and the 32 entries affect the remaining 32 tiles that may be visible on that scanline. (Because the left column may be partially scrolled offscreen, up to 33 tiles can be at least partly seen on a scanline.) Each entry affects an entire column of the image, because the screen Y position does not affect which row of BG3 is used. However, BG3VOFS does set the starting row's data position within the "tilemap", so [[HDMA]] or other timing techniques may be used to switch to multiple "sets" of scroll overrides in different parts of the screen. When reading the offset map, the PPU continues to follow most of the same logic it would when reading tile numbers: * BG3 is affected by scrolling with HOFS/VOFS, which have the effect of selecting what section of BG3's tilemap is used for the offset map, as mentioned above. ** The low 3 bits of HOFS and VOFS are ignored, so HOFS can be scrolled to match the other layers it applies to. * BG3's tilemap may be two maps wide and/or tall (per [[PPU_registers#BGnSC|BG3SC]]), though this would not normally have much use. Having it two-wide might allow you to scroll a 64-entry pre-computed offset row in tandem with a two-wide background layer it affects. * BG3 can be set to use 16x16 pixel "tiles" using [[PPU_registers#BGMODE|BGMODE]], and mode 6 will treat the 8x8 setting as 16x8 for both BG1 and BG3. * When the PPU reads the vertical offset row, it acts as if 8 was added to VOFS. This means that 16x16 pixel tiles on BG3 will cause the PPU to read the same values for the horizontal and vertical offsets when an even row is selected. If adding 8 to VOFS would put the vertical offsets on a different map (with BG3's tilemap set to be two maps tall) then the PPU will actually access that other map instead of wrapping within the current one. [[Category:Graphics]]