pixelkiln 0.139.0 → 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/PROVIDERS.md CHANGED
@@ -143,8 +143,9 @@ For a production environment, build a kit: seamless terrain, separate
143
143
  landmarks and buildings, foreground occluders, and a distant backdrop. You can
144
144
  rerun one weak piece, set collision per object, and move layers independently
145
145
  for parallax. Generate each piece at its native pixel resolution, then use
146
- integer nearest-neighbor scaling. The [parallax research note](./docs/RESEARCH_PARALLAX.md) covers
147
- looping, splitting a flat picture by depth, and engine settings.
146
+ integer nearest-neighbor scaling. The [parallax guide](./docs/PARALLAX.md) builds a
147
+ layered background step by step, and the [research note](./docs/RESEARCH_PARALLAX.md)
148
+ covers looping, splitting a flat picture by depth, and engine settings.
148
149
 
149
150
  A visual benchmark should use the same briefs for an isolated building, a
150
151
  top-down landmark, and a full scenic background. Use the same intended native
@@ -0,0 +1,344 @@
1
+ # Parallax backgrounds
2
+
3
+ A parallax background is a stack of layers that scroll at different speeds as
4
+ the camera moves. PixelKiln has no parallax command yet, so this guide builds
5
+ one from ordinary manifest assets and a free script. Everything below was run
6
+ to make the pictures on this page: two biomes, 51 PixelLab generations in all,
7
+ including the retries, and a climb for a camera that scrolls up. The evidence behind each choice is in the
8
+ [research note](./RESEARCH_PARALLAX.md).
9
+
10
+ ![Volcanic dusk, built from separate silhouettes](../website/public/research/parallax/refined/volcanic/silhouettes.webp)
11
+
12
+ ![Alpine dusk, built from whole layers](../website/public/research/parallax/refined/alpine/layers.webp)
13
+
14
+ ## Pick a route
15
+
16
+ Both routes start the same way, with one palette and a pixflux style. They
17
+ differ in what you generate.
18
+
19
+ | Route | What you generate | Best for |
20
+ |---|---|---|
21
+ | Silhouettes | Four or five isolated landforms a biome, each about 240 px wide. The game lays them in overlapping runs. | Levels wider than any picture. No layer needs to loop, and the runs never repeat exactly. |
22
+ | Whole layers | A far range, a middle layer and a near layer, each 400×100, looped afterwards. | The fewest steps. A short level, a title screen, a menu. |
23
+
24
+ The two mix well. Both pictures above use a whole far range and a whole near
25
+ layer; the volcanic one puts two runs of silhouettes between them.
26
+
27
+ The sky is not generated in either route. It is a few flat bands of palette
28
+ colours, drawn by the script or by the engine. Hosted generators draw
29
+ mountains and suns into a sky whatever the prompt says.
30
+
31
+ ## 1. Choose one palette
32
+
33
+ Every layer uses the same forced `palette`. It is the single setting that
34
+ makes separately generated layers look like one scene. The easiest source is
35
+ a picture you already like: its colours, 30 to 50 of them, become the palette.
36
+ The volcanic set uses the 44 colours of a PixelLab volcano; the alpine set uses
37
+ the 38 colours of a PixelLab mountain valley.
38
+
39
+ Check the palette has pale colours as well as dark ones. A tier is pushed
40
+ toward the sky by mixing its colours and snapping the result back to the
41
+ palette (step 5). A palette with few pale colours flattens a tinted tier into
42
+ one or two colours.
43
+
44
+ ## 2. Write the manifest
45
+
46
+ One pixflux style per seed, with background removal, `view: side` and the
47
+ palette. Listing several styles on an asset gives several candidates of it,
48
+ one per seed, so you can keep the best.
49
+
50
+ ```jsonc
51
+ {
52
+ "name": "my-game",
53
+ "provider": "pixellab",
54
+ "styles": {
55
+ "parallax-a": {
56
+ "generator": "pixflux",
57
+ "noBackground": true,
58
+ "view": "side",
59
+ "seed": 101,
60
+ "palette": ["#050a14", "#2e3253", "#7b5f94", "..."],
61
+ "outDir": "assets/parallax/volcanic/a"
62
+ },
63
+ "parallax-b": {
64
+ "generator": "pixflux",
65
+ "noBackground": true,
66
+ "view": "side",
67
+ "seed": 202,
68
+ "palette": ["#050a14", "#2e3253", "#7b5f94", "..."],
69
+ "outDir": "assets/parallax/volcanic/b"
70
+ }
71
+ },
72
+ "assets": {
73
+ "landform-cone": {
74
+ "prompt": "a single dark basalt volcanic cone, muted violet, low contrast, simple shading, about two thirds as wide as the picture, its slopes flare out to a flat base, a lone landform game sprite on a plain empty background, nothing else in the picture: no clouds, no moon, no sun, no hills or ground around it, side view, transparent background",
75
+ "width": 256,
76
+ "height": 128,
77
+ "styles": ["parallax-a", "parallax-b"]
78
+ },
79
+ "layer-near": {
80
+ "prompt": "dark jagged volcanic hills close to the viewer, uneven heights and irregular shapes, a few glowing lava cracks, nearly black, spans the full width, flat bottom edge, no sky, no ground plane, side view, transparent background",
81
+ "width": 400,
82
+ "height": 100,
83
+ "styles": ["parallax-a", "parallax-b"]
84
+ }
85
+ }
86
+ }
87
+ ```
88
+
89
+ The complete manifests for both biomes are in
90
+ [`benchmarks/parallax-refined`](../benchmarks/parallax-refined).
91
+
92
+ Keep transparent pixflux pictures at 40,000 px or less (400×100, 256×128).
93
+ Larger ones come back with their background.
94
+
95
+ ### Prompts that work
96
+
97
+ For a silhouette, describe one object as a game sprite and list what must not
98
+ be in the picture. Leave the distance out of the prompt: the haze comes later,
99
+ from the palette.
100
+
101
+ - Use "a lone landform game sprite on a plain empty background, nothing else in
102
+ the picture: no clouds, no moon, no sun, no hills or ground around it".
103
+ - Use "about two thirds as wide as the picture" so it does not run off the
104
+ sides.
105
+ - Avoid "distant", "seen from far away", "hazy dusk light" and "fading to
106
+ nothing at its foot". They make pixflux paint a whole scene. In the first
107
+ round, every volcanic silhouette asked for that way came back with ground,
108
+ clouds or a moon, and 14 of 18 silhouettes ran off the canvas.
109
+ - Avoid a glow at a crater's top. Pixflux draws it as a setting sun.
110
+
111
+ ![The same three landforms and seed: the scene-style prompt (top) and the sprite prompt (bottom)](../website/public/research/parallax/refined/prompt-compare.png)
112
+
113
+ For a whole layer, ask for the full width and a flat bottom edge. A far range
114
+ comes back as a flat single-colour band, which is right for the farthest layer;
115
+ it is recoloured in step 5.
116
+
117
+ ## 3. Plan and generate
118
+
119
+ ```bash
120
+ pixelkiln plan
121
+ pixelkiln gen --budget pixellab=18
122
+ ```
123
+
124
+ `plan` lists one generation an image at these sizes. Three seeds of six assets
125
+ is 18 generations a biome. Plan for a retry round: the alpine and volcanic sets
126
+ each needed one.
127
+
128
+ ## 4. Keep the best candidate
129
+
130
+ Look at every candidate on a plain colour, then reject the ones that break the
131
+ stack:
132
+
133
+ - A silhouette that touches the left or right edge. Its cut-off side shows as a
134
+ straight vertical line in a run.
135
+ - Anything with a horizon line, a reflection, clouds or a moon in it.
136
+ - A whole layer that does not span the width. It leaves gaps when it repeats.
137
+ - A middle layer that is one landmark, such as a single volcano. It is fine,
138
+ but draw it once instead of looping it (step 6), or the repeat is obvious.
139
+
140
+ The script prints the numbers for the first check:
141
+
142
+ ```bash
143
+ python3 research/scripts/parallax.py screen assets/parallax/volcanic/*/landform-*.png
144
+ ```
145
+
146
+ `edge 0.00/0.00` means nothing touches either side. The script needs numpy,
147
+ pillow and scipy.
148
+
149
+ ## 5. Finish the pieces
150
+
151
+ All of these are free and keep every pixel on the palette.
152
+
153
+ ```bash
154
+ P="python3 research/scripts/parallax.py"
155
+
156
+ # Silhouettes: trim, then thin out the bottom 30% with an ordered dither.
157
+ $P foot cone.png cone.foot.png 0.3
158
+
159
+ # One copy a tier, each pulled toward its own colour and snapped to the palette.
160
+ $P tint cone.foot.png cone.far.png "#7f4776" 0.55 pixelkiln.manifest.json
161
+ $P tint cone.foot.png cone.near.png "#403a61" 0.4 pixelkiln.manifest.json
162
+
163
+ # Whole layers: loop at the best matching columns. Recolour the flat far range.
164
+ $P loop layer-far.png far.png cut
165
+ $P tint far.png far.png "#936090" 1 pixelkiln.manifest.json
166
+ $P loop layer-near.png near.png cut
167
+ ```
168
+
169
+ ![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)
170
+
171
+ **The dithered foot.** Background removal leaves every pixel fully on or off,
172
+ so a silhouette cannot fade by alpha. Thinning its bottom rows with a 4×4
173
+ pattern makes it dissolve into whatever is behind it and keeps it pixel art.
174
+
175
+ **Depth order.** The farther a layer, the closer to the sky's colour and the
176
+ lower its contrast. Check the order from back to front: the far range lightest,
177
+ then the far tier, the near tier, and the near layer darkest. Snow can stay
178
+ bright on a near tier, as long as its shadows are darker than the range behind
179
+ it. Tinting every tier toward one light haze colour gets the order backwards:
180
+ the near tier ends up lighter than the range behind it.
181
+
182
+ **The far range.** Pick a palette colour that sits between the sky bands behind
183
+ it, darker than the horizon and lighter than the tiers.
184
+
185
+ ## 6. Preview the stack
186
+
187
+ The script draws the sky and scrolls the whole stack, from a small JSON file:
188
+
189
+ ```jsonc
190
+ {
191
+ "view": [384, 216],
192
+ "sky": ["#2e3253", "#503e68", "#7b5f94", "#ad628e", "#d66283", "#f96076"],
193
+ "seed": 7,
194
+ "frames": 120,
195
+ "travel": 480,
196
+ "layers": [
197
+ { "image": "far.png", "bottom": 150, "speed": 0.125, "extend": true },
198
+ { "run": ["cone.far.png", "rim.far.png", "mesa.far.png"], "foot": 158, "speed": 0.25 },
199
+ { "run": ["cone.near.png", "rim.near.png", "mesa.near.png"], "foot": 176, "speed": 0.5 },
200
+ { "fill": "#0e0c20", "top": 206, "speed": 1 },
201
+ { "image": "near.png", "bottom": 246, "speed": 1 }
202
+ ]
203
+ }
204
+ ```
205
+
206
+ ```bash
207
+ STILL=still.png SCALE=2 python3 research/scripts/parallax.py skyline preview.webp stack.json
208
+ ```
209
+
210
+ - `extend` on the far range repeats its bottom row to the foot of the view, so
211
+ the tiers' dithered feet dissolve into distant land, not into sky.
212
+ - A run lays its sprites left to right, each starting 72% of the way across
213
+ the last, flipped at random and never the same one twice in a row.
214
+ - An image with `"repeat": false` and an `x` is drawn once: use it for a
215
+ landmark.
216
+ - The camera pans `travel` pixels and back. Watch the far end of the pan for
217
+ seams, floating feet and gaps under the near layer.
218
+
219
+ The specs and the build script for both biomes are in
220
+ [`benchmarks/parallax-refined`](../benchmarks/parallax-refined).
221
+
222
+ ## 7. Put it in the engine
223
+
224
+ Speed is the fraction of the camera's movement a layer follows. The previews
225
+ use 0 for the sky, 1/8 for the far range, 1/4 and 1/2 for the two tiers, and 1
226
+ for the near layer.
227
+
228
+ - Round the camera to whole pixels first, then take each layer's offset from
229
+ that rounded position. Rounding each layer on its own moves layers while the
230
+ camera stands still.
231
+ - Prefer simple fractions (1/2, 1/4, 1/8). They step on an even rhythm; 0.3 or
232
+ 0.6 do not.
233
+ - Keep the tiers' speeds close together. A wide spread opens bands of sky
234
+ between them.
235
+ - A bounded level needs no loop. Lay each run past both ends of the level by
236
+ the most that layer can drift.
237
+
238
+ The same layer at a quarter of the camera's speed in each tool:
239
+
240
+ | Tool | Setting |
241
+ |---|---|
242
+ | Tiled | `parallaxx: 0.25` |
243
+ | Godot 4 | `Parallax2D.scroll_scale = Vector2(0.25, 1)` |
244
+ | Phaser 3 | `setScrollFactor(0.25, 1)` |
245
+ | LDtk | `parallaxFactorX: 0.75` with `parallaxScaling: false` |
246
+
247
+ LDtk counts the other way: its factor is how much the layer follows the
248
+ camera, so write 1 − speed. With `parallaxScaling` on it also shrinks a far
249
+ layer off the pixel grid. PixelKiln's LDtk export writes factor 0 today.
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
+
336
+ ## What this guide does not cover
337
+
338
+ - Splitting a finished scene into layers. A depth model and inpainting can do
339
+ it, at 10 to 25 PixelLab generations a layer for the fill; see steps 4, 13
340
+ and 14 of the [research note](./RESEARCH_PARALLAX.md).
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.
344
+ - A `pixelkiln parallax` command. The research note sketches one.
package/docs/README.md CHANGED
@@ -29,7 +29,8 @@ 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
- | [Research: parallax backgrounds](./RESEARCH_PARALLAX.md) | Ways to build a scrolling background in depth and to get its layers out of a generator, tested on the benchmark backgrounds. Research, not a feature. |
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
+ | [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. |
33
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. |
34
35
  | [Derived artifacts](./ARTIFACTS.md) | Refine, pack, mount, and export; provenance, approval gates, ownership, and crash recovery. |
35
36
  | [Recovery and account safety](./RECOVERY.md) | Restore, caches, adopt, salvage, cross-project claims, tagging, and confirmed purge. |
@@ -1,62 +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.
3
+ This is a research note, not a feature. Nothing here is a PixelKiln command, and the scripts are rough.
4
4
 
5
- Last updated 23 November 2026.
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.
8
+
9
+ ![Volcanic dusk from separate silhouettes (step 18)](../website/public/research/parallax/refined/volcanic/silhouettes.webp)
10
+
11
+ ![Alpine dusk from whole layers (step 18)](../website/public/research/parallax/refined/alpine/layers.webp)
12
+
13
+ Last updated 24 November 2026.
6
14
 
7
15
  ## Summary
8
16
 
9
17
  | # | Approach | Tool or model | Result | Verdict |
10
18
  |---|---|---|---|---|
11
- | 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. |
12
- | 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. |
13
- | 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. |
14
- | 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. |
15
- | 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). |
16
- | 6 | Grow each near layer upward | Our script | The stray outline lines are gone; the plume fault stays | Keep. |
17
- | 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. |
18
- | 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). |
19
27
  | 9 | Push a layer toward the sky colour with the palette held | Our script | Contrast down a third, no new colours | Keep. |
