Backgrounds: Difference between revisions

From SNESdev Wiki
Jump to navigationJump to search
(properties, modes 1-4...)
(fold OPT into the BG list since its data appears there)
Line 6: Line 6:


{| class="wikitable"
{| class="wikitable"
! Mode !! BG1 !! BG2 !! BG3 !! BG4 !! [[#Offset-per-tile|OPT]] !! [[#High resolution|Hi-res]]
! Mode !! BG1 !! BG2 !! BG3 !! BG4 !! [[#High resolution|Hi-res]]
|-
|-
! [[#Mode 0|0]]
! [[#Mode 0|0]]
| 2 || 2 || 2 || 2 ||  ||
| 2 || 2 || 2 || 2 ||
|-
|-
! [[#Mode 1|1]]
! [[#Mode 1|1]]
| 4 || 4 || 2 ||  ||  ||
| 4 || 4 || 2 ||  ||
|-
|-
! [[#Mode 2|2]]
! [[#Mode 2|2]]
| 4 || 4 ||   ||  || ✔ ||
| 4 || 4 ||[[#Offset-per-tile|OPT]]||  ||
|-
|-
! [[#Mode 3|3]]
! [[#Mode 3|3]]
| 8 || 4 ||  ||  ||  ||
| 8 || 4 ||  ||  ||
|-
|-
! [[#Mode 4|4]]
! [[#Mode 4|4]]
| 8 || 2 ||   ||  || ✔ ||
| 8 || 2 ||OPT||  ||
|-
|-
! [[#Mode 5|5]]
! [[#Mode 5|5]]
| 4 || 2 ||  ||  ||  || ✔
| 4 || 2 ||  ||  || ✔
|-
|-
! [[#Mode 6|6]]
! [[#Mode 6|6]]
| 4 ||  ||   ||  || ✔ || ✔
| 4 ||  ||OPT||  || ✔
|-
|-
! [[#Mode 7|7]]
! [[#Mode 7|7]]
| 8 ||(7)||  ||  ||  ||
| 8 ||(7)||  ||  ||
|}
|}



Revision as of 18:42, 31 May 2022

The SNES backgrounds consist of one or more layers of tilemaps.

There are 8 available background modes, which can be changed at any time via BGMODE.

Each mode has 1-4 layers, consisting of tiles that are 2bpp (4-color), 4bpp (16-color), or 8bpp (256-color).

Mode BG1 BG2 BG3 BG4 Hi-res
0 2 2 2 2
1 4 4 2
2 4 4 OPT
3 8 4
4 8 2 OPT
5 4 2
6 4 OPT
7 8 (7)

Properties

Each of the 4 BG layers has several independent properties:

Each of the 4 BG layers can be independently activated for the main and sub-screen.

  • If color math is enabled, the main screen can be blended with the subscreen.
  • If high resolution is enabled (SETINI) the main-screen appears on even columns, and the sub-screen appears on odd columns.
  • If neither color math nor high resolution is enabled, only the main screen is seen.

The 4 BG layers and sprites (OBJ) are composited to make the main and sub-screens, layered according to their priority

Offset-per-tile

See: Offset-per-tile

High resolution

The high resolution bit in SETINI

modes 5 and 6

Mode 0

The only mode which has 4 independent BG layers. Its drawback is that each layer is only 2bpp (4 color).

Each of the 4 layers and choose one of 8 4-color palettes from a different subset of CGRAM:

  • BG0 at CGRAM 0
  • BG1 at CGRAM 16
  • BG2 at CGRAM 32
  • BG3 at CGRAM 48

Mode 1

The most commonly used mode, which has two main 4bpp (16 color) layers BG1 and BG2, and one auxiliar 2bpp (4 color) layer BG3.

BG3 has an additional priority control in mode 1. Its priority bit in BGMODE allows it to be rendered either above or below BG1 and BG2.

In many games, BG1 and BG2 are used for a colourful main background with parallax, and BG3 to overlay a HUD or text box.

BG3 can also be useful for things like a blended cloud or fog in the foreground, or a third parallax layer in the deep background. (Super Metroid has many good examples.)

Mode 2

Has two 4bpp layers like mode 1, but BG3 is used to encode offset-per-tile for BG1 and BG2, instead of being a visible layer.

Mode 3 & 4

Mode 3 has an 8bpp BG1 layer, allowing 256 color graphics. This can also be used as direct color, bypassing the CGRAM palettes.

Mode 3 also has a 4bpp (16 color) auxiliary layer BG2.

Mode 4 instead has a 2bpp (2 color) auxiliary layer BG2, and BG3 is used to encode offset-per-tile.

Mode 5 & 6

TODO

Mode 7

TODO