pixelkiln 0.139.1 → 0.139.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/PARALLAX.md CHANGED
@@ -4,7 +4,7 @@ A parallax background is a stack of layers that scroll at different speeds as
4
4
  the camera moves. PixelKiln has no parallax command yet, so this guide builds
5
5
  one from ordinary manifest assets and a free script. Everything below was run
6
6
  to make the pictures on this page: two biomes, 51 PixelLab generations in all,
7
- including the retries. The evidence behind each choice is in the
7
+ including the retries, and a climb for a camera that scrolls up. The evidence behind each choice is in the
8
8
  [research note](./RESEARCH_PARALLAX.md).
9
9
 
10
10
  ![Volcanic dusk, built from separate silhouettes](../website/public/research/parallax/refined/volcanic/silhouettes.webp)
@@ -248,11 +248,97 @@ LDtk counts the other way: its factor is how much the layer follows the
248
248
  camera, so write 1 − speed. With `parallaxScaling` on it also shrinks a far
249
249
  layer off the pixel grid. PixelKiln's LDtk export writes factor 0 today.
250
250
 
251
+ ## 8. Scroll vertically
252
+
253
+ A camera that climbs needs more than the sideways stack. The climb below uses
254
+ the alpine palette, 14 PixelLab generations and one Retro Diffusion picture for
255
+ the loop further down.
256
+
257
+ ![A climb: a wall stacked from a generated cliff, a massif drawn once, clouds at two speeds, and a sky that moves](../website/public/research/parallax/vertical/climb.webp)
258
+
259
+ - **Draw layers tall, or place things at height.** The 400×100 strips above are
260
+ made for one height. Climbing past them, the near layer drops out early and
261
+ the far range's extension fills half the view. Give the camera something to
262
+ pass at every height: a tall landmark, clouds scattered up the climb, a wall.
263
+ - **Give every layer headroom.** A layer has to be drawn the view's height plus
264
+ climb × its vertical speed above it. For a 480 px climb that is 48 rows at
265
+ 1/10 and all 480 at full speed.
266
+ - **Place the layers for the lowest view.** Then a climb only moves them down
267
+ the screen and never uncovers their feet.
268
+ - **Move the sky.** A sky at speed 0 looks the same at every height. At 0.3 of
269
+ the climb its bands walk from dusk at the horizon to night at the top.
270
+ - **Generate clouds as puffy sprites.** "a single puffy cumulus cloud, pink-lit
271
+ top and blue-violet shaded underside, simple shading, about two thirds as
272
+ wide as the picture, a lone cloud game sprite on a plain empty background,
273
+ nothing else in the picture: no sky, no sun, no moon, no mountains" came back
274
+ usable on three seeds of three. Thin streaks and flat banks did not, on four
275
+ tries.
276
+ - **Build the wall from a pillar.** Asked for a cliff wall, pixflux draws a
277
+ pillar with a summit. `wall` keeps the summit and repeats the body below it
278
+ at the rows where it loops best. Pick the candidate whose ledges are far
279
+ apart, so the repeat is hard to spot.
280
+
281
+ ```bash
282
+ # Stack a cliff into a wall 700 rows tall, keeping its top 100 rows as the summit.
283
+ $P wall cliff.png wall.png 700 100
284
+
285
+ # Vertical preview: the camera climbs and comes back.
286
+ STILL=strip.png SCALE=2 $P climb climb.webp climb.json
287
+ ```
288
+
289
+ A climb spec is the side-scrolling one with `climb` in place of `travel`,
290
+ `speed_y` on any layer whose vertical speed differs, and two more layer kinds:
291
+
292
+ ```jsonc
293
+ {
294
+ "view": [240, 256],
295
+ "sky": ["#040920", "#142b60", "#405e9c", "#a596b9", "#de889c", "#f9b59c"],
296
+ "sky_speed": 0,
297
+ "sky_speed_y": 0.3,
298
+ "stars": 80,
299
+ "climb": 480,
300
+ "layers": [
301
+ { "image": "far.png", "bottom": 200, "speed": 0.1, "extend": true },
302
+ { "image": "massif.png", "repeat": false, "x": 60, "bottom": 262, "speed": 0.2, "extend": true },
303
+ { "scatter": ["puff-a.far.png", "puff-b.far.png"], "top": -520, "bottom": 60, "count": 7, "speed": 0.4 },
304
+ { "image": "wall.png", "repeat": false, "x": -8, "bottom": 300, "speed": 1 },
305
+ { "scatter": ["puff-a.png", "puff-b.png"], "top": -720, "bottom": -120, "count": 5, "speed": 1.3 }
306
+ ]
307
+ }
308
+ ```
309
+
310
+ Rows count from the top of the view at the start of the climb, so negative
311
+ rows are above it. `scatter` places one sprite per height band between `top`
312
+ and `bottom`. An image with `"repeat_y": true` repeats upward instead of
313
+ sideways.
314
+
315
+ For a background that scrolls up forever, such as a vertical shooter's,
316
+ generate it with Retro Diffusion's `tileY` on `rd_plus__default` and no
317
+ background removal. It wraps vertically; pixflux has no seamless option. Keep
318
+ the rest of the set on that picture's colours: snapped to a palette with few of
319
+ its colours, the sky below kept 5 of its 47.
320
+
321
+ ![A vertical shooter's loop: a tile_y sky at half speed, clouds at full speed](../website/public/research/parallax/vertical/loop.webp)
322
+
323
+ The same layer at a quarter of the camera's speed both ways:
324
+
325
+ | Tool | Setting |
326
+ |---|---|
327
+ | Tiled | `parallaxx: 0.25`, `parallaxy: 0.25`; `repeaty` on an image layer that loops |
328
+ | Godot 4 | `Parallax2D.scroll_scale = Vector2(0.25, 0.25)`; `repeat_size.y` for a loop |
329
+ | Phaser 3 | `setScrollFactor(0.25, 0.25)` |
330
+ | LDtk | `parallaxFactorX: 0.75`, `parallaxFactorY: 0.75` with `parallaxScaling: false` |
331
+
332
+ The specs, manifests and build script are in
333
+ [`benchmarks/parallax-vertical`](../benchmarks/parallax-vertical), and step 19
334
+ of the [research note](./RESEARCH_PARALLAX.md) has the numbers.
335
+
251
336
  ## What this guide does not cover
252
337
 
253
338
  - Splitting a finished scene into layers. A depth model and inpainting can do
254
339
  it, at 10 to 25 PixelLab generations a layer for the fill; see steps 4, 13
255
340
  and 14 of the [research note](./RESEARCH_PARALLAX.md).
256
- - Retro Diffusion. Its environment style draws a whole scene whatever the
257
- prompt says, so it is not a layer generator (step 15).
341
+ - Retro Diffusion for sideways layers. Its environment style draws a whole
342
+ scene whatever the prompt says, so it is not a layer generator (step 15). It
343
+ appears above only for a vertical loop.
258
344
  - A `pixelkiln parallax` command. The research note sketches one.
package/docs/README.md CHANGED
@@ -29,7 +29,7 @@ provider you are using. These Markdown files also render at
29
29
  | [Environment provider benchmark](./PROVIDER_BENCHMARK.md) | Compare PixelLab, Retro Diffusion, and ComfyUI on buildings, backgrounds, cleanup, and native-grid recovery. |
30
30
  | [3D characters from sprites](./CHARACTERS_3D.md) | An experimental pipeline from directional sprites to a rigged, animated 3D character with separate items: a pixel path and a painted path, the steps, and what each costs. Scripts, not a command. |
31
31
  | [Research: 3D models from sprites](./RESEARCH_3D.md) | Every attempt to turn eight directional sprites into a 3D model, with pictures. Research, not a feature. |
32
- | [Parallax backgrounds](./PARALLAX.md) | Build a scrolling background in layers from one palette: silhouettes or whole layers from PixelLab, the prompts that work, finishing by script, a preview, and engine settings. |
32
+ | [Parallax backgrounds](./PARALLAX.md) | Build a scrolling background in layers from one palette, sideways or climbing: silhouettes or whole layers from PixelLab, the prompts that work, finishing by script, a preview, and engine settings. |
33
33
  | [Research: parallax backgrounds](./RESEARCH_PARALLAX.md) | The evidence behind the parallax guide: every way tried to build a background in depth and to get its layers out of a generator. Research, not a feature. |
34
34
  | [Controlled asset revisions](./REVISIONS.md) | Image-to-image and inpaint edits, PixelLab palette cleanup, animation, skeleton posing, and interpolation from a parent asset; masks, approval gates, side-by-side review, and ComfyUI bindings. |
35
35
  | [Derived artifacts](./ARTIFACTS.md) | Refine, pack, mount, and export; provenance, approval gates, ownership, and crash recovery. |
@@ -1,69 +1,72 @@
1
1
  # Parallax backgrounds
2
2
 
3
- This is a research note, not a feature: nothing here is a PixelKiln command, and the scripts are rough. PixelKiln can generate a scenic background as one flat picture. A parallax background is several layers that scroll at different speeds as the camera moves. This note covers the ways to build one and the ways to get the layers out of AI generators. Steps 1 to 11 use art we already had. Step 12 records how a game that already uses PixelKiln builds its skyline. Steps 13 to 16 spent 17 PixelLab generations and $0.24 of Retro Diffusion. Step 17 ran a layer-splitting model on our own 12 GB GPU. Step 18 spent 51 PixelLab generations refining the two routes that worked into the sets below.
3
+ This is a research note, not a feature. Nothing here is a PixelKiln command, and the scripts are rough.
4
4
 
5
- To build one, follow the [parallax guide](./PARALLAX.md). This note is the evidence behind it. Pictures are kept only where they show a result worth using or the one fault a step found; the rest is in the text and the scripts.
5
+ PixelKiln can generate a scenic background as one flat picture. A parallax background is several layers that scroll at different speeds as the camera moves. This note tries the ways to build one and the ways to get the layers out of AI generators. Steps 1 to 11 use art we already had. Step 12 records how a game that already uses PixelKiln builds its skyline. Steps 13 to 16 spent 17 PixelLab generations and $0.24 of Retro Diffusion. Step 17 ran a layer-splitting model on our own 12 GB GPU. Step 18 spent 51 PixelLab generations turning the two routes that worked into the sets below. Step 19 turns the camera upward, with 14 PixelLab generations and $0.12 of Retro Diffusion.
6
+
7
+ The short version is that generators are good at one isolated shape and bad at agreeing across several pictures, so ask them for shapes and do the agreeing yourself. Steps 12 and 18 show how. To build a background, follow the [parallax guide](./PARALLAX.md). This note is the evidence behind it. A picture stays in this note only if it shows a result worth using or the one fault a step found. The rest is in the text and the scripts.
6
8
 
7
9
  ![Volcanic dusk from separate silhouettes (step 18)](../website/public/research/parallax/refined/volcanic/silhouettes.webp)
8
10
 
9
11
  ![Alpine dusk from whole layers (step 18)](../website/public/research/parallax/refined/alpine/layers.webp)
10
12
 
11
- Last updated 23 November 2026.
13
+ Last updated 24 November 2026.
12
14
 
13
15
  ## Summary
14
16
 
15
17
  | # | Approach | Tool or model | Result | Verdict |
16
18
  |---|---|---|---|---|
17
- | 1 | Check whether our backgrounds wrap horizontally | Our script | 9 of 10 benchmark backgrounds show a seam 1.3 to 5.6 times the normal column-to-column step | None of them loops as generated. |
18
- | 2 | Make a flat picture loop with no new generation | Our script | A cut at matching columns, a crossfade snapped to the palette, or a mirror image all close the seam with no new colours | Keep the cut and the crossfade. Both repeat a picture with a clear focal point. |
19
- | 3 | Split a flat picture into depth layers by distance from the sky colour | Our script | Recombines exactly, but the bands follow colour, not distance: the volcano is cut in half | Drop. |
20
- | 4 | Split by a depth model's map | Depth Anything V2 Small, CPU, under 1.2 s a picture | Clean bands on the two PixelLab landscapes; a scene framed by tall trees cannot be split this way | Keep for open landscapes. |
21
- | 5 | Pan a camera over the layers | Our script | Reads as depth. Outlines left behind and a plume that drags a strip of sky with it are the two faults | Keep, with a 2 px grow (step 6). |
22
- | 6 | Grow each near layer upward | Our script | The stray outline lines are gone; the plume fault stays | Keep. |
23
- | 7 | Scroll each row at its own speed instead of using layers | Our script | Good on ground that recedes to a horizon; shears anything tall | Keep for floors, water and valleys. |
24
- | 8 | Measure atmospheric perspective by depth band | Our script | PixelLab's scenes get closer to the sky colour with distance; Retro Diffusion's and ComfyUI's do not | Push far layers back by hand: step 9. |
19
+ | 1 | Check whether our backgrounds wrap horizontally | Our script | 9 of 10 benchmark backgrounds show a seam 1.3 to 5.6 times the normal step between neighbouring columns | None of them loops as generated. |
20
+ | 2 | Make a flat picture loop with no new generation | Our script | A cut at matching columns, a crossfade snapped to the palette, or a mirror image each closes the seam with no new colours | Keep the cut and the crossfade. Both repeat a picture with a clear focal point. |
21
+ | 3 | Split a flat picture into depth layers by distance from the sky colour | Our script | Recombines exactly, but the bands follow colour, not distance. The volcano is cut in half. | Drop. |
22
+ | 4 | Split by a depth model's map | Depth Anything V2 Small, CPU, under 1.2 s a picture | Clean bands on the two PixelLab landscapes. A scene framed by tall trees cannot be split this way. | Keep for open landscapes. |
23
+ | 5 | Pan a camera over the layers | Our script | Reads as depth. Two faults: outlines left behind, and a plume that drags a strip of sky with it. | Keep, with a 2 px grow (step 6). |
24
+ | 6 | Grow each near layer upward | Our script | The stray outlines are gone. The plume fault stays. | Keep. |
25
+ | 7 | Scroll each row at its own speed instead of using layers | Our script | Good on ground that recedes to a horizon. Shears anything tall. | Keep for floors, water and valleys. |
26
+ | 8 | Measure atmospheric perspective by depth band | Our script | PixelLab's scenes get closer to the sky colour with distance. Retro Diffusion's and ComfyUI's do not. | Push far layers back by hand (step 9). |
25
27
  | 9 | Push a layer toward the sky colour with the palette held | Our script | Contrast down a third, no new colours | Keep. |
26
- | 10 | Round layer offsets so they never move when the camera does not | Simulation | Rounding each layer's own position moves layers 3 to 25 times while the camera stands still; rounding the camera first moves them 0 times | Keep: round the camera first. |
27
- | 11 | Read what LDtk does with a parallax factor | LDtk source | A layer moves on screen at 1 − factor of the camera, and is shrunk to that scale unless `parallaxScaling` is off | Export pixel art with `parallaxScaling: false`. |
28
- | 12 | Build layers from separate silhouettes instead of cutting one picture | A game using PixelKiln, Godot 4; our script to replay it | Three generated silhouettes a biome, laid in overlapping runs in two hazed tiers over a shader sky; the layers only ever rise from where they were placed | Keep. The best route found: nothing is cut, nothing hidden has to be invented. |
29
- | 13 | Cut by depth per pixel instead of per column | Depth Anything V2 Small, our script | The plume moves on its own and the sky stays whole; the cheap fill smears sideways where a framing tree moves away | Keep the per-pixel cut. The fill needs step 14. |
30
- | 14 | Inpaint what a near layer hid | PixelLab `inpaint_image`, 10 generations | Forest and slope in place of smears; nothing outside the mask changed; 2 new colours | Keep for a scene that has to be split. |
31
- | 15 | Generate each layer on its own, wide | PixelLab pixflux with one forced palette, 4 generations; Retro Diffusion environment with `tile_x`, $0.24 | PixelLab's four layers agree and scroll as one scene; Retro Diffusion's each draw a whole scene, and background removal breaks the seam `tile_x` made | Keep PixelLab with a shared palette. Retro Diffusion's environment style is not a layer generator. |
32
- | 16 | Generate silhouettes and compose a skyline from them | PixelLab pixflux, 3 generations; our script | Usable landforms, but none fades at the foot as asked, so each run ends on a hard dark base | Keep the route; the faded foot needs a cleanup pass. Step 18 dithers it. |
33
- | 17 | Ask a layer-splitting model for the layers | Qwen-Image-Layered fp8 in ComfyUI, RTX 3060 12 GB, 35 to 42 minutes a picture | The sky and sun come apart from the land with the hidden sun filled in; far range, volcano, near ridges and lava stay in one layer; a blank fill layer and a pink blob take the other slots | Drop for parallax: it splits sky from scene, not near from far, and it is too slow on this card. |
34
- | 18 | Refine steps 12, 15 and 16: better prompts, three candidates each, finishing by script | PixelLab pixflux, 51 generations over two biomes; our script | A sprite-style prompt gives isolated landforms where a scene-style one did not; a dithered foot, a tint per tier and a scripted sky turn them into stacks that read as one scene | Keep. This is the route the [parallax guide](./PARALLAX.md) teaches. |
28
+ | 10 | Round layer offsets so they never move when the camera does not | Simulation | Rounding each layer's own position moves layers 3 to 25 times while the camera stands still. Rounding the camera first moves them 0 times. | Keep. Round the camera first. |
29
+ | 11 | Read what LDtk does with a parallax factor | LDtk source | A layer moves on screen at 1 − factor of the camera, and LDtk shrinks it to that scale unless `parallaxScaling` is off | Export pixel art with `parallaxScaling: false`. |
30
+ | 12 | Build layers from separate silhouettes instead of cutting one picture | A game using PixelKiln, Godot 4; our script to replay it | Three generated silhouettes a biome, laid in overlapping runs in two hazed tiers over a shader sky. The layers only ever rise from where they were placed. | Keep. The best route we found. Nothing is cut, so nothing hidden has to be invented. |
31
+ | 13 | Cut by depth per pixel instead of per column | Depth Anything V2 Small, our script | The plume moves on its own and the sky stays whole. The cheap fill smears sideways where a framing tree moves away. | Keep the per-pixel cut. The fill needs step 14. |
32
+ | 14 | Inpaint what a near layer hid | PixelLab `inpaint_image`, 10 generations | Forest and slope in place of smears, nothing outside the mask changed, 2 new colours | Keep for a scene that has to be split. |
33
+ | 15 | Generate each layer on its own, wide | PixelLab pixflux with one forced palette, 4 generations; Retro Diffusion environment with `tile_x`, $0.24 | PixelLab's four layers agree and scroll as one scene. Retro Diffusion's each draw a whole scene, and background removal breaks the seam `tile_x` made. | Keep PixelLab with a shared palette. Retro Diffusion's environment style is not a layer generator. |
34
+ | 16 | Generate silhouettes and compose a skyline from them | PixelLab pixflux, 3 generations; our script | Usable landforms, but none fades at the foot as asked, so each run ends on a hard dark base | Keep the route. The foot needs a cleanup pass, which step 18 adds. |
35
+ | 17 | Ask a layer-splitting model for the layers | Qwen-Image-Layered fp8 in ComfyUI, RTX 3060 12 GB, 35 to 42 minutes a picture | The sky and sun come apart from the land, with the hidden sun filled in. Far range, volcano, near ridges and lava stay in one layer. A blank fill layer and a pink blob take the other slots. | Drop for parallax. It splits sky from scene, not near from far, and it is too slow on this card. |
36
+ | 18 | Refine steps 12, 15 and 16 with better prompts, three candidates each, and finishing by script | PixelLab pixflux, 51 generations over two biomes; our script | A sprite-style prompt gives isolated landforms where a scene-style one did not. A dithered foot, a tint per tier and a scripted sky turn them into stacks that read as one scene. | Keep. This is the route the [parallax guide](./PARALLAX.md) teaches. |
37
+ | 19 | Scroll vertically: a climb, and a loop that scrolls up forever | PixelLab pixflux, 14 generations; Retro Diffusion `rd_plus__default` with `tile_y`, $0.12; our script | Sideways strips run out within a quarter of a climb. Tall layers, clouds placed up the climb, a sky that moves and a wall stacked from a generated cliff read as one climb. `tile_y` wraps vertically. | Keep. Every layer needs headroom of climb × its vertical speed. |
35
38
 
36
39
  ## Ways to make the effect
37
40
 
38
41
  There are six ways to make a background move with depth. Most games combine two of them.
39
42
 
40
- **Layers composed from separate sprites.** Each layer is assembled in the engine from several transparent silhouettes, generated one at a time, laid side by side with overlap, flips and jitter. Nothing is cut from a finished scene, so nothing hidden behind a near layer has to be invented, and a layer is as wide as the run, not the generator's canvas. Step 12 is a working example.
43
+ **Layers composed from separate sprites.** The engine assembles each layer from several transparent silhouettes, generated one at a time and laid side by side with overlap, flips and jitter. Nothing is cut from a finished scene, so nothing hidden behind a near layer has to be invented. A layer is as wide as the run, not the generator's canvas. Step 12 is a working example.
41
44
 
42
- **Separate layers.** Each depth is its own picture, scrolled at a fraction of the camera's speed. The far layer moves least. This is the standard approach and what every editor and engine supports directly. Sky, far range, middle ground, near ground and foreground occluders is the usual split, though no single source states it as a rule (unverified). An artist's guide uses "several layers" and stresses balance over a fixed count ([Pixelblog 23](https://www.slynyrd.com/blog/2019/11/12/pixelblog-23-parallax-scrolling)); Godot's tutorial uses five ([Godot 2D parallax](https://docs.godotengine.org/en/stable/tutorials/2d/2d_parallax.html)).
45
+ **Separate layers.** Each depth is its own picture, scrolled at a fraction of the camera's speed, and the far layer moves least. This is the standard approach, and every editor and engine supports it directly. The usual split is sky, far range, middle ground, near ground and foreground occluders. That is our reading of common practice; we found no source that states it as a rule. An artist's guide asks for "several layers" and cares more about balance than a fixed count ([Pixelblog 23](https://www.slynyrd.com/blog/2019/11/12/pixelblog-23-parallax-scrolling)). Godot's tutorial uses five ([Godot 2D parallax](https://docs.godotengine.org/en/stable/tutorials/2d/2d_parallax.html)).
43
46
 
44
47
  **Line scroll (raster scroll).** One picture, with each row scrolled at its own speed. The Mega Drive's video chip can scroll each line or each 8 pixel row of a plane on its own ([Sega Retro](https://segaretro.org/Sega_Mega_Drive/Scrolling)), and the SNES does it through HDMA ([nesdev HDMA examples](https://snes.nesdev.org/wiki/HDMA_examples)). It suits ground that recedes to a horizon, water and cloud bands. It shears anything tall (step 7).
45
48
 
46
- **Pseudo-3D floors (Mode 7).** A floor plane is scaled differently on every line, so it recedes in perspective ([nesdev Mode 7](https://snes.nesdev.org/wiki/Mode_7_transform)). It belongs with racing and overhead games more than side-scrolling backgrounds, and is out of scope here.
49
+ **Pseudo-3D floors (Mode 7).** The hardware scales a floor plane differently on every line, so it recedes in perspective ([nesdev Mode 7](https://snes.nesdev.org/wiki/Mode_7_transform)). It belongs to racing and overhead games more than to side-scrolling backgrounds. Out of scope here.
47
50
 
48
- **Depth-map displacement (2.5D).** One picture and a depth map; a shader moves each pixel by its depth, as in Facebook's 3D photos. Facebook's format fills the gaps that open with mobile-tuned heuristics, and learned fill tends to look "too smooth" ([Shih et al. 2020](https://arxiv.org/abs/2004.04727v3)). For pixel art, resampling each pixel breaks the grid and the filled gaps break the palette (our inference, not tested). Discrete layers keep both. Not pursued.
51
+ **Depth-map displacement (2.5D).** One picture and a depth map. A shader moves each pixel by its depth, as in Facebook's 3D photos. Facebook's format fills the gaps that open with heuristics tuned for phones, and learned fill tends to look "too smooth" ([Shih et al. 2020](https://arxiv.org/abs/2004.04727v3)). For pixel art we expect resampling to break the grid and the filled gaps to break the palette. We have not tested that. Discrete layers keep both, so we did not pursue this one.
49
52
 
50
- **Pointer or tilt parallax.** The same layers, driven by the mouse or the device's tilt in a menu or title screen instead of by a camera. The layers are the same; only the input differs.
53
+ **Pointer or tilt parallax.** The same layers, driven by the mouse or the device's tilt in a menu or title screen instead of by a camera. Only the input differs.
51
54
 
52
55
  ## Ways to get the layers out of a generator
53
56
 
54
57
  | Route | What it needs | Status here |
55
58
  |---|---|---|
56
- | Generate silhouettes and compose each layer from them in the engine | A few transparent landforms a biome, each fading out at its foot; placement rules in the game | Step 12: in use in a game. Step 18: two working sets from PixelLab. |
57
- | Generate each layer on its own, with a transparent background | A prompt per layer; the layers must agree in palette, light and horizon | Steps 15 and 18. A forced palette shared by every layer is what makes them agree. |
58
- | Generate one picture and split it with a depth model | A depth model and a fill for what the near layers hid | Steps 4 to 6, 13 and 14. |
59
- | A model that outputs layers directly | LayerDiffuse on SDXL, or Qwen-Image-Layered | Step 17: Qwen-Image-Layered splits sky from scene, not by distance, and takes over half an hour a picture on a 12 GB card. LayerDiffuse is untried. Neither is trained on pixel art. |
60
- | A wide picture that wraps, then cut into layers | A provider's seamless option, or step 2 on the result | Retro Diffusion's `tile_x` is the only hosted seamless flag found. |
59
+ | Generate silhouettes and compose each layer from them in the engine | A few transparent landforms a biome, each fading out at its foot, and placement rules in the game | Step 12 is in use in a game. Step 18 made two working sets with PixelLab. |
60
+ | Generate each layer on its own, with a transparent background | A prompt per layer. The layers must agree in palette, light and horizon. | Steps 15 and 18. A forced palette shared by every layer is what makes them agree. |
61
+ | Generate one picture and split it with a depth model | A depth model, and a fill for what the near layers hid | Steps 4 to 6, 13 and 14. |
62
+ | A model that outputs layers directly | LayerDiffuse on SDXL, or Qwen-Image-Layered | Step 17. Qwen-Image-Layered splits sky from scene, not by distance, and takes over half an hour a picture on a 12 GB card. LayerDiffuse is untried. Neither is trained on pixel art. |
63
+ | A wide picture that wraps, then cut into layers | A provider's seamless option, or step 2 on the result | Retro Diffusion's `tile_x` and `tile_y` are the only hosted seamless flags we found. Step 19 loops a sky vertically with `tile_y`. |
61
64
 
62
65
  ## 1. Do our backgrounds wrap?
63
66
 
64
67
  **Question.** A parallax layer usually repeats sideways forever. Do the backgrounds PixelKiln already generates join up when placed end to end?
65
68
 
66
- **Setup.** `parallax.py seam` on the ten scenic backgrounds from the [provider benchmark](./PROVIDER_BENCHMARK.md). The seam is the mean absolute RGB difference between the last column and the first. It is divided by the median difference between neighbouring columns inside the picture. A ratio near 1 means the join is no rougher than the picture itself.
69
+ **Setup.** `parallax.py seam` on the ten scenic backgrounds from the [provider benchmark](./PROVIDER_BENCHMARK.md). The seam is the mean absolute RGB difference between the last column and the first. The script divides it by the median difference between neighbouring columns inside the picture. A ratio near 1 means the join is no rougher than the picture itself.
67
70
 
68
71
  **Result.**
69
72
 
@@ -80,7 +83,7 @@ There are six ways to make a background move with depth. Most games combine two
80
83
  | Retro Diffusion alpine valley B | 43.1 | 7.7 | 5.6 |
81
84
  | Retro Diffusion volcanic pass B | 22.7 | 6.3 | 3.6 |
82
85
 
83
- The one low ratio is a coincidence of composition: Retro Diffusion's alpine valley A is framed by near-black trees down both edges.
86
+ The one low ratio is luck. Retro Diffusion's alpine valley A has near-black trees down both edges, so its first and last columns already match.
84
87
 
85
88
  **Verdict.** No benchmark background loops as generated, and none was asked to. A layer has to be made to loop, either when it is generated or afterwards.
86
89
 
@@ -88,11 +91,11 @@ The one low ratio is a coincidence of composition: Retro Diffusion's alpine vall
88
91
 
89
92
  **Question.** Can a picture that does not wrap be made to, without a new generation and without new colours?
90
93
 
91
- **Setup.** `parallax.py loop` with three methods, on PixelLab's alpine valley A (256×256) and volcanic pass A (384×384):
94
+ **Setup.** `parallax.py loop` with three methods, on PixelLab's alpine valley A (256×256) and volcanic pass A (384×384).
92
95
 
93
- - **Cut**: find the two columns at least 60% of the width apart where the right one best continues into the left, and crop to them.
94
- - **Crossfade**: blend the last eighth of the width into the first eighth, drop the last eighth, and snap every blended pixel to the nearest colour already in the picture.
95
- - **Mirror**: place the picture next to its mirror image.
96
+ - **Cut.** Find the two columns at least 60% of the width apart where the right one best continues into the left, and crop to them.
97
+ - **Crossfade.** Blend the last eighth of the width into the first eighth, drop the last eighth, and snap every blended pixel to the nearest colour already in the picture.
98
+ - **Mirror.** Place the picture next to its mirror image.
96
99
 
97
100
  **Result.**
98
101
 
@@ -104,66 +107,66 @@ The one low ratio is a coincidence of composition: Retro Diffusion's alpine vall
104
107
 
105
108
  ![The alpine valley looped by a cut (left) and a crossfade (right), each shown twice side by side](../website/public/research/parallax/alpine-loops.png)
106
109
 
107
- **Verdict.** The cut and the crossfade both make a loop that holds up at the join. The mirror closes the seam perfectly and shows its symmetry at once. All three expose the bigger problem: a scenic picture has a focal point, and a repeating peak or volcano is obvious. A loop wants a layer with no single landmark, which is also Pixelblog 23's advice. Landmarks belong on a layer of their own that does not repeat, or repeats rarely.
110
+ **Verdict.** The cut and the crossfade both make a loop that holds up at the join. The mirror closes the seam perfectly and gives itself away at once with its symmetry. All three expose the bigger problem. A scenic picture has a focal point, and a peak or volcano that comes round again every few seconds is obvious. A loop wants a layer with no single landmark, which is also Pixelblog 23's advice. Landmarks belong on a layer of their own that does not repeat, or repeats rarely.
108
111
 
109
112
  ## 3. Split by distance from the sky colour
110
113
 
111
114
  **Question.** Distant things in a landscape are closer to the sky colour. Is that enough to cut a flat picture into depth layers, with no model?
112
115
 
113
- **Setup.** `parallax.py split <png> <out> 4`. Nearness is each pixel's RGB distance from the median colour of the top rows, median-filtered over 5×5. A 1D k-means finds three cut points. For each cut, a skyline is the first row in each column where nearness stays above the cut for three rows, kept in depth order. Layer *k* is everything from its skyline down. Where a nearer layer hid it, the gap is filled by reflecting the layer's own rows, so a revealed gap shows its texture rather than a smear. Composited at rest, the layers rebuild the source exactly; the script checks this.
116
+ **Setup.** `parallax.py split <png> <out> 4`. Nearness is each pixel's RGB distance from the median colour of the top rows, median-filtered over 5×5. A 1D k-means finds three cut points. For each cut, the skyline is the first row in each column where nearness stays above the cut for three rows, kept in depth order. Layer *k* is everything from its skyline down. Where a nearer layer hid it, the script fills the gap by reflecting the layer's own rows, so a revealed gap shows its texture rather than a smear. Composited at rest, the layers rebuild the source exactly, and the script checks this.
114
117
 
115
- **Result.** On the volcano, the bands follow colour: the lit flank of the volcano lands in one band and its shadowed flank in another, and the sun gets a band of its own.
118
+ **Result.** On the volcano the bands follow colour. The lit flank of the volcano lands in one band, its shadowed flank in another, and the sun gets a band of its own.
116
119
 
117
- **Verdict.** Drop. Colour is a poor stand-in for distance as soon as a scene has its own light.
120
+ **Verdict.** Drop. Colour stops standing in for distance as soon as a scene has its own light.
118
121
 
119
122
  ## 4. Split by a depth model
120
123
 
121
124
  **Question.** Does a monocular depth model give bands that follow the scene's real depth?
122
125
 
123
- **Setup.** `depth.py` runs [Depth Anything V2 Small](https://github.com/DepthAnything/Depth-Anything-V2) (24.8M parameters, Apache-2.0; the larger checkpoints are CC-BY-NC-4.0) through Hugging Face Transformers 5.24 and PyTorch 2.15 on the CPU of a Mac. The picture is enlarged twice with nearest neighbour first, and the map is brought back to the picture's size. Then the same split as step 3, using the map as nearness.
126
+ **Setup.** `depth.py` runs [Depth Anything V2 Small](https://github.com/DepthAnything/Depth-Anything-V2) through Hugging Face Transformers 5.24 and PyTorch 2.15 on a Mac's CPU. The model has 24.8M parameters and is Apache-2.0; the larger checkpoints are CC-BY-NC-4.0. The script enlarges the picture twice with nearest neighbour first, then shrinks the map back to the picture's size. The split is the same as step 3, with the map as nearness.
124
127
 
125
128
  **Result.** Under 1.2 s a picture. On both PixelLab landscapes the bands follow the scene: sky and distant range, the volcano or the far valley, the middle ridges, and the near ridges or trees.
126
129
 
127
130
  ![Alpine valley split by sky distance (left) and by Depth Anything (middle)](../website/public/research/parallax/alpine-split.png)
128
131
 
129
- Retro Diffusion's alpine valley A is the exception. Tall trees frame it from the top of the picture to the bottom on both sides. A skyline split assumes the near ground starts lower in every column than what is behind it, so it puts the whole frame in the nearest layer along with the full column above it, and most of each layer would have to be invented as the camera moves.
132
+ Retro Diffusion's alpine valley A is the exception. Tall trees frame it from top to bottom on both sides. A skyline split assumes the near ground starts lower in every column than whatever is behind it. Here it puts the whole frame in the nearest layer, along with the full column above it, and most of each layer would have to be invented as the camera moves.
130
133
 
131
- The script also counts the pixels a layer does not have but would show if the layer in front of it moved a twelfth of the picture's width (32 px on the volcano) relative to it. These are the pixels the fill makes up. With the depth map they are 15 to 40% of a layer on the PixelLab pictures, and 29 to 101% on the framed Retro Diffusion one. The count is an upper bound and depends on how far the camera travels.
134
+ The script also counts the pixels a layer lacks but would show if the layer in front moved a twelfth of the picture's width relative to it (32 px on the volcano). The fill has to make these pixels up. With the depth map they come to 15 to 40% of a layer on the PixelLab pictures, and 29 to 101% on the framed Retro Diffusion one. The count is an upper bound and depends on how far the camera travels.
132
135
 
133
- **Verdict.** Keep, for open landscapes composed as layers already. A scene composed for one frame needs per-pixel layers and a real fill, which this note has not tried.
136
+ **Verdict.** Keep, for open landscapes that were composed in layers to begin with. A scene composed for one frame needs per-pixel layers and a real fill (steps 13 and 14).
134
137
 
135
138
  ## 5. Pan a camera over the layers
136
139
 
137
140
  **Question.** Do the depth-model layers read as depth when they move, and what breaks?
138
141
 
139
- **Setup.** `parallax.py preview`: the four layers at factors 0.1, 0.3, 0.6 and 1.0 of the camera's movement, a view three quarters of the picture wide, a 96 px eased pan, 60 frames, offsets rounded as in step 10.
142
+ **Setup.** `parallax.py preview` moves the four layers at 0.1, 0.3, 0.6 and 1.0 of the camera's movement. The view is three quarters of the picture wide, the pan is 96 px and eased over 60 frames, and offsets are rounded as in step 10.
140
143
 
141
- **Result.** It reads as depth: the volcano drifts against the sky and the near ridges sweep across it. Two faults show at the far end of the pan (left, before step 6):
144
+ **Result.** It reads as depth. The volcano drifts against the sky and the near ridges sweep across it. Two faults show at the far end of the pan (left, before step 6).
142
145
 
143
- - **Outlines left behind.** Each ridge's dark outline sits just above its skyline, so it was assigned to the layer behind. When the ridge moves, its outline stays put as a stray line.
144
- - **The plume drags a strip of sky.** The depth model puts the smoke nearer than the sky behind it. Since a layer here is everything below a skyline, the strip of sky between the smoke and the volcano's slope moves with the volcano.
146
+ - **Outlines left behind.** Each ridge's dark outline sits just above its skyline, so the split assigned it to the layer behind. When the ridge moves, its outline stays put as a stray line.
147
+ - **The plume drags a strip of sky.** The depth model puts the smoke nearer than the sky behind it. A layer here is everything below a skyline, so the strip of sky between the smoke and the volcano's slope moves with the volcano.
145
148
 
146
149
  ![At the far end of the pan: before the grow (left) and after (right)](../website/public/research/parallax/volcano-grow.png)
147
150
 
148
- **Verdict.** Keep, with step 6. Floating things (smoke, clouds, birds, a moon) need to be cut out as their own sprites instead of riding a skyline.
151
+ **Verdict.** Keep, with step 6. Floating things such as smoke, clouds, birds and a moon have to be cut out as their own sprites instead of riding a skyline.
149
152
 
150
153
  ## 6. Grow each near layer
151
154
 
152
155
  **Question.** Does lifting each skyline a couple of pixels make the near shapes take their outlines with them?
153
156
 
154
- **Setup.** `GROW=2` (and 4) on the split: each skyline moves up by that many rows before the layers are cut.
157
+ **Setup.** `GROW=2`, and 4, on the split. Each skyline moves up by that many rows before the layers are cut.
155
158
 
156
- **Result.** At 2 px the stray lines are gone (picture above, right). 4 px looks no better, so the smaller grow is kept. The plume fault from step 5 is unchanged, as expected.
159
+ **Result.** At 2 px the stray lines are gone (picture above, right). 4 px looks no better, so we kept the smaller grow. The plume fault from step 5 is unchanged, as expected.
157
160
 
158
161
  **Verdict.** Keep 2 px.
159
162
 
160
163
  ## 7. Scroll each row instead
161
164
 
162
- **Question.** For a scene that is mostly ground receding to a horizon, is per-row scrolling a cheaper route than layers, with nothing to cut or fill?
165
+ **Question.** For a scene that is mostly ground receding to a horizon, is per-row scrolling cheaper than layers, with nothing to cut or fill?
163
166
 
164
- **Setup.** `parallax.py line <png> <out> <horizon-row>`. Rows above the horizon move at 0.15 of the camera; below it the factor rises to 1.0 at the bottom row along a 1.5 power curve. Horizon at row 100 of 256 for the alpine valley and row 150 of 384 for the volcano.
167
+ **Setup.** `parallax.py line <png> <out> <horizon-row>`. Rows above the horizon move at 0.15 of the camera. Below it the factor rises to 1.0 at the bottom row along a 1.5 power curve. The horizon is row 100 of 256 for the alpine valley and row 150 of 384 for the volcano.
165
168
 
166
- **Result.** The alpine valley's forested floor and river sweep convincingly, with no gaps to fill. The volcano shows the limit: its cone and the near ridges stand across many rows, so each row slides by a different amount and they lean.
169
+ **Result.** The alpine valley's forested floor and river sweep past convincingly, with no gaps to fill. The volcano shows the limit. Its cone and the near ridges stand across many rows, each row slides by a different amount, and they lean.
167
170
 
168
171
  ![Alpine valley, per-row scroll](../website/public/research/parallax/alpine-line.gif)
169
172
 
@@ -171,9 +174,9 @@ The script also counts the pixels a layer does not have but would show if the la
171
174
 
172
175
  ## 8. Do generators already push the distance back?
173
176
 
174
- **Question.** Atmospheric perspective makes distant layers lower in contrast and closer to the sky colour (a summary of several art guides, such as [Pinnguaq](https://pinnguaq.com/?p=1295); not checked against each). Do the generated backgrounds already do this, so the layers can be used as cut?
177
+ **Question.** Atmospheric perspective makes distant layers lower in contrast and closer to the sky colour. That is a summary of several art guides, such as [Pinnguaq](https://pinnguaq.com/?p=1295), not checked against each one. Do the generated backgrounds already do this, so the layers can be used as cut?
175
178
 
176
- **Setup.** `parallax.py bands <png> 4 <depth.png>`: for each depth band, the standard deviation of luminance and the mean RGB distance from the sky colour.
179
+ **Setup.** `parallax.py bands <png> 4 <depth.png>` gives, for each depth band, the standard deviation of luminance and the mean RGB distance from the sky colour.
177
180
 
178
181
  **Result.** Distance from the sky colour, far band to near band:
179
182
 
@@ -186,25 +189,25 @@ The script also counts the pixels a layer does not have but would show if the la
186
189
 
187
190
  Luminance contrast does not fall steadily with distance in any of them.
188
191
 
189
- **Verdict.** PixelLab's scenes are lit for depth; Retro Diffusion's night canyon and the ComfyUI benchmark are not. The ComfyUI benchmark output was not reduced to a palette, so its colour counts are not comparable. Layers cut from a picture that is not lit for depth need pushing back by hand.
192
+ **Verdict.** PixelLab's scenes are lit for depth. Retro Diffusion's night canyon and the ComfyUI benchmark are not. The ComfyUI output was never reduced to a palette, so its colour counts are not comparable. Layers cut from a picture that is not lit for depth need pushing back by hand.
190
193
 
191
194
  ## 9. Push a layer back
192
195
 
193
196
  **Question.** Can a layer be pushed toward the sky colour without adding colours?
194
197
 
195
- **Setup.** `parallax.py haze <layer.png> <out.png> 0.35`: each pixel is mixed 35% toward the sky colour, then snapped to the nearest colour already in the layer.
198
+ **Setup.** `parallax.py haze <layer.png> <out.png> 0.35` mixes each pixel 35% toward the sky colour, then snaps it to the nearest colour already in the layer.
196
199
 
197
200
  **Result.** On the alpine valley's second layer, luminance contrast falls from 21.8 to 14.6, and the layer uses 19 of its 35 colours. No colour is new.
198
201
 
199
202
  ![Alpine valley as generated (left) and with its second layer pushed back (right)](../website/public/research/parallax/alpine-haze.png)
200
203
 
201
- **Verdict.** Keep. The snap means the layer can only use colours it already has, so a push toward a sky colour the layer lacks would need the sky's colours added to its palette first.
204
+ **Verdict.** Keep. The snap limits the layer to colours it already has. To push toward a sky colour the layer lacks, add the sky's colours to its palette first.
202
205
 
203
206
  ## 10. Rounding
204
207
 
205
- **Question.** Pixel art has to move in whole pixels. A layer at a factor of 0.3 is at a fractional position most of the time. Which rounding keeps layers from twitching when the camera stops?
208
+ **Question.** Pixel art has to move in whole pixels, and a layer at a factor of 0.3 sits at a fractional position most of the time. Which rounding keeps layers from twitching when the camera stops?
206
209
 
207
- **Setup.** `parallax.py jitter` simulates a camera that follows a character walking 120 px in 3 s, then stops and settles with a small overshoot: 360 frames at 60 fps. It counts the frames where a layer moves a pixel while the rounded camera does not. Two schemes: round each layer's own position, `round(cam × f)`; or round the camera, then take the layer from it, `floor(round(cam) × f)`.
210
+ **Setup.** `parallax.py jitter` simulates a camera that follows a character walking 120 px in 3 s, then stops and settles with a small overshoot: 360 frames at 60 fps. It counts the frames where a layer moves a pixel while the rounded camera does not. It compares two schemes. One rounds each layer's own position, `round(cam × f)`. The other rounds the camera and takes the layer from it, `floor(round(cam) × f)`.
208
211
 
209
212
  **Result.**
210
213
 
@@ -218,15 +221,15 @@ Luminance contrast does not fall steadily with distance in any of them.
218
221
 
219
222
  At a steady 1 px a frame, factors 0.25 and 0.5 step every 4 and 2 frames. Factors 0.3, 0.4, 0.6 and 0.75 step on an uneven rhythm, such as 3, 3, 4 for 0.3.
220
223
 
221
- **Verdict.** Round the camera to whole pixels first and derive every layer from that. Prefer factors that are simple fractions (1/2, 1/4, 1/8) where an even rhythm matters. An artist's guide takes the same line from the other end: whole pixels per frame, and loop widths with many divisors, such as 96 ([Pixelblog 23](https://www.slynyrd.com/blog/2019/11/12/pixelblog-23-parallax-scrolling)).
224
+ **Verdict.** Round the camera to whole pixels first and derive every layer from that. Where an even rhythm matters, prefer simple fractions (1/2, 1/4, 1/8). An artist's guide comes at it from the other end with whole pixels per frame and loop widths with many divisors, such as 96 ([Pixelblog 23](https://www.slynyrd.com/blog/2019/11/12/pixelblog-23-parallax-scrolling)).
222
225
 
223
226
  ## 11. What LDtk does with a parallax factor
224
227
 
225
228
  **Question.** PixelKiln's LDtk export writes `parallaxFactorX: 0`, `parallaxFactorY: 0` and `parallaxScaling: true` on every layer ([`ldtk-export.ts`](../src/pipeline/ldtk-export.ts)). What would a non-zero factor do?
226
229
 
227
- **Setup.** Read the LDtk source. `Camera.getParallaxOffsetX` returns `levelX * parallaxFactorX`, minus half the layer's width times the factor when scaling is off ([Camera.hx](https://github.com/deepnight/ldtk/blob/master/src/electron.renderer/display/Camera.hx)). `LayerDef.getScale` returns `1 - parallaxFactorX` when `parallaxScaling` is on and the factor is not zero ([LayerDef.hx](https://github.com/deepnight/ldtk/blob/master/src/electron.renderer/data/def/LayerDef.hx)). The schema gives the range as -1 to 1, default 0 ([JSON schema](https://ldtk.io/files/JSON_SCHEMA.json)).
230
+ **Setup.** We read the LDtk source. `Camera.getParallaxOffsetX` returns `levelX * parallaxFactorX`, minus half the layer's width times the factor when scaling is off ([Camera.hx](https://github.com/deepnight/ldtk/blob/master/src/electron.renderer/display/Camera.hx)). `LayerDef.getScale` returns `1 - parallaxFactorX` when `parallaxScaling` is on and the factor is not zero ([LayerDef.hx](https://github.com/deepnight/ldtk/blob/master/src/electron.renderer/data/def/LayerDef.hx)). The schema gives the range as -1 to 1, default 0 ([JSON schema](https://ldtk.io/files/JSON_SCHEMA.json)).
228
231
 
229
- **Result.** The layer is offset by the camera position times the factor, so on screen it moves at 1 − factor of the camera's speed. 0 is an ordinary layer. A positive factor is farther away, and 1 never moves. A negative factor is nearer than the level. With `parallaxScaling` on, the layer is also drawn at 1 − factor of its size, so a far layer shrinks.
232
+ **Result.** LDtk offsets the layer by the camera position times the factor, so on screen it moves at 1 − factor of the camera's speed. 0 is an ordinary layer. A positive factor is farther away, and 1 never moves. A negative factor is nearer than the level. With `parallaxScaling` on, LDtk also draws the layer at 1 − factor of its size, so a far layer shrinks.
230
233
 
231
234
  The same layer, at a quarter of the camera's speed, in each tool:
232
235
 
@@ -236,47 +239,47 @@ The same layer, at a quarter of the camera's speed, in each tool:
236
239
  | Tiled | `parallaxx: 0.25` | [Tiled manual](https://doc.mapeditor.org/en/latest/manual/layers/) |
237
240
  | Godot 4 `Parallax2D` | `scroll_scale = Vector2(0.25, 1)` | [Godot class reference](https://docs.godotengine.org/en/stable/classes/class_parallax2d.html) |
238
241
  | Phaser 3 | `setScrollFactor(0.25, 1)` | [Phaser API](https://docs.phaser.io/api-documentation/3.90.0/namespace/gameobjects-components-scrollfactor) |
239
- | Unity | Scripted; no official parallax package found (unverified) | — |
242
+ | Unity | Scripted. We found no official parallax package. | None |
240
243
 
241
- **Verdict.** LDtk counts the other way from every other tool here: its factor is how much the layer follows the camera, not how fast it moves. An exporter has to write 1 − speed. It also has to set `parallaxScaling: false` for pixel art, or LDtk draws a far layer at a fraction of its size and off the pixel grid. Not yet checked in the LDtk editor itself.
244
+ **Verdict.** LDtk counts the other way from every other tool here. Its factor is how much the layer follows the camera, not how fast it moves, so an exporter has to write 1 − speed. It also has to set `parallaxScaling: false` for pixel art, or LDtk draws a far layer at a fraction of its size and off the pixel grid. Not yet checked in the LDtk editor itself.
242
245
 
243
246
  ## 12. Layers built from separate silhouettes
244
247
 
245
- **Question.** Steps 3 to 6 cut one picture into layers and then have to invent what the near layers hid. A game that uses PixelKiln does the opposite: it composes each layer from separate sprites. How is it built, and what does it settle that splitting does not?
248
+ **Question.** Steps 3 to 6 cut one picture into layers and then have to invent what the near layers hid. A game that uses PixelKiln does the opposite and composes each layer from separate sprites. How is it built, and what does it settle that splitting does not?
246
249
 
247
- **Setup.** Read from the game's Godot 4 source (its backdrop and sky scripts and their tests), not run in the game. The game is top-down with an isometric look. The camera can pan north past the playfield's edge to look at the skyline, so the movement is mostly vertical. `parallax.py compose` replays the layout and the offsets outside the engine to check the numbers.
250
+ **Setup.** We read the game's Godot 4 source (its backdrop and sky scripts and their tests) and did not run the game. The game is top-down with an isometric look. The camera can pan north past the playfield's edge to look at the skyline, so the movement is mostly vertical. `parallax.py compose` replays the layout and the offsets outside the engine to check the numbers.
248
251
 
249
252
  **Result.** How it is put together:
250
253
 
251
- - **The art is silhouettes, not scenes.** Each biome has three landforms, generated one at a time from prompts of the form "distant <landform>, fading to nothing at its foot, hazy dusk lighting as if seen from far away, no ground plane, no sky, isolated landform only, transparent background". The first set was 224 to 256 px wide from PixelLab. They were later redrawn at 768×336 through Scenario, with the bottom 30% faded to transparent so the foot dissolves into the haze rather than ending on a hard edge. A forest or jungle biome has none: its treeline is its horizon.
252
- - **A layer is a run of those silhouettes.** Each next sprite starts 72% of the way across the one before it, plus a random gap of up to 16 px, so the shapes overlap into one skyline instead of reading as a row of objects. Each sprite is flipped at random, the same one never comes twice in a row, and the feet jitter ±12 px. A seeded generator of its own places them, so adding a landform never moves anything else.
253
- - **Two tiers.** The far tier stands 40 px deeper than the near one. Both are tinted toward the biome's dusk colour, the far one by 0.5 and the near one by 0.3. That is aerial perspective from a tint, not from the art (compare step 9). A dust storm pales both further.
254
- - **The sky is not generated.** It is a shader: four flat colour bands for each time of day, each nudged toward a colour for the biome's air, with clouds, an overcast deck, or stars and a moon drawn over the bands. The same sky colour tints the playfield a little, so the two agree.
255
- - **Movement.** The playfield moves 1:1 with the camera. The sky follows at 0.6, the far tier at 0.85 and the near tier at 0.92. The offset is `round((1 − rate) × clamp(viewTop − edge, −360, 0))`, where 360 px is how far the camera may look past the edge. The x offset is the same shape, centred on the playfield. Offsets are whole world pixels, and a world pixel is one texel at every zoom the game allows.
256
- - **Anchored so nothing ever sinks.** At the southernmost view that can see the skyline, every layer sits exactly where it sits with parallax off; from there the layers only rise. So the game's rule that a tree's foot must stand in front of the mountains' base holds at every camera position.
257
- - **The gap under a rising layer is ground, not sky.** A rising tier would open a strip above the playfield. A thin "skirt" of distant ground fills it: the biome's ground colour hazed 0.2 toward the horizon band, 24 px solid with a 12 px stepped fade above and below. Its top rides with the tier and its foot stays put. The sky's top rises while its foot stays fixed, so its bottom edge never shows. Nothing ever floats.
258
- - **No loop.** The world is bounded, so each run is laid past both ends of the playfield by the most that layer can drift, `(1 − rate) × reach`, plus a 400 px margin. No side edge shows and no seam is needed (compare steps 1 and 2).
259
- - **Heat shimmer** in hot biomes moves each band of three texel rows sideways by whole texels, stepped at the game's 8 fps animation rate: line scroll (step 7) used for an effect rather than for depth.
254
+ - **The art is silhouettes, not scenes.** Each biome has three landforms, generated one at a time from prompts of the form "distant <landform>, fading to nothing at its foot, hazy dusk lighting as if seen from far away, no ground plane, no sky, isolated landform only, transparent background". The first set came from PixelLab at 224 to 256 px wide. They were later redrawn at 768×336 through Scenario, with the bottom 30% faded to transparent so the foot dissolves into the haze instead of ending on a hard edge. A forest or jungle biome has none, because its treeline is its horizon.
255
+ - **A layer is a run of those silhouettes.** Each next sprite starts 72% of the way across the one before it, plus a random gap of up to 16 px, so the shapes overlap into one skyline instead of reading as a row of objects. Each sprite is flipped at random, the same one never comes twice in a row, and the feet jitter ±12 px. The game places them with a seeded generator of their own, so adding a landform never moves anything else.
256
+ - **Two tiers.** The far tier stands 40 px deeper than the near one. Both are tinted toward the biome's dusk colour, the far one by 0.5 and the near one by 0.3. The aerial perspective comes from the tint, not from the art (compare step 9). A dust storm pales both further.
257
+ - **The sky is not generated.** It is a shader with four flat colour bands for each time of day, each nudged toward a colour for the biome's air, and clouds, an overcast deck, or stars and a moon drawn over the bands. The same sky colour tints the playfield a little, so the two agree.
258
+ - **Movement.** The playfield moves 1:1 with the camera. The sky follows at 0.6, the far tier at 0.85 and the near tier at 0.92. The offset is `round((1 − rate) × clamp(viewTop − edge, −360, 0))`, where 360 px is how far the camera may look past the edge. The x offset has the same shape, centred on the playfield. Offsets are whole world pixels, and a world pixel is one texel at every zoom the game allows.
259
+ - **Anchored so nothing ever sinks.** At the southernmost view that can see the skyline, every layer sits exactly where it would with parallax off. From there the layers only rise. So the game's rule that a tree's foot must stand in front of the mountains' base holds at every camera position.
260
+ - **The gap under a rising layer is ground, not sky.** A rising tier would open a strip above the playfield. A thin "skirt" of distant ground fills it: the biome's ground colour hazed 0.2 toward the horizon band, 24 px solid with a 12 px stepped fade above and below. Its top rides with the tier and its foot stays put. The sky's top rises while its foot stays fixed, so its bottom edge never shows. Nothing floats.
261
+ - **No loop.** The world is bounded, so each run extends past both ends of the playfield by the most that layer can drift, `(1 − rate) × reach`, plus a 400 px margin. No side edge shows and no seam is needed (compare steps 1 and 2).
262
+ - **Heat shimmer** in hot biomes moves each band of three texel rows sideways by whole texels, stepped at the game's 8 fps animation rate. That is line scroll (step 7) used for an effect rather than for depth.
260
263
 
261
- **Tuning.** The first prototype moved the layers at 0.3, 0.5 and 0.75, each tier with a 64 px skirt. The owner's review was that less could be more. At full headroom the old rates lift the sky, far and near layers 252, 180 and 90 px, against 144, 54 and 29 px for the current ones: `compose` gives the same figures from the formula. Close rates for the two tiers keep them together, so no band of sky opens between them, and one thin skirt replaced two wide ones that had read as haze between the layers and the playfield.
264
+ **Tuning.** The first prototype moved the layers at 0.3, 0.5 and 0.75, each tier with a 64 px skirt. The owner's review was that less could be more. At full headroom the old rates lift the sky, far and near layers 252, 180 and 90 px, against 144, 54 and 29 px for the current ones, and `compose` gives the same figures from the formula. Close rates keep the two tiers together, so no band of sky opens between them. One thin skirt replaced two wide ones that had read as haze between the layers and the playfield.
262
265
 
263
- **Open check.** The offsets are rounded from the camera's own, unrounded view top. Step 10 found that this moves a layer while the camera is still, unless the camera's position is already whole pixels. The game snaps 2D transforms to pixels and snaps its smoothed view onto its target, but whether the view top is ever fractional while settling was not checked.
266
+ **Open check.** The game rounds the offsets from the camera's own, unrounded view top. Step 10 found that this moves a layer while the camera is still, unless the camera's position is already whole pixels. The game snaps 2D transforms to pixels and snaps its smoothed view onto its target, but we did not check whether the view top is ever fractional while it settles.
264
267
 
265
- **Verdict.** Keep. This is the most practical route in this note. Generators are good at one isolated shape on a transparent background and poor at agreeing across several pictures. Composing layers from silhouettes asks them only for the first. Splitting a picture (steps 3 to 6) is still the route when there is one finished scene to animate.
268
+ **Verdict.** Keep. This is the most practical route in this note. Generators are good at one isolated shape on a transparent background and poor at agreeing across several pictures, and this route asks them only for the first. Splitting a picture (steps 3 to 6) is still the route when you have one finished scene to animate.
266
269
 
267
270
  ## 13. Cut by depth per pixel
268
271
 
269
- **Question.** Steps 4 to 6 cut along one skyline per column, which fails on a scene framed by tall trees and drags sky along with anything floating. Does assigning each pixel to its own depth band fix both?
272
+ **Question.** Steps 4 to 6 cut along one skyline per column. That fails on a scene framed by tall trees and drags sky along with anything floating. Does assigning each pixel to its own depth band fix both?
270
273
 
271
- **Setup.** `parallax.py cut <png> <out> 4 <depth.png> <reach>`, with `GROW=2`. Each pixel goes to its band from the Depth Anything map, then a 3×3 median removes specks, and each near band takes 2 px from the bands behind it (step 6). A layer is filled only where it could be uncovered: hidden pixels within `reach` px of something at its depth or farther. Reach is the pan, 96 px on the volcano and 64 on the framed valley. The fill copies the nearest pixel of the layer's own in the same row, then the nearest in any direction. The script writes each layer's invented pixels as a mask for step 14.
274
+ **Setup.** `parallax.py cut <png> <out> 4 <depth.png> <reach>`, with `GROW=2`. Each pixel goes to its band from the Depth Anything map. A 3×3 median then removes specks, and each near band takes 2 px from the bands behind it (step 6). The script fills a layer only where it could be uncovered, meaning hidden pixels within `reach` px of something at its depth or farther. Reach is the pan, 96 px on the volcano and 64 on the framed valley. The fill copies the nearest pixel of the layer's own in the same row, then the nearest in any direction. The script writes each layer's invented pixels as a mask for step 14.
272
275
 
273
- **Result.** Both pictures recombine exactly at rest. On the volcano the plume now moves with its own band and the sky behind it stays sky (right; the skyline cut of step 6 on the left). The framed valley no longer loses whole columns to the trees.
276
+ **Result.** Both pictures recombine exactly at rest. On the volcano the plume now moves with its own band, and the sky behind it stays sky (right; the skyline cut of step 6 is on the left). The framed valley no longer loses whole columns to the trees.
274
277
 
275
278
  ![The volcano at the far end of the pan: skyline cut (left) and per-pixel cut (right)](../website/public/research/parallax/volcano-cut.png)
276
279
 
277
280
  ![Volcano layers cut per pixel, panning](../website/public/research/parallax/volcano-cut.gif)
278
281
 
279
- The price is invention. The fill has to make up 115 to 189% of a layer's own pixel count on the volcano and 175 to 333% on the framed valley, because the bands are thin and the pan is long. Where a framing tree slides away, the cheap fill shows as sideways smears (step 14, left).
282
+ The price is invention. Because the bands are thin and the pan is long, the fill has to make up 115 to 189% of a layer's own pixel count on the volcano and 175 to 333% on the framed valley. Where a framing tree slides away, the cheap fill shows as sideways smears (step 14, left).
280
283
 
281
284
  **Verdict.** Keep the per-pixel cut. The fill is the weak part.
282
285
 
@@ -284,9 +287,9 @@ The price is invention. The fill has to make up 115 to 189% of a layer's own pix
284
287
 
285
288
  **Question.** Can a hosted inpainting model replace the smeared fill with something that belongs in the scene, without changing the pixels around it?
286
289
 
287
- **Setup.** The framed valley's third layer (the trees and cabins in the middle ground), whose fill covers 22,794 pixels. The input was layers 0 to 2 composited, so the model sees an opaque picture, and the mask was the invented pixels from step 13. PixelLab `inpaint_image` at 256×256, seed 4242, `crop_to_mask` on, described as "the valley floor continuing behind: pine trees, grassy riverbank and distant mountain slopes in the same pixel-art style and colours, no large tree trunks in the foreground". 10 generations.
290
+ **Setup.** The framed valley's third layer, the trees and cabins in the middle ground, whose fill covers 22,794 pixels. The input was layers 0 to 2 composited, so the model sees an opaque picture, and the mask was the invented pixels from step 13. PixelLab `inpaint_image` at 256×256, seed 4242, `crop_to_mask` on, with the description "the valley floor continuing behind: pine trees, grassy riverbank and distant mountain slopes in the same pixel-art style and colours, no large tree trunks in the foreground". 10 generations.
288
291
 
289
- **Result.** No pixel outside the mask changed. The fill used 31 colours, 2 of them not elsewhere in the picture. At the far end of the pan, the smears to the left of the cabin and along the mountain's edge became forest and slope (right). The two farther layers still carry the cheap fill.
292
+ **Result.** No pixel outside the mask changed. The fill used 31 colours, 2 of them new to the picture. At the far end of the pan, the smears to the left of the cabin and along the mountain's edge became forest and slope (right). The two farther layers still carry the cheap fill.
290
293
 
291
294
  ![The framed valley at the far end of the pan: cheap fill (left) and inpainted fill (right)](../website/public/research/parallax/rd-alpine-fill.png)
292
295
 
@@ -296,19 +299,19 @@ The price is invention. The fill has to make up 115 to 189% of a layer's own pix
296
299
 
297
300
  **Question.** Instead of cutting a scene, can each layer be generated as its own wide picture that agrees with the others and wraps?
298
301
 
299
- **Setup.** One volcanic dusk set from each hosted provider: a sky, a far range, a volcano and near ridges. The manifests are in [`benchmarks/parallax-layers`](../benchmarks/parallax-layers).
302
+ **Setup.** One volcanic dusk set from each hosted provider, with a sky, a far range, a volcano and near ridges. The manifests are in [`benchmarks/parallax-layers`](../benchmarks/parallax-layers).
300
303
 
301
- - **PixelLab** through PixelKiln: pixflux, `view: side`, seed 4242, and one forced palette for every layer, the 44 colours of the step 4 volcano. The sky is 400×160 and opaque; the three layers are 400×100 with background removal (under pixflux's 40,000 px transparency limit). 4 generations.
302
- - **Retro Diffusion**: `rd_plus__environment` with `tile_x`, seed 4242. The sky is 384×160; the layers are 384×96 with `remove_bg`. $0.06 an image, $0.24 in all. PixelKiln refused to send these: Retro Diffusion quoted $0.06 for every size tried, above PixelKiln's offline estimate of $0.044 for 384×96, so the four were sent straight to the API with the same quote check. PixelKiln 0.138.1 plans every `rd_plus__` style at the flat $0.06, so it would send them now.
304
+ - **PixelLab** through PixelKiln, using pixflux, `view: side`, seed 4242, and one forced palette for every layer (the 44 colours of the step 4 volcano). The sky is 400×160 and opaque. The three layers are 400×100 with background removal, under pixflux's 40,000 px transparency limit. 4 generations.
305
+ - **Retro Diffusion** with `rd_plus__environment` and `tile_x`, seed 4242. The sky is 384×160 and the layers are 384×96 with `remove_bg`, at $0.06 an image, $0.24 in all. PixelKiln refused to send these at the time. Retro Diffusion quoted $0.06 for every size tried, above PixelKiln's offline estimate of $0.044 for 384×96, so we sent the four straight to the API with the same quote check. PixelKiln 0.138.1 plans every `rd_plus__` style at the flat $0.06, so it would send them now.
303
306
 
304
- The PixelLab layers were looped with step 2's crossfade, because pixflux has no seamless option. Both sets were stacked with their bottoms on rows 150, 175 and 200 of a 200 px canvas, and scrolled one way at 0.05, 0.25, 0.5 and 1.0 so every seam passes.
307
+ Pixflux has no seamless option, so we looped the PixelLab layers with step 2's crossfade. Both sets were stacked with their bottoms on rows 150, 175 and 200 of a 200 px canvas, and scrolled one way at 0.05, 0.25, 0.5 and 1.0 so every seam passes.
305
308
 
306
309
  **Result.**
307
310
 
308
- - **PixelLab** reads as one scene: same palette, same light, a clean cutout on all three layers (60 to 71% transparent). The far range came back as a flat two-colour silhouette, so it reads as a band of fog. The sky drew a mountain and hills along its bottom despite "no mountains".
309
- - **Retro Diffusion** does not. The environment style draws a whole scene whatever the prompt says: the sky has its own volcano and river, the far layer is a range with sky still on it, and the near layer is a wall. `tile_x` works on the drawing: the sky wraps with a seam no rougher than its inside (ratio 1.0). Background removal then breaks it: the near layer keeps ground on one side of the join and removes it on the other (seam ratio 3.9).
311
+ - **PixelLab reads as one scene.** Same palette, same light, and a clean cutout on all three layers (60 to 71% transparent). The far range came back as a flat two-colour silhouette, so it reads as a band of fog. The sky drew a mountain and hills along its bottom despite "no mountains".
312
+ - **Retro Diffusion does not.** The environment style draws a whole scene whatever the prompt says. The sky has its own volcano and river, the far layer is a range with sky still on it, and the near layer is a wall. `tile_x` does work on the drawing, and the sky wraps with a seam no rougher than its inside (ratio 1.0). Background removal then breaks it. The near layer keeps ground on one side of the join and removes it on the other (seam ratio 3.9).
310
313
 
311
- **Verdict.** Keep PixelLab pixflux with one forced palette for every layer: it is the cheapest route in this note and the layers agree. Retro Diffusion's environment style is a scene generator, not a layer generator; its `tile_x` is still the only hosted seamless option found, and would suit a sky or a layer that needs no background removal. Step 18 fixes the fog-band far range and the sky with mountains in it, and its pictures replace this step's.
314
+ **Verdict.** Keep PixelLab pixflux with one forced palette for every layer. It is the cheapest route in this note, and the layers agree. Retro Diffusion's environment style is a scene generator, not a layer generator. Its `tile_x` is still the only hosted seamless option we found, and would suit a sky or any layer that needs no background removal. Step 18 fixes the fog-band far range and the sky with mountains in it, and its pictures replace this step's.
312
315
 
313
316
  ## 16. A skyline from generated silhouettes
314
317
 
@@ -316,47 +319,47 @@ The PixelLab layers were looped with step 2's crossfade, because pixflux has no
316
319
 
317
320
  **Setup.** Three PixelLab pixflux silhouettes at 200×100, background removed, on the step 15 palette, with prompts in step 12's pattern: "a distant <landform>, fading to nothing at its foot, hazy dusk light as if seen from far away, no ground plane, no sky, isolated landform only". 3 generations. `parallax.py compose` laid them in runs at three times their size, with step 12's rates (0.6, 0.85, 0.92) and the camera panning north.
318
321
 
319
- **Result.** The landforms are usable and cut out cleanly, 44 to 73% transparent. None fades at the foot: pixel-art background removal gives a pixel either fully on or off, so each comes back with a hard dark base, a disc under the cone and a plateau under the mesa. In a run those bases read as a black band where step 12's game shows haze.
322
+ **Result.** The landforms are usable and cut out cleanly, 44 to 73% transparent. None fades at the foot. Pixel-art background removal leaves each pixel fully on or fully off, so each landform comes back with a hard dark base, a disc under the cone and a plateau under the mesa. In a run those bases read as a black band where step 12's game shows haze.
320
323
 
321
- **Verdict.** Keep the route. The faded foot has to come from somewhere else: a generator that returns soft alpha (the game's redraws came from Scenario), a dithered fade drawn afterwards, or a skirt and treeline in front, as step 12's game uses. Step 18 draws the dithered fade and finds the prompt that gives isolated landforms.
324
+ **Verdict.** Keep the route. The faded foot has to come from somewhere else. The options are a generator that returns soft alpha (the game's redraws came from Scenario), a dithered fade drawn afterwards, or a skirt and treeline in front, as step 12's game uses. Step 18 draws the dithered fade and finds the prompt that gives isolated landforms.
322
325
 
323
326
  ## 17. A model that splits a picture into layers
324
327
 
325
328
  **Question.** [Qwen-Image-Layered](https://github.com/QwenLM/Qwen-Image-Layered) is trained to break a picture into RGBA layers and fill in what each layer hides. Does it give depth bands, and does it run on a 12 GB card?
326
329
 
327
- **Setup.** ComfyUI 0.34 on an RTX 3060 (12 GB) with 32 GB of RAM, using the fp8 model (20.5 GB), the fp8 Qwen 2.5 VL 7B text encoder and the layered VAE: about 30 GB of downloads. The step 4 volcano, enlarged from 384 to 640 px by nearest neighbour, went through the official "Image to Layers" graph as an API workflow: euler, 50 steps, CFG 4.0, seed 42, a short description of the scene as the prompt. One run asked for 4 layers, one for 3.
330
+ **Setup.** ComfyUI 0.34 on an RTX 3060 (12 GB) with 32 GB of RAM, using the fp8 model (20.5 GB), the fp8 Qwen 2.5 VL 7B text encoder and the layered VAE, about 30 GB of downloads. We enlarged the step 4 volcano from 384 to 640 px by nearest neighbour and ran it through the official "Image to Layers" graph as an API workflow: euler, 50 steps, CFG 4.0, seed 42, a short description of the scene as the prompt. One run asked for 4 layers, one for 3.
328
331
 
329
332
  **Result.**
330
333
 
331
- - **It runs, slowly.** The model does not fit beside the desktop's own use of the card, so ComfyUI streams the weights from system RAM every step: about 40 s a step, 35 minutes for 4 layers and 42 for 3.
334
+ - **It runs, slowly.** The model does not fit beside the desktop's own use of the card, so ComfyUI streams the weights from system RAM every step. That is about 40 s a step, 35 minutes for 4 layers and 42 for 3.
332
335
  - **The split is sky against everything else.** In both runs the back layer is a flat near-white fill and one layer holds the sky and sun. A single layer holds the far range, the volcano and its plume, the near ridges and the lava. The 4-layer run spent its extra slot on a pink blob over the lower half that matches nothing in the scene. Nothing in front can move at a different speed from anything behind it.
333
- - **What it does well.** The sun behind the volcano is filled in on the sky layer, which is the work step 14 paid PixelLab to do. Stacked back to front, the layers rebuild the input to within 3.5 of 255 per channel on average.
334
- - **It is not pixel art afterwards.** The input has 44 colours; each layer has 22,000 to 50,000, and the scene layer's alpha is mostly 192 to 254 rather than fully opaque. Every layer would need snapping back to the palette and a hard alpha.
336
+ - **What it does well.** It fills in the sun behind the volcano on the sky layer, which is the work step 14 paid PixelLab to do. Stacked back to front, the layers rebuild the input to within 3.5 of 255 per channel on average.
337
+ - **It is not pixel art afterwards.** The input has 44 colours. Each layer has 22,000 to 50,000, and the scene layer's alpha is mostly 192 to 254 rather than fully opaque. Every layer would need snapping back to the palette and a hard alpha.
335
338
 
336
- Other prompts, seeds and the full-precision model were not tried. The model's documentation says the prompt does not choose what goes in each layer.
339
+ We did not try other prompts, other seeds or the full-precision model. The model's documentation says the prompt does not choose what goes in each layer.
337
340
 
338
- **Verdict.** Drop for parallax. It separates the objects a person would select, not the distances a camera would see, and a picture takes over half an hour on this card. Splitting by a depth map (steps 4 and 13) with inpainting (step 14) stays the route for a picture that has to be split.
341
+ **Verdict.** Drop for parallax. It separates the objects a person would select, not the distances a camera would see, and a picture takes over half an hour on this card. For a picture that has to be split, use a depth map (steps 4 and 13) with inpainting (step 14).
339
342
 
340
343
  ## 18. Refine the two routes that worked
341
344
 
342
- **Question.** Steps 12, 15 and 16 found two routes worth keeping, but their pictures were weak: silhouettes with hard dark bases, a far range that read as a band of fog, and a sky with mountains drawn into it. How good can they get with better prompts, a choice of candidates, and finishing by script?
345
+ **Question.** Steps 12, 15 and 16 found two routes worth keeping, but their pictures were weak. The silhouettes had hard dark bases, the far range read as a band of fog, and the sky had mountains drawn into it. How good can they get with better prompts, a choice of candidates, and finishing by script?
343
346
 
344
- **Setup.** Two biomes, each on one forced palette: volcanic dusk on the 44 colours of the step 4 volcano, and alpine dusk on the 38 colours of PixelLab's alpine valley A. Every asset was generated at three seeds (101, 202, 303) through PixelKiln: three silhouettes at 256×128 and three whole layers (far, middle, near) at 400×100, all pixflux with background removal and `view: side`. That is 36 generations. The silhouette retries cost 9 more volcanic and 6 more alpine, 51 in all. The manifests, lockfiles, preview specs and build script are in [`benchmarks/parallax-refined`](../benchmarks/parallax-refined). The sky is not generated: `parallax.py sky` draws six flat palette bands with a dithered step between neighbours.
347
+ **Setup.** Two biomes, each on one forced palette. Volcanic dusk uses the 44 colours of the step 4 volcano, and alpine dusk the 38 colours of PixelLab's alpine valley A. Every asset was generated through PixelKiln at three seeds (101, 202, 303): three silhouettes at 256×128 and three whole layers (far, middle, near) at 400×100, all pixflux with background removal and `view: side`. That is 36 generations. The silhouette retries cost 9 more volcanic and 6 more alpine, 51 in all. The manifests, lockfiles, preview specs and build script are in [`benchmarks/parallax-refined`](../benchmarks/parallax-refined). We did not generate the sky. `parallax.py sky` draws six flat palette bands with a dithered step between neighbours.
345
348
 
346
349
  **Result.**
347
350
 
348
- - **The prompt decides whether a silhouette is a sprite or a scene.** The first round used step 16's pattern: "distant", "hazy dusk light as if seen from far away", "fading to nothing at its foot". All nine volcanic silhouettes came back as small scenes, with ground, clouds or a moon. 14 of the 18 silhouettes over both biomes ran off the side of the canvas, and a glow asked for at a crater was drawn as a setting sun. The retry described one object as "a lone landform game sprite on a plain empty background", listed what must not be in the picture, asked for "about two thirds as wide as the picture", and left the distance and the glow out. All 15 retries came back as one isolated landform each, and 14 were clear of both sides; the fifteenth, a ridge, touched the right edge at its foot, where the dithered fade thins it out.
351
+ - **The prompt decides whether a silhouette is a sprite or a scene.** The first round used step 16's pattern, with "distant", "hazy dusk light as if seen from far away" and "fading to nothing at its foot". All nine volcanic silhouettes came back as small scenes, with ground, clouds or a moon. 14 of the 18 silhouettes over both biomes ran off the side of the canvas, and pixflux drew a glow asked for at a crater as a setting sun. The retry described one object as "a lone landform game sprite on a plain empty background", listed what must not be in the picture, asked for "about two thirds as wide as the picture", and left out the distance and the glow. All 15 retries came back as one isolated landform each, and 14 were clear of both sides. The fifteenth, a ridge, touched the right edge at its foot, where the dithered fade thins it out anyway.
349
352
 
350
353
  ![The same three landforms and seed: the scene-style prompt (top) and the sprite prompt (bottom)](../website/public/research/parallax/refined/prompt-compare.png)
351
354
 
352
- - **Whole layers came back usable on the first round.** Every far range was a flat one-colour band, which suits the farthest layer once it is recoloured. The alpine middle and near layers (sunlit peaks, a pine treeline) were good on every seed. Every volcanic middle layer was a single volcano, which repeats obviously, so the preview draws it once as a landmark instead of looping it.
353
- - **A dithered foot replaces soft alpha.** `parallax.py foot` trims a silhouette and thins its bottom 30% with a 4×4 ordered dither, so it dissolves into whatever is behind it and stays pixel art.
355
+ - **Whole layers came back usable on the first round.** Every far range was a flat one-colour band, which suits the farthest layer once it is recoloured. The alpine middle and near layers (sunlit peaks, a pine treeline) were good on every seed. Every volcanic middle layer was a single volcano. Looped, it would repeat obviously, so the preview draws it once as a landmark.
356
+ - **A dithered foot replaces soft alpha.** `parallax.py foot` trims a silhouette and thins its bottom 30% with a 4×4 ordered dither. The foot dissolves into whatever is behind it and stays pixel art.
354
357
 
355
358
  ![One landform: as generated, with the dithered foot, then the far-tier and near-tier copies](../website/public/research/parallax/refined/foot-and-tiers.png)
356
359
 
357
- - **Each tier needs its own tint target.** `parallax.py tint` mixes a picture toward a colour and snaps it to the biome palette. Tinting both tiers toward one light haze colour made the near tier lighter than the far range behind it, so depth read backwards. Pulling the far tier toward a mid violet and the near tier toward a dark one gives the right order: far range lightest, near layer darkest.
358
- - **A sparse palette flattens a pale tint.** The alpine palette has few pale colours, so snow tinted toward the haze snapped to two or three colours. The alpine near tier keeps its snow at a light tint (0.2) instead.
359
- - **The far range is extended down, not floated.** Repeating the far range's bottom row to the foot of the view gives the tiers' dithered feet distant land to dissolve into. A flat haze band in its place read as a separate rectangle.
360
+ - **Each tier needs its own tint target.** `parallax.py tint` mixes a picture toward a colour and snaps it to the biome palette. Tinting both tiers toward one light haze colour made the near tier lighter than the far range behind it, so depth read backwards. Pulling the far tier toward a mid violet and the near tier toward a dark one gives the right order, with the far range lightest and the near layer darkest.
361
+ - **A sparse palette flattens a pale tint.** The alpine palette has few pale colours, so snow tinted toward the haze snapped to two or three colours. The alpine near tier keeps its snow with a light tint (0.2) instead.
362
+ - **Extend the far range down instead of floating it.** Repeating the far range's bottom row to the foot of the view gives the tiers' dithered feet distant land to dissolve into. A flat haze band in its place read as a separate rectangle.
360
363
 
361
364
  ![Volcanic dusk from whole layers: a far range, a volcano drawn once, near ridges](../website/public/research/parallax/refined/volcanic/layers.webp)
362
365
 
@@ -364,11 +367,44 @@ Other prompts, seeds and the full-precision model were not tried. The model's do
364
367
 
365
368
  The four previews scroll the whole stack 480 px and back at 0, 1/8, 1/4, 1/2 and 1 of the camera's speed. They are lossless animated WebP, about 1.1 MB each against 2.3 to 3.2 MB as GIF.
366
369
 
367
- **Verdict.** Keep both routes, finished this way. Generate silhouettes as sprites, never as distant scenery, and add the distance afterwards with a palette-held tint per tier. Draw the sky. Take two or three seeds of everything: 15 of the 51 candidates made it into the previews, and none from the first silhouette round. The [parallax guide](./PARALLAX.md) walks through it.
370
+ **Verdict.** Keep both routes, finished this way. Generate silhouettes as sprites, never as distant scenery, and add the distance afterwards with a palette-held tint per tier. Draw the sky yourself. Take two or three seeds of everything. Only 15 of the 51 candidates made it into the previews, and none came from the first silhouette round. The [parallax guide](./PARALLAX.md) walks through it.
371
+
372
+ ## 19. Scroll vertically
373
+
374
+ **Question.** Every step so far moves the camera sideways, apart from step 12's pan north. A platformer's camera also rises and falls, and a climbing level or a vertical shooter scrolls up the whole time. What changes when the camera climbs?
375
+
376
+ **Setup.** `parallax.py climb` is a vertical preview. Each layer has its own vertical speed, and the camera climbs and comes back down, eased and rounded to whole pixels first (step 10). Three tests, with the manifests, lockfiles, preview specs and build script in [`benchmarks/parallax-vertical`](../benchmarks/parallax-vertical):
377
+
378
+ - **Free.** Step 18's alpine whole layers, climbing 240 px in a 256×240 view.
379
+ - **A climb set** on the alpine palette. PixelLab pixflux with background removal at seeds 101, 202 and 303: a tall massif (200×200), puffy clouds (160×96), thin cloud streaks (192×48) and a cliff (128×304), then two flat cloud banks (256×64) as a retry. 14 generations, one of which failed. The preview climbs 480 px in a 240×256 view.
380
+ - **A loop for a vertical shooter.** Retro Diffusion `rd_plus__default` with `tile_y` and no background removal: a 192×384 sky and a 128×384 cliff, $0.12.
381
+
382
+ **Result.**
383
+
384
+ - **Sideways strips run out.** Step 18's layers are 100 px tall and made to be seen from one height. On the free climb the treeline drops out of the view within the first quarter, and the far range, extended down as step 18 does, becomes a flat lilac block filling the lower half of the view. A climb needs layers drawn tall, or things placed at height for the camera to pass.
385
+ - **Every layer needs headroom of climb × its vertical speed.** A layer has to be drawn the view's height plus that many rows above it. On the 480 px climb that is 48 rows for the far range at 0.1, 96 for the massif at 0.2, 192 for the far clouds at 0.4, 480 for the wall at 1.0 and 624 for the foreground clouds at 1.3. It is step 12's rule for a bounded level turned on its side: extend each layer by the most it can drift. Placed for the lowest view, the layers only move down the screen as the camera climbs, so nothing under a layer is ever uncovered. A camera that drops below that view uncovers their feet, which is why step 12 anchors at the southernmost view.
386
+ - **A sky that changes with height has to move.** A sky at infinity, speed 0, looks the same however high the camera goes. Scrolling the sky's bands at 0.3 of the climb walks the view from dusk at the horizon through blue to night at the top, where the script scatters single-pixel stars over the top third.
387
+ - **Clouds work as puffy sprites, not as flat ones.** All three puffy clouds came back isolated and usable on the sprite prompt from step 18. The thin streaks and flat banks did not: four of four came back as a small mound, a one-pixel line, or a bank with a yellow sun rising out of it. Two of the three massifs ignored "no clouds" and came with clouds attached. The third, a tall peak cut off by the right and bottom edges, is the one used, with its cut left edge hidden behind the wall. Placed one per height band up the climb, the clouds give the camera something to pass at every height: tinted toward the haze at 0.4, and as generated at 1.3, in front of the wall.
388
+
389
+ ![The candidates: three massifs, a cloud bank (top), three puffy clouds and a cloud streak (bottom)](../website/public/research/parallax/vertical/candidates.png)
390
+
391
+ - **A cliff comes back as a pillar with a top, which is what a climb needs.** None of the three cliffs filled the picture from top to bottom as asked; each has a summit. `parallax.py wall` keeps the summit, finds the two rows where the body best loops (step 2's cut turned on its side) and repeats the body below. The seam ratios are 2.8 to 8.3. On cliff b, whose ledges are far apart, the join is hard to find. On the other two a repeated ledge of trees or a horizontal line gives it away.
392
+
393
+ ![Three cliffs as generated, and cliff b stacked into a 700-row wall](../website/public/research/parallax/vertical/walls.png)
394
+
395
+ ![A climb: a wall stacked from cliff b, a massif drawn once, clouds at two speeds, and a sky that moves](../website/public/research/parallax/vertical/climb.webp)
396
+
397
+ - **Retro Diffusion's `tile_y` works on `rd_plus__default`.** Stacked on themselves, the cliff joins with a seam ratio of 1.1 and the sky 1.9. Sideways the same pictures are not seamless (6.4 and 10.0), as expected. The sky is in Retro Diffusion's own violets. Snapped to the alpine palette it kept 5 of its 47 colours and turned blotchy, so the loop keeps the sky as generated and snaps the PixelLab clouds to the sky's colours instead.
398
+
399
+ ![A vertical shooter's loop: Retro Diffusion's tile_y sky at half speed, clouds at full speed](../website/public/research/parallax/vertical/loop.webp)
400
+
401
+ The engine settings carry over from step 11 on the other axis. Tiled has `parallaxy`, and `repeaty` on an image layer. Godot's `Parallax2D` takes the y of `scroll_scale` and `repeat_size`. Phaser's `setScrollFactor(x, y)` takes both. LDtk's `getParallaxOffsetY` is the same formula as x with `parallaxFactorY`, so write 1 − speed there too. Its shrink follows only `parallaxFactorX`, so a layer with only a vertical factor never shrinks.
402
+
403
+ **Verdict.** Keep. A vertical level needs tall layers or things placed at height, a sky that moves, and headroom of climb × vertical speed on every layer, placed for the lowest view. Generate clouds as puffy sprites and a cliff as a pillar, then stack the pillar's body into the wall. For a background that scrolls up forever, Retro Diffusion's `tile_y` is the one generator option that wraps vertically; keep the rest of the set on its colours.
368
404
 
369
405
  ## A proposal for PixelKiln
370
406
 
371
- Research only; nothing here is built.
407
+ Research only. Nothing here is built.
372
408
 
373
409
  **A parallax set in the manifest.** A set names its layers in order, far to near, and what they share:
374
410
 
@@ -388,21 +424,21 @@ Research only; nothing here is built.
388
424
  }
389
425
  ```
390
426
 
391
- `speed` is the fraction of the camera's movement, the convention of Tiled, Godot and Phaser, so it is what a person would type. `bottom` places a layer on a shared canvas. `haze` is step 9's push toward the sky colour, done after generation with the palette held. The assets are ordinary manifest assets, so planning, budgets, the lockfile and review work as they do today. A silhouette set (step 12) would be the same shape with runs instead of single layers.
427
+ `speed` is the fraction of the camera's movement. That is the convention of Tiled, Godot and Phaser, so it is what a person would type. `bottom` places a layer on a shared canvas. `haze` is step 9's push toward the sky colour, applied after generation with the palette held. The assets are ordinary manifest assets, so planning, budgets, the lockfile and review work as they do today. A silhouette set (step 12) would have the same shape, with runs instead of single layers.
392
428
 
393
429
  **Export.**
394
430
 
395
- - **Tiled** fits best: an image layer per parallax layer, with `parallaxx` set to the speed and `repeatx` for a looping layer.
396
- - **Godot**: a `Parallax2D` per layer, `scroll_scale` set to the speed and `repeat_size` to the width.
431
+ - **Tiled** fits best. Each parallax layer becomes an image layer, with `parallaxx` set to the speed and `repeatx` for a looping layer.
432
+ - **Godot** gets a `Parallax2D` per layer, with `scroll_scale` set to the speed and `repeat_size` to the width.
397
433
  - **LDtk** has no image layer. Each layer would be a Tiles layer over a tileset cut from the layer's picture, with `parallaxFactorX` written as 1 − speed and `parallaxScaling: false` (step 11).
398
434
 
399
- **A preview.** `parallax.py scroll` and `compose` already show a set moving. A `pixelkiln parallax preview` that writes the same GIF would let a person judge a set before export.
435
+ **A preview.** `parallax.py scroll` and `compose` already show a set moving. A `pixelkiln parallax preview` that writes the same animation would let a person judge a set before export.
400
436
 
401
437
  ## What other people are doing
402
438
 
403
- - **Layered generation models.** [LayerDiffuse](https://arxiv.org/abs/2402.17113) (Apache-2.0) adds transparency to latent diffusion models and can generate several layers of one scene together. [Qwen-Image-Layered](https://github.com/QwenLM/Qwen-Image-Layered) (Apache-2.0, December 2025) decomposes a picture into a chosen number of RGBA layers, at 640 or 1024 px buckets; ComfyUI ships it with an fp8 variant because the default needs a lot of VRAM ([ComfyUI docs](https://docs.comfy.org/tutorials/image/qwen/qwen-image-layered)). Neither was trained on pixel art. Step 17 ran Qwen-Image-Layered on a 12 GB card: it works, slowly, and splits sky from scene rather than by distance. LayerDiffuse is untried.
404
- - **Seamless generation.** Circular padding in the convolutional layers makes a diffusion model's output wrap; ComfyUI has nodes for it, including X-only tiling ([ComfyUI-seamless-tiling](https://github.com/spinagon/ComfyUI-seamless-tiling)). It works on U-Net models such as SDXL and reportedly not on transformer models (unverified). The other route is to shift the picture by half its width and inpaint the seam.
405
- - **Providers.** Retro Diffusion's API takes `tile_x` and `tile_y` booleans for seamless output and `remove_bg` for transparency ([api-examples](https://github.com/Retro-Diffusion/api-examples)); PixelKiln already exposes them as `tileX` and `tileY` ([Retro Diffusion](./RETRO_DIFFUSION.md)). Which styles honour them is unverified. PixelLab's v2 API has no parallax or seamless option that was found; pixflux offers a transparent background, a forced palette and an init image, up to 400×400 ([API](https://api.pixellab.ai/v2/llms.txt)). Scenario's tiling options are texture tools rather than scene tools ([help](https://help.scenario.com/articles/3312894507-scenario-texture-the-essentials)).
439
+ - **Layered generation models.** [LayerDiffuse](https://arxiv.org/abs/2402.17113) (Apache-2.0) adds transparency to latent diffusion models and can generate several layers of one scene together. [Qwen-Image-Layered](https://github.com/QwenLM/Qwen-Image-Layered) (Apache-2.0, December 2025) breaks a picture into a chosen number of RGBA layers, at 640 or 1024 px buckets. ComfyUI ships it with an fp8 variant because the default needs a lot of VRAM ([ComfyUI docs](https://docs.comfy.org/tutorials/image/qwen/qwen-image-layered)). Neither was trained on pixel art. Step 17 ran Qwen-Image-Layered on a 12 GB card. It works, slowly, and splits sky from scene rather than by distance. LayerDiffuse is untried.
440
+ - **Seamless generation.** Circular padding in the convolutional layers makes a diffusion model's output wrap, and ComfyUI has nodes for it, including X-only tiling ([ComfyUI-seamless-tiling](https://github.com/spinagon/ComfyUI-seamless-tiling)). It works on U-Net models such as SDXL. Reports say it does not work on transformer models; we have not checked. The other route is to shift the picture by half its width and inpaint the seam.
441
+ - **Providers.** Retro Diffusion's API takes `tile_x` and `tile_y` booleans for seamless output and `remove_bg` for transparency ([api-examples](https://github.com/Retro-Diffusion/api-examples)). PixelKiln already exposes them as `tileX` and `tileY` ([Retro Diffusion](./RETRO_DIFFUSION.md)). `rd_plus__environment` honours `tile_x` (step 15) and `rd_plus__default` honours `tile_y` (step 19). We have not checked the other styles. We found no parallax or seamless option in PixelLab's v2 API. Pixflux offers a transparent background, a forced palette and an init image, up to 400×400 ([API](https://api.pixellab.ai/v2/llms.txt)). Scenario's tiling options are texture tools rather than scene tools ([help](https://help.scenario.com/articles/3312894507-scenario-texture-the-essentials)).
406
442
  - **Classic hardware.** The Mega Drive has two scrolling planes with per-line scroll tables ([RasterScroll](https://rasterscroll.com/mdgraphics/graphical-effects/row-column-scrolling/)). Games such as *Thunder Force IV* fake many layers from them by scrolling groups of lines at different speeds.
407
443
 
408
444
  ## What has not worked
@@ -416,17 +452,20 @@ Research only; nothing here is built.
416
452
  - Qwen-Image-Layered as a depth splitter (step 17).
417
453
  - Describing a silhouette as distant or hazy in the prompt (step 18). Pixflux paints a scene around it.
418
454
  - Tinting every tier toward one light haze colour (step 18). Depth reads backwards.
455
+ - Sideways strips for a climb (step 19). The far range's extension ends up filling half the view.
456
+ - Thin or flat clouds from pixflux (step 19). Four of four came back as a mound, a line, or a bank with a sun in it.
457
+ - Snapping a generated sky to a palette with few of its colours (step 19). It kept 5 of 47 and turned blotchy.
419
458
 
420
459
  ## What is next
421
460
 
422
461
  - **Build the proposal** above: the manifest shape, a preview, and Tiled, Godot and LDtk export. Open the LDtk result in the editor to check the factor's direction.
423
- - **Check the finished sets in an engine.** Step 18's previews come from the script; neither set has been placed in Tiled, Godot or Phaser.
462
+ - **Check the finished sets in an engine.** The previews in steps 18 and 19 come from the script. No set has been placed in Tiled, Godot or Phaser.
424
463
  - **A second time of day** on one biome's palette, to see whether a forced palette keeps sets consistent across a day.
425
- - **Retro Diffusion `tile_x` without background removal** on each layer, with the background keyed out afterwards so the seam survives.
464
+ - **Retro Diffusion `tile_x` without background removal** on each layer, keying the background out afterwards so the seam survives.
426
465
 
427
466
  ## Running the scripts
428
467
 
429
- They need numpy, pillow and scipy; `depth.py` also needs torch and transformers.
468
+ They need numpy, pillow and scipy. `depth.py` also needs torch and transformers.
430
469
 
431
470
  ```bash
432
471
  # How badly each picture wraps.
@@ -480,4 +519,13 @@ STILL=<first-frame.png> SCALE=2 python3 research/scripts/parallax.py skyline <ou
480
519
 
481
520
  # Everything for step 18 at once.
482
521
  sh benchmarks/parallax-refined/build.sh
522
+
523
+ # Step 19. Stack a cliff into a wall 700 rows tall, keeping its top 100 rows as the summit.
524
+ python3 research/scripts/parallax.py wall <cliff.png> <out.png> 700 100
525
+
526
+ # Vertical preview: the camera climbs through the layers and back; .webp or .gif.
527
+ STILL=<strip.png> SCALE=2 python3 research/scripts/parallax.py climb <out.webp> <spec.json>
528
+
529
+ # Everything for step 19 at once.
530
+ sh benchmarks/parallax-vertical/build.sh
483
531
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelkiln",
3
- "version": "0.139.1",
3
+ "version": "0.139.2",
4
4
  "description": "Manifest-driven pixel-art generation, review, recovery, and packaging with deterministic provenance.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -157,8 +157,9 @@ Read only the reference needed for the current decision:
157
157
  read [references/tiles.md](references/tiles.md). It covers which generator
158
158
  to pick, how sets connect, every export format and what it refuses, and
159
159
  what has and has not been checked in an engine.
160
- - For a scrolling background in layers, looping a background sideways, or
161
- parallax settings for Tiled, Godot, Phaser or LDtk, read
160
+ - For a scrolling background in layers, looping a background sideways or
161
+ vertically, a climbing level's background, or parallax settings for Tiled,
162
+ Godot, Phaser or LDtk, read
162
163
  [references/parallax.md](references/parallax.md).
163
164
  - For Retro Diffusion styles, USD budgets, environment assets, animation, or
164
165
  experimental limits, read
@@ -8,9 +8,9 @@ and numbers, at https://pixelkiln.griffen.codes/docs/research-parallax.
8
8
  ## The route to try first
9
9
 
10
10
  Compose each layer in the engine from separate silhouettes rather than cutting
11
- layers out of one scene. Generate a few distant landforms per biome, one at a
12
- time, each "fading to nothing at its foot, no ground plane, no sky, isolated
13
- landform only, transparent background". In the game, lay them in overlapping
11
+ layers out of one scene. Generate a few landforms per biome, one at a time,
12
+ each prompted as a lone sprite (see "Generating silhouettes" below), and dither
13
+ the foot out afterwards. In the game, lay them in overlapping
14
14
  runs (each next one about 72% of the way across the last, random flips, never
15
15
  the same twice in a row, a few pixels of jitter), in two tiers tinted toward a
16
16
  dusk or haze colour, over a sky the engine draws. Nothing hidden has to be
@@ -57,6 +57,25 @@ this; its numbers are in step 12 of the research note.
57
57
  to fade at its foot comes back with a hard base. Plan a dithered fade, a
58
58
  ground strip or a treeline in front.
59
59
 
60
+ ## Scrolling vertically
61
+
62
+ - A climb needs tall layers or things placed at height: a tall landmark,
63
+ clouds scattered up the climb, a wall. 400×100 strips run out within a
64
+ quarter of a climb.
65
+ - Draw every layer the view's height plus climb × its vertical speed tall, and
66
+ place the layers for the lowest view so a climb never uncovers their feet.
67
+ - Scroll the sky's bands vertically (about 0.3) if it should change with
68
+ height; at speed 0 it never does.
69
+ - Clouds: prompt puffy cumulus as a lone sprite. Thin streaks and flat banks
70
+ fail in pixflux.
71
+ - A wall: pixflux draws a cliff as a pillar with a summit. Keep the summit and
72
+ repeat the body (`parallax.py wall`).
73
+ - An endless vertical loop: Retro Diffusion `tileY` on `rd_plus__default`, no
74
+ background removal. Keep the rest of the set on that picture's colours.
75
+ - Engines take the y of the same setting: Tiled `parallaxy`, Godot
76
+ `scroll_scale.y`, Phaser `setScrollFactor(x, y)`, LDtk `parallaxFactorY` as
77
+ 1 − speed.
78
+
60
79
  ## Before generating
61
80
 
62
81
  - A parallax background is several layers, not one scene. A single scenic