20
- | 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. |
21
- | 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`. |
22
- | 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. |
23
- | 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. |
24
- | 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. |
25
- | 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. |
26
- | 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 different generator or a cleanup pass. |
27
- | 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. |
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. |
28
38
 
29
39
  ## Ways to make the effect
30
40
 
31
41
  There are six ways to make a background move with depth. Most games combine two of them.
32
42
 
33
- **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.
34
44
 
35
- **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)).
36
46
 
37
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).
38
48
 
39
- **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.
40
50
 
41
- **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.
42
52
 
43
- **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.
44
54
 
45
55
  ## Ways to get the layers out of a generator
46
56
 
47
57
  | Route | What it needs | Status here |
48
58
  |---|---|---|
49
- | 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. |
50
- | Generate each layer on its own, with a transparent background | A prompt per layer; the layers must agree in palette, light and horizon | Step 15. A forced palette shared by every layer is what makes them agree. |
51
- | 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. |
52
- | 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. |
53
- | 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`. |
54
64
 
55
65
  ## 1. Do our backgrounds wrap?
56
66
 
57
67
  **Question.** A parallax layer usually repeats sideways forever. Do the backgrounds PixelKiln already generates join up when placed end to end?
58
68
 
59
- **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.
60
70
 
61
71
  **Result.**
