How to use the SNES mosaic register to create a pixelation effect, and how to combine it with brightness fading for screen transitions. Press any button to cycle through 4 transition steps: fade out, fade in, mosaic out, mosaic in.
Read effects/fading first (brightness control basics).
| Button | Action |
|---|---|
| Any button | Advance to next transition step |
The cycle repeats: fade out -> fade in -> mosaic out -> mosaic in -> (loop)
Then open mosaic.sfc in your emulator (Mesen2 recommended).
setBrightness() writes to register $2100 (INIDISP). Values 0-15 control the master brightness – 15 is full, 0 is black. Two VBlank waits per step gives a smooth ~0.5 second transition.
The library functions mosaicEnable() and mosaicFadeOut() write to register $2106 (MOSAIC). The parameter 3 controls the speed of the transition.
Register $2106 layout:
Increasing the block size from 0 to 15 makes pixels progressively larger until the image is a grid of colored squares.
Classic SNES transition pattern used in many RPGs:
This gives a polished "dissolve" effect.
The SNES PPU provides per-background pixelation with 16 levels. The effect is applied entirely in hardware – zero CPU cost. Each BG layer can be independently mosaic'd by setting its corresponding bit in the low nibble.
Mosaic replaces pixels with the top-left pixel of each NxN block. It is a decimation effect, not a filter. The result looks like a low-resolution version of the original image.
Mosaic only applies to background layers. Sprites always render at full resolution. Some games use this creatively – mosaic the BG while sprites remain sharp during a transition, making characters stand out against the dissolving background.
| File | Purpose |
|---|---|
main.c | Fade/mosaic transition logic, button-driven state machine |
data.asm | Background tiles, tilemap, and palette data |
res/opensnes.png | Source background image |
Makefile | LIB_MODULES := console dma background sprite input mosaic |
effects/fading – Brightness fading in detaileffects/hdma_wave – More advanced PPU effects with HDMA