Skip to content

Commit 06f44cd

Browse files
committed
epu docs
1 parent fe32c31 commit 06f44cd

3 files changed

Lines changed: 57 additions & 0 deletions

File tree

docs/book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
# Guides
2424

2525
- [Render Modes](./guides/render-modes.md)
26+
- [EPU Environments](./guides/epu-environments.md)
2627
- [Rollback Safety](./guides/rollback-safety.md)
2728
- [Asset Pipeline](./guides/asset-pipeline.md)
2829
- [Publishing Your Game](./guides/publishing.md)

docs/book/src/api/epu.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Multi-Environment v4 provides:
1111
- **Blend modes**`env_blend(0..3)` controls how overlay composites onto base
1212
- **Loopable animation** — Most modes take a `phase` that wraps cleanly (0–65535)
1313

14+
For mode selection and example recipes, see [EPU Environments](../guides/epu-environments.md).
15+
1416
All environments are rendered by calling `draw_env()` in your `render()` function.
1517

1618
## Quick Use
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# EPU Environments
2+
3+
The Environment Processing Unit (EPU) is ZX’s procedural background + ambient environment system.
4+
5+
- It renders an infinite environment when you call `draw_env()`.
6+
- The same environment is sampled by lit shaders for ambient/reflection lighting.
7+
8+
For exact function signatures, packed layouts, and parameter docs, see the [Environment (EPU) API](../api/epu.md).
9+
10+
---
11+
12+
## Quick Start
13+
14+
1. Configure the **base layer** (layer `0`) with an `env_*` function.
15+
2. Optionally configure the **overlay layer** (layer `1`).
16+
3. Set how the overlay composites with `env_blend()`.
17+
4. Call `draw_env()` in your `render()` function.
18+
19+
Tips:
20+
- Start from the inspector presets, then tweak `density/intensity/colors`.
21+
- Animate with `phase` (wraps as u16) using `wrapping_add()` in your game code.
22+
23+
---
24+
25+
## Mode Overview
26+
27+
| Mode | Name | Best for | Common role |
28+
|---:|---|---|---|
29+
| 0 | Gradient | Sky/ground anchor + featured sun | Base |
30+
| 1 | Cells | Particles (stars/snow/rain) and emissive tiles/lights | Overlay (sometimes base) |
31+
| 2 | Lines | Floors/ceilings, scanlines, speed streaks | Overlay |
32+
| 3 | Silhouette | Mountains/city/forest/waves on the horizon | Base |
33+
| 4 | Nebula | Fog/clouds/aurora/ink/plasma/abstract space | Base or overlay |
34+
| 5 | Room | Indoor “box” environments | Base |
35+
| 6 | Veil | Drapes/pillars/shards/atmosphere | Overlay |
36+
| 7 | Rings | Portals/tunnels/radar focal effects | Overlay (sometimes base) |
37+
38+
---
39+
40+
## Common Recipes
41+
42+
- Outdoor day/night: Gradient base + (optional) Cells or Nebula overlay
43+
- Neon city: Silhouette (City skyline) base + Cells (Tiles/Lights) overlay (Screen/Add)
44+
- Space: Nebula base + Cells (stars) overlay + Rings overlay
45+
- Indoor sci-fi: Room base + Lines overlay + (optional) Veil overlay
46+
47+
---
48+
49+
## Troubleshooting
50+
51+
- Shimmer in reflections: reduce `motion`/high-frequency detail and keep `phase` smooth.
52+
- Too noisy: reduce `density`, `intensity`, or `contrast`-style controls.
53+
- Overlay looks wrong: try a different `env_blend()` mode (Alpha/Add/Multiply/Screen).
54+
- Aliasing: increase thickness/softness-style controls or reduce detail/warp.

0 commit comments

Comments
 (0)