62
72
 
@@ -73,7 +83,7 @@ There are six ways to make a background move with depth. Most games combine two
73
83
  | Retro Diffusion alpine valley B | 43.1 | 7.7 | 5.6 |
74
84
  | Retro Diffusion volcanic pass B | 22.7 | 6.3 | 3.6 |
75
85
 
76
- 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.
77
87
 
78
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.
79
89
 
@@ -81,11 +91,11 @@ The one low ratio is a coincidence of composition: Retro Diffusion's alpine vall
81
91
 
82
92
  **Question.** Can a picture that does not wrap be made to, without a new generation and without new colours?
83
93
 
84
- **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).
85
95
 
86
- - **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.
87
- - **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.
88
- - **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.
89
99
 
90
100
  **Result.**
91
101
 
@@ -97,86 +107,76 @@ The one low ratio is a coincidence of composition: Retro Diffusion's alpine vall
97
107
 
98
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)
99
109
 
100
- **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 ([picture](../website/public/research/parallax/alpine-mirror.png)). 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.
101
111
 
102
112
  ## 3. Split by distance from the sky colour
103
113
 
104
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?
105
115
 
106
- **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.
107
117
 
108
- **Result.** On the volcano (left), 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.
109
119
 
110
- ![Volcanic pass split four ways by sky distance (left) and by Depth Anything (middle), with the depth map (right)](../website/public/research/parallax/volcano-split.png)
111
-
112
- **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.
113
121
 
