Color addition transparency between two background layers.
Demonstrates the SNES color math unit by blending two background layers. BG1 (main screen) shows a 4bpp landscape, while BG3 (sub screen) holds 2bpp semi-transparent clouds that scroll horizontally. The PPU adds the sub screen pixel colors to the main screen via registers CGWSEL ($2130) and CGADSUB ($2131), producing a translucent overlay effect.
Mode 1 is used with BG3 priority high so the 2bpp cloud layer renders above BG1. Color addition is applied to BG1 and the backdrop, meaning the cloud colors are numerically added to whatever is underneath.
Based on PVSnesLib Transparency example by Alekmaul.
- SNES Concepts
- Color math: addition mode via CGWSEL/CGADSUB registers
- Main screen vs sub screen layer assignment
- Mode 1 with BG3 priority high for overlay effects
- 4bpp (BG1) and 2bpp (BG3) tile formats in the same mode
- What to Observe
- A landscape background with semi-transparent clouds scrolling over it
- The clouds blend additively, brightening the landscape beneath them
- No input required; clouds scroll automatically
- Modules Used
- console, sprite, dma, background, colormath
- See also
- colormath.h, background.h, video.h
Entry point: color math transparency with scrolling clouds over a landscape.
Sets up Mode 1 with two background layers:
- BG1 (main screen): 4bpp landscape, static
- BG3 (sub screen): 2bpp semi-transparent clouds, scrolling horizontally
The SNES color math unit adds the sub screen pixel colors to the main screen, producing a translucent cloud overlay. BG3 is given priority high so its tiles render above BG1 in Mode 1's layer ordering.
- Returns
- Never returns (infinite loop).
Horizontal scroll offset for the cloud layer (BG3), incremented each frame