114
122
  ## 4. Split by a depth model
115
123
 
116
124
  **Question.** Does a monocular depth model give bands that follow the scene's real depth?
117
125
 
118
- **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.
119
127
 
120
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.
121
129
 
122
130
  ![Alpine valley split by sky distance (left) and by Depth Anything (middle)](../website/public/research/parallax/alpine-split.png)
123
131
 
124
- 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.
125
-
126
- ![Retro Diffusion alpine valley: the framing trees take whole columns](../website/public/research/parallax/rd-alpine-split.png)
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.
127
133
 
128
- 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.
129
135
 
130
- **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).
131
137
 
132
138
  ## 5. Pan a camera over the layers
133
139
 
134
140
  **Question.** Do the depth-model layers read as depth when they move, and what breaks?
135
141
 
136
- **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.
137
143
 
138
- **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).
139
145
 
140
- - **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.
141
- - **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.
142
148
 
143
149
  ![At the far end of the pan: before the grow (left) and after (right)](../website/public/research/parallax/volcano-grow.png)
144
150
 
145
- ![Volcano layers panning](../website/public/research/parallax/volcano-layers.gif)
146
-
147
- ![Alpine valley layers panning](../website/public/research/parallax/alpine-layers.gif)
148
-
149
- **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.
150
152
 
151
153
  ## 6. Grow each near layer
152
154
 
153
155
  **Question.** Does lifting each skyline a couple of pixels make the near shapes take their outlines with them?
154
156
 
155
- **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.
156
158
 
157
- **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.
158
160
 
159
161
  **Verdict.** Keep 2 px.
160
162
 
161
163
  ## 7. Scroll each row instead
162
164
 
163
- **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?
164
166
 
165
- **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.
166
168
 
167
- **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.
168
170
 
169
171
  ![Alpine valley, per-row scroll](../website/public/research/parallax/alpine-line.gif)
170
172
 
171
- ![Volcanic pass, per-row scroll: tall shapes shear](../website/public/research/parallax/volcano-line.gif)
172
-
173
173
  **Verdict.** Keep for floors, water, cloud bands and wide valleys. Combine it with layers: line-scroll the ground layer and move the tall shapes as layers.
174
174
 
175
175
  ## 8. Do generators already push the distance back?
176
176
 
177
- **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?
178
178
 
179
- **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.
180
180
 
181
181
  **Result.** Distance from the sky colour, far band to near band:
182
182
 
@@ -189,25 +189,25 @@ The script also counts the pixels a layer does not have but would show if the la
189
189
 
190
190
  Luminance contrast does not fall steadily with distance in any of them.
191
191
 
192
- **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.
193
193
 
194
194
  ## 9. Push a layer back
195
195
 
196
196
  **Question.** Can a layer be pushed toward the sky colour without adding colours?
197
197
 
198
- **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.
199
199
 
200
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.
201
201
 
202
202
  ![Alpine valley as generated (left) and with its second layer pushed back (right)](../website/public/research/parallax/alpine-haze.png)
203
203
 
204
- **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.
205
205
 
206
206
  ## 10. Rounding
207
207
 
208
- **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?
209
209
 
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. 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)`.
211
211
 
212
212
  **Result.**
213
213
 
@@ -221,15 +221,15 @@ Luminance contrast does not fall steadily with distance in any of them.
221
221
 
222
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.
223
223
 
224
- **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)).
225
225
 
226
226
  ## 11. What LDtk does with a parallax factor
227
227
 
228
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?
229
229
 
230
- **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)).
231
231
 
232
- **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.
233
233
 
234
234
  The same layer, at a quarter of the camera's speed, in each tool:
235
235
 
@@ -239,49 +239,47 @@ The same layer, at a quarter of the camera's speed, in each tool:
239
239
  | Tiled | `parallaxx: 0.25` | [Tiled manual](https://doc.mapeditor.org/en/latest/manual/layers/) |
240
240
  | Godot 4 `Parallax2D` | `scroll_scale = Vector2(0.25, 1)` | [Godot class reference](https://docs.godotengine.org/en/stable/classes/class_parallax2d.html) |
241
241
  | Phaser 3 | `setScrollFactor(0.25, 1)` | [Phaser API](https://docs.phaser.io/api-documentation/3.90.0/namespace/gameobjects-components-scrollfactor) |
242
- | Unity | Scripted; no official parallax package found (unverified) | — |
242
+ | Unity | Scripted. We found no official parallax package. | None |
243
243
 
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. 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.
245
245
 
246
246
  ## 12. Layers built from separate silhouettes
247
247
 
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: 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?
249
249
 
250
- **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.
251
251
 
252
252
  **Result.** How it is put together:
253
253
 
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 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.
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. A seeded generator of its own places them, 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. That is aerial perspective from a tint, not from the art (compare step 9). A dust storm pales both further.
257
- - **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.
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 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.
259
- - **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.
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 ever floats.
261
- - **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).
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: 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.
263
263
 
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: `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.
265
265
 
266
- **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.
267
267
 
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. 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.
269
269
 
270
270
  ## 13. Cut by depth per pixel
271
271
 
272
- **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?
273
273
 
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, 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.
275
275
 
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 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.
277
277
 
278
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)
279
279
 
280
280
  ![Volcano layers cut per pixel, panning](../website/public/research/parallax/volcano-cut.gif)
281
281
 
282
- ![The framed valley cut per pixel](../website/public/research/parallax/rd-alpine-cut-bands.png)
283
-
284
- 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).
285
283
 
286
284
  **Verdict.** Keep the per-pixel cut. The fill is the weak part.
287
285
 
@@ -289,9 +287,9 @@ The price is invention. The fill has to make up 115 to 189% of a layer's own pix
289
287
 
290
288
  **Question.** Can a hosted inpainting model replace the smeared fill with something that belongs in the scene, without changing the pixels around it?
291
289
 
292
- **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.
293
291
 
294
- **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.
295
293
 
296
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)
297
295
 
@@ -301,23 +299,19 @@ The price is invention. The fill has to make up 115 to 189% of a layer's own pix
301
299
 
302
300
  **Question.** Instead of cutting a scene, can each layer be generated as its own wide picture that agrees with the others and wraps?
303
301
 
304
- **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).
305
303
 
306
- - **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.
307
- - **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.
308
306
 
309
- 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.
310
308
 
311
309
  **Result.**
312
310
 
313
- ![PixelLab layers, one palette, scrolling](../website/public/research/parallax/pixellab-layers.gif)
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).
314
313
 
315
- ![Retro Diffusion layers with tile_x, scrolling](../website/public/research/parallax/retrodiffusion-layers.gif)
316
-
317
- - **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".
318
- - **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).
319
-
320
- **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.
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.
321
315
 
322
316
  ## 16. A skyline from generated silhouettes
323
317
 
@@ -325,34 +319,92 @@ The PixelLab layers were looped with step 2's crossfade, because pixflux has no
325
319
 
326
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.
327
321
 
328
- **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.
329
-
330
- ![A skyline composed from three generated silhouettes, as the camera rises](../website/public/research/parallax/silhouette-skyline.png)
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.
331
323
 
332
- **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.
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.
333
325
 
334
326
  ## 17. A model that splits a picture into layers
335
327
 
336
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?
337
329
 
338
- **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.
339
331
 
340
332
  **Result.**
341
333
 
342
- ![Qwen-Image-Layered on the volcano: four layers, back to front, then the four stacked](../website/public/research/parallax/qwen-layered.png)
343
-
344
- - **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.
345
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.
346
- - **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.
347
- - **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.
338
+
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.
340
+
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).
342
+
343
+ ## 18. Refine the two routes that worked
344
+
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?
346
+
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.
348
+
349
+ **Result.**
350
+
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.
352
+
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)
354
+
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.
357
+
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)
359
+
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.
348
363
 
349
- 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.
364
+ ![Volcanic dusk from whole layers: a far range, a volcano drawn once, near ridges](../website/public/research/parallax/refined/volcanic/layers.webp)
350
365
 
351
- **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.
366
+ ![Alpine dusk from silhouettes: two tiers of five peaks between a far range and a treeline](../website/public/research/parallax/refined/alpine/silhouettes.webp)
367
+
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.
369
+
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.
352
404
 
353
405
  ## A proposal for PixelKiln
354
406
 
355
- Research only; nothing here is built.
407
+ Research only. Nothing here is built.
356
408
 
357
409
  **A parallax set in the manifest.** A set names its layers in order, far to near, and what they share:
358
410
 
@@ -372,21 +424,21 @@ Research only; nothing here is built.
372
424
  }
373
425
  ```
374
426
 
375
- `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.
376
428
 
377
429
  **Export.**
378
430
 
379
- - **Tiled** fits best: an image layer per parallax layer, with `parallaxx` set to the speed and `repeatx` for a looping layer.
380
- - **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.
381
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).
382
434
 
383
- **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.
384
436
 
385
437
  ## What other people are doing
386
438
 
387
- - **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.
388
- - **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.
389
- - **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)).
390
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.
391
443
 
392
444
  ## What has not worked
@@ -398,17 +450,22 @@ Research only; nothing here is built.
398
450
  - Retro Diffusion's environment style as a layer generator (step 15), and its background removal on a seamless picture.
399
451
  - Asking pixflux for a foot that fades out (step 16).
400
452
  - Qwen-Image-Layered as a depth splitter (step 17).
453
+ - Describing a silhouette as distant or hazy in the prompt (step 18). Pixflux paints a scene around it.
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.
401
458
 
402
459
  ## What is next
403
460
 
404
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.
405
- - **A faded foot for silhouettes** (step 16): soft alpha from Scenario, or a dithered fade drawn after generation and held to the palette.
406
- - **A second PixelLab layer set** at another time of day on the same palette, to see whether a forced palette keeps sets consistent across a biome.
407
- - **Retro Diffusion `tile_x` without background removal** on each layer, with the background keyed out afterwards so the seam survives.
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.
463
+ - **A second time of day** on one biome's palette, to see whether a forced palette keeps sets consistent across a day.
464
+ - **Retro Diffusion `tile_x` without background removal** on each layer, keying the background out afterwards so the seam survives.
408
465
 
409
466
  ## Running the scripts
410
467
 
411
- 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.
412
469
 
413
470
  ```bash
414
471
  # How badly each picture wraps.
@@ -444,4 +501,31 @@ python3 research/scripts/parallax.py scroll <out.gif> 0.05,0.25,0.5,1.0 200 sky.
444
501
 
445
502
  # Layers composed from separate silhouettes; the camera pans north to the skyline. Rates are sky,far,near.
446
503
  python3 research/scripts/parallax.py compose <out.gif> 0.6,0.85,0.92 7 <silhouette.png>...
504
+
505
+ # Step 18. Numbers for choosing between candidates: how much touches each side, colours, the opaque box.
506
+ python3 research/scripts/parallax.py screen <png>...
507
+
508
+ # Trim a silhouette and dither its bottom 30% out.
509
+ python3 research/scripts/parallax.py foot <png> <out.png> 0.3
510
+
511
+ # Mix toward a colour and snap to the biome palette (a manifest's or a picture's).
512
+ python3 research/scripts/parallax.py tint <png> <out.png> "#7f4776" 0.55 pixelkiln.manifest.json
513
+
514
+ # Flat sky bands with dithered steps, top to bottom.
515
+ python3 research/scripts/parallax.py sky <out.png> 384 216 "#2e3253,#503e68,#7b5f94,#ad628e,#d66283,#f96076"
516
+
517
+ # Side-scrolling preview of runs, whole layers and fills from a JSON spec; .webp or .gif.
518
+ STILL=<first-frame.png> SCALE=2 python3 research/scripts/parallax.py skyline <out.webp> <spec.json>
519
+
520
+ # Everything for step 18 at once.
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
447
531
  ```
@@ -257,11 +257,12 @@ resolves that reference to the current result URL and downloads it immediately.
257
257
  it needs `RD_API_KEY` to refresh the task result. Candidate image URLs are used
258
258
  only by the local picker and are not written to the lockfile.
259
259
 
260
- The shared PixelKiln manifest currently allows arbitrary width and height from
261
- 16 to 400 pixels, while Retro Diffusion styles can impose smaller limits. In
262
- the current service catalog, the useful environment and scene-object styles
263
- top out at 384px. Build very large scenes from separate terrain, background,
264
- building, landmark, and foreground layers.
260
+ The PixelKiln manifest allows width and height from 16 to 8192 pixels, but
261
+ Retro Diffusion output is 16 to 512 pixels, and PixelKiln refuses a larger size
262
+ while planning. Many styles have narrower limits. In the live catalog on 23
263
+ November 2026, `rd_plus__environment` takes 64 to 512 pixels and
264
+ `rd_tile__scene_object` takes 64 to 384. Build very large scenes from separate
265
+ terrain, background, building, landmark, and foreground layers.
265
266
 
266
267
  The [environment benchmark](./PROVIDER_BENCHMARK.md) found clean transparent,
267
268
  low-color Retro Diffusion cutouts, while PixelLab followed the more complex
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelkiln",
3
- "version": "0.139.0",
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
@@ -1,15 +1,16 @@
1
1
  # Parallax backgrounds
2
2
 
3
3
  PixelKiln has no parallax command or manifest field yet. This page is what the
4
- research so far supports. The full note, with pictures and numbers, is at
5
- https://pixelkiln.griffen.codes/docs/research-parallax.
4
+ research so far supports. The step-by-step guide is at
5
+ https://pixelkiln.griffen.codes/docs/parallax, and the evidence, with pictures
6
+ and numbers, at https://pixelkiln.griffen.codes/docs/research-parallax.
6
7
 
7
8
  ## The route to try first
8
9
 
9
10
  Compose each layer in the engine from separate silhouettes rather than cutting
10
- layers out of one scene. Generate a few distant landforms per biome, one at a
11
- time, each "fading to nothing at its foot, no ground plane, no sky, isolated
12
- 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
13
14
  runs (each next one about 72% of the way across the last, random flips, never
14
15
  the same twice in a row, a few pixels of jitter), in two tiers tinted toward a
15
16
  dusk or haze colour, over a sky the engine draws. Nothing hidden has to be
@@ -24,13 +25,31 @@ this; its numbers are in step 12 of the research note.
24
25
  - A bounded level needs no loop: extend each run past both ends by the most
25
26
  that layer can drift.
26
27
 
28
+ ## Generating silhouettes
29
+
30
+ - Describe one object as a sprite, never as distant scenery: "a lone landform
31
+ game sprite on a plain empty background, nothing else in the picture: no
32
+ clouds, no moon, no sun, no hills or ground around it", "about two thirds as
33
+ wide as the picture". Words like "distant", "hazy" or "fading at its foot"
34
+ make pixflux paint a whole scene, and the shape runs off the canvas.
35
+ - Leave out a glow at a summit; pixflux draws it as a setting sun.
36
+ - Pixflux at 256×128 with background removal, one forced palette, two or three
37
+ seeds an asset. Reject any candidate that touches a side of the canvas.
38
+ - Add the distance afterwards: dither the bottom 30% out, then tint each tier
39
+ toward its own palette colour, the far tier lighter, the near tier darker.
40
+ One light haze colour for every tier makes depth read backwards.
41
+
27
42
  ## Generating whole layers
28
43
 
29
44
  - PixelLab pixflux with ONE forced palette (`palette`) on every layer is the
30
- cheapest route that gives layers which agree: four layers for four
31
- generations. Opaque sky; the other layers with background removal, at most
32
- 40,000 px each (400×100) to stay transparent. pixflux has no seamless
33
- option, so loop each layer afterwards.
45
+ cheapest route that gives layers which agree. Layers with background
46
+ removal, at most 40,000 px each (400×100) to stay transparent. pixflux has
47
+ no seamless option, so loop each layer afterwards.
48
+ - Draw the sky as flat palette bands instead of generating it: a generated sky
49
+ comes back with mountains in it. A far range comes back as one flat colour;
50
+ recolour it to a palette colour between the sky bands and extend it down to
51
+ the foot of the view so nothing floats. A middle layer that is one landmark
52
+ (a single volcano) goes on screen once, not looped.
34
53
  - Retro Diffusion's `rd_plus__environment` draws a whole scene whatever the
35
54
  prompt says, so it is not a layer generator. Its `tileX` does wrap the
36
55
  drawing, but `removeBg` breaks the seam it made.
@@ -38,6 +57,25 @@ this; its numbers are in step 12 of the research note.
38
57
  to fade at its foot comes back with a hard base. Plan a dithered fade, a
39
58
  ground strip or a treeline in front.
40
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
+
41
79
  ## Before generating
42
80
 
43
81
  - A parallax background is several layers, not one scene. A single scenic