@kerf-js/keel 0.0.0-stage → 0.1.0
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/LICENSE +16 -0
- package/README.md +306 -2
- package/package.json +59 -3
- package/src/blend-inset.ts +79 -0
- package/src/blend.ts +120 -0
- package/src/client.d.ts +9 -0
- package/src/generate/bust.ts +24 -0
- package/src/generate/bust.worker.ts +4 -0
- package/src/generate/pack.ts +69 -0
- package/src/generate/plate.ts +51 -0
- package/src/generate/plate.worker.ts +4 -0
- package/src/generate/serve.ts +56 -0
- package/src/generate/surface.ts +16 -0
- package/src/generate/surface.worker.ts +4 -0
- package/src/generate.ts +133 -0
- package/src/governor.ts +87 -0
- package/src/index.d.ts +15 -0
- package/src/index.mjs +63 -0
- package/src/lit.d.ts +384 -0
- package/src/paint-live.ts +60 -0
- package/src/paint-recipe.d.mts +29 -0
- package/src/paint-recipe.mjs +29 -0
- package/src/paint-worker.mjs +20 -0
- package/src/paint.d.mts +37 -0
- package/src/paint.mjs +180 -0
- package/src/runtime.ts +35 -0
- package/src/scene.ts +289 -0
- package/src/stage.ts +192 -0
- package/vendor/LICENSE +21 -0
- package/vendor/LICENSE-modules +21 -0
- package/vendor/NOTICE +24 -0
- package/vendor/README.md +13 -0
- package/vendor/lit.d.mts +1 -0
- package/vendor/lit.mjs +2 -0
- package/vendor/lock.json +177 -0
- package/vendor/modules/band/events.d.ts +20 -0
- package/vendor/modules/band/index.d.ts +29 -0
- package/vendor/modules/band/player.d.ts +43 -0
- package/vendor/modules/band/roll.d.ts +14 -0
- package/vendor/modules/band/score.d.ts +45 -0
- package/vendor/modules/band/styles.data.d.ts +37 -0
- package/vendor/modules/band/voices.d.ts +33 -0
- package/vendor/modules/band.d.mts +1 -0
- package/vendor/modules/band.mjs +2 -0
- package/vendor/modules/butterflies/butterflies.glsl.d.ts +2 -0
- package/vendor/modules/butterflies/flight.d.ts +68 -0
- package/vendor/modules/butterflies/index.d.ts +79 -0
- package/vendor/modules/butterflies/wing.d.ts +38 -0
- package/vendor/modules/butterflies.d.mts +1 -0
- package/vendor/modules/butterflies.inputs.json +73 -0
- package/vendor/modules/butterflies.mjs +39 -0
- package/vendor/modules/camera-rail/index.d.ts +113 -0
- package/vendor/modules/camera-rail.d.mts +1 -0
- package/vendor/modules/camera-rail.mjs +2 -0
- package/vendor/modules/device-profile/index.d.ts +47 -0
- package/vendor/modules/device-profile.d.mts +1 -0
- package/vendor/modules/device-profile.mjs +2 -0
- package/vendor/modules/lit-finish/dress.d.ts +34 -0
- package/vendor/modules/lit-finish/finish.glsl.d.ts +15 -0
- package/vendor/modules/lit-finish/index.d.ts +33 -0
- package/vendor/modules/lit-finish/lit.d.ts +52 -0
- package/vendor/modules/lit-finish/pass.d.ts +35 -0
- package/vendor/modules/lit-finish/settings.d.ts +88 -0
- package/vendor/modules/lit-finish.d.mts +1 -0
- package/vendor/modules/lit-finish.inputs.json +200 -0
- package/vendor/modules/lit-finish.mjs +267 -0
- package/vendor/modules/look/index.d.ts +159 -0
- package/vendor/modules/look.d.mts +1 -0
- package/vendor/modules/look.inputs.json +23 -0
- package/vendor/modules/look.mjs +2 -0
- package/vendor/modules/motes/index.d.ts +83 -0
- package/vendor/modules/motes/motes.glsl.d.ts +9 -0
- package/vendor/modules/motes/place.d.ts +59 -0
- package/vendor/modules/motes.d.mts +1 -0
- package/vendor/modules/motes.inputs.json +116 -0
- package/vendor/modules/motes.mjs +68 -0
- package/vendor/modules/plate-painter/dab.d.ts +44 -0
- package/vendor/modules/plate-painter/exact.d.ts +19 -0
- package/vendor/modules/plate-painter/foliage.d.ts +4 -0
- package/vendor/modules/plate-painter/gpu.d.ts +65 -0
- package/vendor/modules/plate-painter/index.d.ts +14 -0
- package/vendor/modules/plate-painter/paint.glsl.d.ts +14 -0
- package/vendor/modules/plate-painter/plan.d.ts +42 -0
- package/vendor/modules/plate-painter/recipe.d.ts +136 -0
- package/vendor/modules/plate-painter/scene.d.ts +4 -0
- package/vendor/modules/plate-painter.d.mts +1 -0
- package/vendor/modules/plate-painter.inputs.json +50 -0
- package/vendor/modules/plate-painter.mjs +384 -0
- package/vendor/modules/portrait/body.d.ts +25 -0
- package/vendor/modules/portrait/bust.d.ts +67 -0
- package/vendor/modules/portrait/cap.d.ts +12 -0
- package/vendor/modules/portrait/compile.d.ts +8 -0
- package/vendor/modules/portrait/exact.d.ts +17 -0
- package/vendor/modules/portrait/hair.d.ts +26 -0
- package/vendor/modules/portrait/hand.d.ts +30 -0
- package/vendor/modules/portrait/head.d.ts +18 -0
- package/vendor/modules/portrait/index.d.ts +12 -0
- package/vendor/modules/portrait/mesh.d.ts +24 -0
- package/vendor/modules/portrait/parts.d.ts +33 -0
- package/vendor/modules/portrait/portrait.glsl.d.ts +4 -0
- package/vendor/modules/portrait/render.d.ts +125 -0
- package/vendor/modules/portrait/sdf.d.ts +75 -0
- package/vendor/modules/portrait/settings.d.ts +27 -0
- package/vendor/modules/portrait.d.mts +1 -0
- package/vendor/modules/portrait.inputs.json +111 -0
- package/vendor/modules/portrait.mjs +2 -0
- package/vendor/modules/quality/index.d.ts +130 -0
- package/vendor/modules/quality.d.mts +1 -0
- package/vendor/modules/quality.inputs.json +34 -0
- package/vendor/modules/quality.mjs +2 -0
- package/vendor/modules/scene-blend/blend.d.ts +54 -0
- package/vendor/modules/scene-blend/blend.glsl.d.ts +8 -0
- package/vendor/modules/scene-blend/index.d.ts +25 -0
- package/vendor/modules/scene-blend/lit.d.ts +61 -0
- package/vendor/modules/scene-blend/noise.d.ts +13 -0
- package/vendor/modules/scene-blend/settings.d.ts +63 -0
- package/vendor/modules/scene-blend.d.mts +1 -0
- package/vendor/modules/scene-blend.inputs.json +133 -0
- package/vendor/modules/scene-blend.mjs +2 -0
- package/vendor/modules/section-post/index.d.ts +23 -0
- package/vendor/modules/section-post/lit.d.ts +47 -0
- package/vendor/modules/section-post/noise.d.ts +14 -0
- package/vendor/modules/section-post/post.d.ts +31 -0
- package/vendor/modules/section-post/post.glsl.d.ts +8 -0
- package/vendor/modules/section-post/settings.d.ts +84 -0
- package/vendor/modules/section-post.d.mts +1 -0
- package/vendor/modules/section-post.inputs.json +107 -0
- package/vendor/modules/section-post.mjs +53 -0
- package/vendor/modules/surfaces/exact.d.ts +8 -0
- package/vendor/modules/surfaces/field.d.ts +7 -0
- package/vendor/modules/surfaces/gpu.d.ts +19 -0
- package/vendor/modules/surfaces/index.d.ts +17 -0
- package/vendor/modules/surfaces/paint.d.ts +28 -0
- package/vendor/modules/surfaces/plan.d.ts +39 -0
- package/vendor/modules/surfaces/print.d.ts +55 -0
- package/vendor/modules/surfaces/recipe.d.ts +143 -0
- package/vendor/modules/surfaces/surface.glsl.d.ts +4 -0
- package/vendor/modules/surfaces.d.mts +1 -0
- package/vendor/modules/surfaces.inputs.json +54 -0
- package/vendor/modules/surfaces.mjs +172 -0
- package/vendor/modules/tracks/index.d.ts +66 -0
- package/vendor/modules/tracks.d.mts +1 -0
- package/vendor/modules/tracks.mjs +2 -0
- package/vendor/modules/tree-growth/bend.d.ts +28 -0
- package/vendor/modules/tree-growth/frame.d.ts +60 -0
- package/vendor/modules/tree-growth/index.d.ts +23 -0
- package/vendor/modules/tree-growth/light.d.ts +13 -0
- package/vendor/modules/tree-growth/math.d.ts +19 -0
- package/vendor/modules/tree-growth/model.d.ts +100 -0
- package/vendor/modules/tree-growth/sectors.d.ts +10 -0
- package/vendor/modules/tree-growth/simulation.d.ts +58 -0
- package/vendor/modules/tree-growth/species.d.ts +117 -0
- package/vendor/modules/tree-growth/species.data.d.ts +2 -0
- package/vendor/modules/tree-growth/year.d.ts +38 -0
- package/vendor/modules/tree-growth.d.mts +1 -0
- package/vendor/modules/tree-growth.inputs.json +75 -0
- package/vendor/modules/tree-growth.mjs +2 -0
- package/vendor/modules/tree-render/features.d.ts +9 -0
- package/vendor/modules/tree-render/forest/bake.d.ts +41 -0
- package/vendor/modules/tree-render/forest/cards.d.ts +28 -0
- package/vendor/modules/tree-render/forest/forest.d.ts +156 -0
- package/vendor/modules/tree-render/index.d.ts +52 -0
- package/vendor/modules/tree-render/inputs.d.ts +260 -0
- package/vendor/modules/tree-render/instances.d.ts +66 -0
- package/vendor/modules/tree-render/math.d.ts +8 -0
- package/vendor/modules/tree-render/tree/bark.d.ts +20 -0
- package/vendor/modules/tree-render/tree/leaves.d.ts +29 -0
- package/vendor/modules/tree-render/tree/litter.d.ts +21 -0
- package/vendor/modules/tree-render/tree/ornaments.d.ts +36 -0
- package/vendor/modules/tree-render/tree/roots.d.ts +75 -0
- package/vendor/modules/tree-render/tree/shapes.d.ts +49 -0
- package/vendor/modules/tree-render/tree/tree.d.ts +239 -0
- package/vendor/modules/tree-render/tree/wood.d.ts +27 -0
- package/vendor/modules/tree-render/wind.d.ts +51 -0
- package/vendor/modules/tree-render.d.mts +1 -0
- package/vendor/modules/tree-render.inputs.json +45 -0
- package/vendor/modules/tree-render.mjs +2 -0
- package/vendor/modules/voxel-dither/dither.glsl.d.ts +9 -0
- package/vendor/modules/voxel-dither/index.d.ts +35 -0
- package/vendor/modules/voxel-dither/light.d.ts +33 -0
- package/vendor/modules/voxel-dither/lit.d.ts +86 -0
- package/vendor/modules/voxel-dither/pass.d.ts +46 -0
- package/vendor/modules/voxel-dither/screens.d.ts +21 -0
- package/vendor/modules/voxel-dither/settings.d.ts +307 -0
- package/vendor/modules/voxel-dither/signals.d.ts +35 -0
- package/vendor/modules/voxel-dither.d.mts +1 -0
- package/vendor/modules/voxel-dither.inputs.json +295 -0
- package/vendor/modules/voxel-dither.mjs +452 -0
- package/vendor/modules/world-light/index.d.ts +133 -0
- package/vendor/modules/world-light.d.mts +1 -0
- package/vendor/modules/world-light.inputs.json +68 -0
- package/vendor/modules/world-light.mjs +2 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/** Threshold maps, in the order the shader numbers them. */
|
|
2
|
+
export declare const SCREENS: readonly ["none", "bayer2", "bayer4", "bayer8", "halftone", "lines", "diagonal", "hatch", "ign", "stipple", "checker"];
|
|
3
|
+
export type ScreenId = (typeof SCREENS)[number];
|
|
4
|
+
/** A screen, or "auto": chosen per depth band from the grid size. */
|
|
5
|
+
export type ScreenChoice = ScreenId | "auto";
|
|
6
|
+
/** "cel" swaps lit materials for stepped toon ramps; "smooth" leaves the scene's own lighting. */
|
|
7
|
+
export type Shading = "cel" | "smooth";
|
|
8
|
+
/** "rgb" steps each channel; "luma" steps lightness finer than colour, so shading reads as ramps. */
|
|
9
|
+
export type ColorMode = "rgb" | "luma";
|
|
10
|
+
export type DepthBand = "near" | "mid" | "far";
|
|
11
|
+
/** One depth band's screen: which map, read at 1/scale, with this much of its spread. */
|
|
12
|
+
export interface BandScreen {
|
|
13
|
+
readonly screen: ScreenId;
|
|
14
|
+
readonly scale: number;
|
|
15
|
+
readonly amount: number;
|
|
16
|
+
}
|
|
17
|
+
export type BandScreens = Readonly<Record<DepthBand, BandScreen>>;
|
|
18
|
+
/** A complete, normalized look. Every member has a safe default. */
|
|
19
|
+
export interface DitherSettings {
|
|
20
|
+
/** The preset this look started from. */
|
|
21
|
+
readonly style: StyleId;
|
|
22
|
+
readonly screen: ScreenChoice;
|
|
23
|
+
/** CSS pixels per art pixel, 1 to 12; 0 picks one from the frame size. */
|
|
24
|
+
readonly pixel: number;
|
|
25
|
+
/**
|
|
26
|
+
* The coarsest art pixel, in CSS pixels, of the parts tagged with
|
|
27
|
+
* `tagDetail`: they are drawn on a grid that divides the look's own, so a
|
|
28
|
+
* small animal keeps its shape in a coarse world. 0 draws them on the look's grid.
|
|
29
|
+
*/
|
|
30
|
+
readonly detail: number;
|
|
31
|
+
/** Tone steps per channel, 2 to 16 (ignored when a palette is set). */
|
|
32
|
+
readonly levels: number;
|
|
33
|
+
readonly color: ColorMode;
|
|
34
|
+
/** Up to 32 #rrggbb entries; when set, every pixel is one of them. */
|
|
35
|
+
readonly palette: readonly string[];
|
|
36
|
+
/**
|
|
37
|
+
* Up to 4 spot inks beside the palette. A pixel takes one only when it is
|
|
38
|
+
* already clearly of that ink's hue (never the sky), so a four-tone palette
|
|
39
|
+
* can keep a pink blossom without turning a pale sky pink.
|
|
40
|
+
*/
|
|
41
|
+
readonly accent: readonly string[];
|
|
42
|
+
/**
|
|
43
|
+
* 0 to 3: the sky and far band's saturation, and how much their hue outweighs lightness when it picks a palette
|
|
44
|
+
* entry, so a fixed palette finds its blue instead of greys.
|
|
45
|
+
*/
|
|
46
|
+
readonly skySaturation: number;
|
|
47
|
+
/** How much of the screen's spread is used, 0 (posterized) to 1. */
|
|
48
|
+
readonly amount: number;
|
|
49
|
+
/**
|
|
50
|
+
* 0 to 0.9: how much of each step between two tones snaps flat instead of
|
|
51
|
+
* dithering. 0 dithers every in-between tone; higher keeps flats clean and
|
|
52
|
+
* leaves a short dithered seam where one tone meets the next, as pixel art does.
|
|
53
|
+
*/
|
|
54
|
+
readonly snap: number;
|
|
55
|
+
/** 0 to 0.3: lifts the darkest tones toward a cool blue, so night never crushes to black (ink stays dark). */
|
|
56
|
+
readonly lift: number;
|
|
57
|
+
/** 0 to 1: gathers sub-pixel speckle (leaves, blossom, turf) into masses of one tone; silhouettes stay sharp. */
|
|
58
|
+
readonly clump: number;
|
|
59
|
+
/** 0 to 1: hue-shifted ramps, as pixel artists paint them: lights lean warm, shadows cool. */
|
|
60
|
+
readonly ramp: number;
|
|
61
|
+
readonly shading: Shading;
|
|
62
|
+
/** Cel light steps, 2 to 8. */
|
|
63
|
+
readonly bands: number;
|
|
64
|
+
/** Silhouette outline strength, 0 to 1. */
|
|
65
|
+
readonly outline: number;
|
|
66
|
+
/** A fixed outline ink, or null to darken each pixel's own colour. */
|
|
67
|
+
readonly outlineColor: string | null;
|
|
68
|
+
/** Inner voxel-edge strength, 0 to 1. */
|
|
69
|
+
readonly crease: number;
|
|
70
|
+
readonly contrast: number;
|
|
71
|
+
readonly saturation: number;
|
|
72
|
+
/** View distances where near turns mid and mid turns far. */
|
|
73
|
+
readonly depthBands: readonly [number, number];
|
|
74
|
+
/** God-ray strength multiplier, 0 (off) to 2. The rays themselves come from `setRays`. */
|
|
75
|
+
readonly rays: number;
|
|
76
|
+
/** View distance from which a pixel counts as open sky (it lets light through); 0 means the camera's far plane. */
|
|
77
|
+
readonly skyDistance: number;
|
|
78
|
+
/** CRT scanlines across every art-pixel row, 0 (off) to 1. */
|
|
79
|
+
readonly scanlines: number;
|
|
80
|
+
/** Colour fringe: red and blue drift sideways off the image, 0 (off) to 1. */
|
|
81
|
+
readonly chroma: number;
|
|
82
|
+
/**
|
|
83
|
+
* Signal glitch, 0 (off) to 1: bursts that tear rows sideways and drop blocks
|
|
84
|
+
* of the frame out of place. Higher means more often and more violent.
|
|
85
|
+
* Bursts follow the time given to `setTime`, so a still frame never glitches.
|
|
86
|
+
*/
|
|
87
|
+
readonly glitch: number;
|
|
88
|
+
}
|
|
89
|
+
/** Named looks. A setting given alongside `style` overrides the preset's. */
|
|
90
|
+
export declare const DITHER_STYLES: {
|
|
91
|
+
readonly pixel: {
|
|
92
|
+
readonly label: "3D pixel art";
|
|
93
|
+
readonly screen: "bayer4";
|
|
94
|
+
readonly pixel: 4;
|
|
95
|
+
readonly levels: 5;
|
|
96
|
+
readonly snap: 0.45;
|
|
97
|
+
readonly lift: 0.07;
|
|
98
|
+
readonly clump: 0.6;
|
|
99
|
+
readonly ramp: 0.6;
|
|
100
|
+
readonly color: "luma";
|
|
101
|
+
readonly shading: "cel";
|
|
102
|
+
readonly bands: 3;
|
|
103
|
+
readonly outline: 1;
|
|
104
|
+
readonly crease: 0.3;
|
|
105
|
+
readonly contrast: 1.25;
|
|
106
|
+
readonly saturation: 1.45;
|
|
107
|
+
};
|
|
108
|
+
readonly smart: {
|
|
109
|
+
readonly label: "Smart voxel";
|
|
110
|
+
readonly screen: "auto";
|
|
111
|
+
readonly pixel: 0;
|
|
112
|
+
readonly levels: 6;
|
|
113
|
+
readonly lift: 0.03;
|
|
114
|
+
readonly clump: 0.5;
|
|
115
|
+
readonly ramp: 0.35;
|
|
116
|
+
readonly color: "luma";
|
|
117
|
+
readonly shading: "cel";
|
|
118
|
+
readonly bands: 4;
|
|
119
|
+
readonly outline: 0.9;
|
|
120
|
+
readonly crease: 0.35;
|
|
121
|
+
readonly contrast: 1.05;
|
|
122
|
+
readonly saturation: 1.1;
|
|
123
|
+
};
|
|
124
|
+
readonly bayer: {
|
|
125
|
+
readonly label: "Bayer 32";
|
|
126
|
+
readonly screen: "bayer4";
|
|
127
|
+
readonly pixel: 4;
|
|
128
|
+
readonly palette: string[];
|
|
129
|
+
readonly lift: 0.04;
|
|
130
|
+
readonly shading: "cel";
|
|
131
|
+
readonly bands: 3;
|
|
132
|
+
readonly outline: 0.85;
|
|
133
|
+
readonly crease: 0.25;
|
|
134
|
+
readonly contrast: 1.1;
|
|
135
|
+
readonly saturation: 1.25;
|
|
136
|
+
};
|
|
137
|
+
readonly soft: {
|
|
138
|
+
readonly label: "Soft ordered";
|
|
139
|
+
readonly screen: "bayer8";
|
|
140
|
+
readonly pixel: 3;
|
|
141
|
+
readonly levels: 5;
|
|
142
|
+
readonly lift: 0.12;
|
|
143
|
+
readonly clump: 0.4;
|
|
144
|
+
readonly ramp: 0.3;
|
|
145
|
+
readonly color: "luma";
|
|
146
|
+
readonly shading: "smooth";
|
|
147
|
+
readonly outline: 0.5;
|
|
148
|
+
readonly crease: 0.2;
|
|
149
|
+
readonly contrast: 0.92;
|
|
150
|
+
readonly saturation: 0.95;
|
|
151
|
+
};
|
|
152
|
+
readonly halftone: {
|
|
153
|
+
readonly label: "Riso print";
|
|
154
|
+
readonly screen: "halftone";
|
|
155
|
+
readonly pixel: 2;
|
|
156
|
+
readonly palette: string[];
|
|
157
|
+
readonly shading: "smooth";
|
|
158
|
+
readonly outline: 0.7;
|
|
159
|
+
readonly outlineColor: "#3e4597";
|
|
160
|
+
readonly crease: 0;
|
|
161
|
+
readonly contrast: 1.15;
|
|
162
|
+
readonly saturation: 1.3;
|
|
163
|
+
};
|
|
164
|
+
readonly engraving: {
|
|
165
|
+
readonly label: "Engraving";
|
|
166
|
+
readonly screen: "hatch";
|
|
167
|
+
readonly pixel: 2;
|
|
168
|
+
readonly levels: 3;
|
|
169
|
+
readonly color: "luma";
|
|
170
|
+
readonly shading: "smooth";
|
|
171
|
+
readonly outline: 1;
|
|
172
|
+
readonly outlineColor: "#1d1a24";
|
|
173
|
+
readonly crease: 0.3;
|
|
174
|
+
readonly saturation: 0.55;
|
|
175
|
+
readonly rays: 1.3;
|
|
176
|
+
};
|
|
177
|
+
readonly chunky: {
|
|
178
|
+
readonly label: "Chunky 8-bit";
|
|
179
|
+
readonly screen: "bayer2";
|
|
180
|
+
readonly pixel: 6;
|
|
181
|
+
readonly palette: string[];
|
|
182
|
+
readonly amount: 0.4;
|
|
183
|
+
readonly skySaturation: 2;
|
|
184
|
+
readonly clump: 0.85;
|
|
185
|
+
readonly shading: "cel";
|
|
186
|
+
readonly bands: 3;
|
|
187
|
+
readonly outline: 1;
|
|
188
|
+
readonly crease: 0.4;
|
|
189
|
+
readonly contrast: 1.15;
|
|
190
|
+
readonly saturation: 1.3;
|
|
191
|
+
};
|
|
192
|
+
readonly grain: {
|
|
193
|
+
readonly label: "Film grain";
|
|
194
|
+
readonly screen: "ign";
|
|
195
|
+
readonly pixel: 2;
|
|
196
|
+
readonly levels: 6;
|
|
197
|
+
readonly lift: 0.14;
|
|
198
|
+
readonly ramp: 1;
|
|
199
|
+
readonly color: "luma";
|
|
200
|
+
readonly shading: "smooth";
|
|
201
|
+
readonly outline: 0.4;
|
|
202
|
+
readonly crease: 0.1;
|
|
203
|
+
readonly contrast: 1.2;
|
|
204
|
+
readonly saturation: 0.8;
|
|
205
|
+
};
|
|
206
|
+
readonly blossom: {
|
|
207
|
+
readonly label: "Blossom 16";
|
|
208
|
+
readonly screen: "bayer4";
|
|
209
|
+
readonly pixel: 3;
|
|
210
|
+
readonly palette: string[];
|
|
211
|
+
readonly shading: "cel";
|
|
212
|
+
readonly bands: 4;
|
|
213
|
+
readonly outline: 0.9;
|
|
214
|
+
readonly crease: 0.3;
|
|
215
|
+
};
|
|
216
|
+
readonly pocket: {
|
|
217
|
+
readonly label: "Pocket green";
|
|
218
|
+
readonly screen: "bayer4";
|
|
219
|
+
readonly pixel: 4;
|
|
220
|
+
readonly palette: readonly ["#0f2a1d", "#2f5a35", "#7a9a4a", "#cddc8a"];
|
|
221
|
+
readonly accent: readonly ["#e8a6b8", "#a85a76"];
|
|
222
|
+
readonly shading: "cel";
|
|
223
|
+
readonly bands: 3;
|
|
224
|
+
readonly outline: 0;
|
|
225
|
+
readonly crease: 0;
|
|
226
|
+
readonly saturation: 1;
|
|
227
|
+
readonly rays: 0.6;
|
|
228
|
+
};
|
|
229
|
+
readonly clean: {
|
|
230
|
+
readonly label: "Clean cel";
|
|
231
|
+
readonly screen: "none";
|
|
232
|
+
readonly pixel: 3;
|
|
233
|
+
readonly levels: 5;
|
|
234
|
+
readonly clump: 1;
|
|
235
|
+
readonly lift: 0.05;
|
|
236
|
+
readonly color: "luma";
|
|
237
|
+
readonly shading: "cel";
|
|
238
|
+
readonly bands: 3;
|
|
239
|
+
readonly outline: 1;
|
|
240
|
+
readonly outlineColor: "#241a2e";
|
|
241
|
+
readonly crease: 0.5;
|
|
242
|
+
readonly contrast: 1.15;
|
|
243
|
+
readonly saturation: 1.35;
|
|
244
|
+
};
|
|
245
|
+
readonly crt: {
|
|
246
|
+
readonly label: "CRT painted";
|
|
247
|
+
readonly screen: "bayer8";
|
|
248
|
+
readonly pixel: 2;
|
|
249
|
+
readonly levels: 7;
|
|
250
|
+
readonly snap: 0.75;
|
|
251
|
+
readonly color: "luma";
|
|
252
|
+
readonly shading: "smooth";
|
|
253
|
+
readonly outline: 1;
|
|
254
|
+
readonly outlineColor: "#0b0d22";
|
|
255
|
+
readonly crease: 0.15;
|
|
256
|
+
readonly contrast: 1.3;
|
|
257
|
+
readonly saturation: 1.55;
|
|
258
|
+
readonly scanlines: 0.55;
|
|
259
|
+
readonly chroma: 0.5;
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
export type StyleId = keyof typeof DITHER_STYLES;
|
|
263
|
+
export declare const STYLE_IDS: readonly StyleId[];
|
|
264
|
+
export declare const DEFAULT_DITHER_SETTINGS: DitherSettings;
|
|
265
|
+
export declare const HEX: RegExp;
|
|
266
|
+
export declare function bounded(value: unknown, min: number, max: number, fallback: number): number;
|
|
267
|
+
export declare function depthBandsOf(value: unknown, fallback: readonly [number, number]): readonly [number, number];
|
|
268
|
+
/**
|
|
269
|
+
* Normalizes untrusted settings into a complete look. `style` picks a preset;
|
|
270
|
+
* any other member given overrides it. Anything missing or malformed falls
|
|
271
|
+
* back to the preset, then to the defaults.
|
|
272
|
+
*
|
|
273
|
+
* `limit: { levels, colours }` caps the finished look for a small target (a
|
|
274
|
+
* look recipe's resolved limit; 0 is no limit): the preset's own tone steps
|
|
275
|
+
* and palette are cut to fit, never raised.
|
|
276
|
+
*
|
|
277
|
+
* @param input Plain settings object (usually `KEEL_INPUTS["voxel-dither"]`), or undefined.
|
|
278
|
+
*/
|
|
279
|
+
export declare function ditherSettings(input?: unknown): DitherSettings;
|
|
280
|
+
/** The art-pixel grid for a frame: its size, the device pixels each art pixel covers, and where it starts. */
|
|
281
|
+
export interface PixelGrid {
|
|
282
|
+
readonly width: number;
|
|
283
|
+
readonly height: number;
|
|
284
|
+
/** Device pixels per art pixel (a whole number, so every pixel is the same size). */
|
|
285
|
+
readonly pixel: number;
|
|
286
|
+
/** Device-pixel offset that centres the grid in the frame (zero or negative). */
|
|
287
|
+
readonly originX: number;
|
|
288
|
+
readonly originY: number;
|
|
289
|
+
/** Detail pixels along each side of an art pixel, 1 to 4 (1: detail parts share the grid). */
|
|
290
|
+
readonly detail: number;
|
|
291
|
+
}
|
|
292
|
+
/** CSS pixels per art pixel when `pixel` is 0: about 210 art pixels on the short side, 2 to 6 px each. */
|
|
293
|
+
export declare function autoPixel(cssWidth: number, cssHeight: number): number;
|
|
294
|
+
/**
|
|
295
|
+
* Resolves the art-pixel grid for a frame. Art pixels are a whole number of
|
|
296
|
+
* device pixels, so the picture never has uneven rows; the grid overhangs the
|
|
297
|
+
* frame by under one art pixel and is centred.
|
|
298
|
+
*/
|
|
299
|
+
export declare function resolveGrid(cssWidth: number, cssHeight: number, devicePixelRatio: number, settings: DitherSettings): PixelGrid;
|
|
300
|
+
/**
|
|
301
|
+
* The screens a look wears in each depth band. A fixed screen is worn
|
|
302
|
+
* everywhere, softer with distance. "auto" picks by grid size: a small grid
|
|
303
|
+
* needs a 2x2 lattice to have room for tone, a large one can afford a fine
|
|
304
|
+
* matrix throughout and a fine grain only far away. Distance always flattens
|
|
305
|
+
* the screen's spread, so far things snap to calm fills.
|
|
306
|
+
*/
|
|
307
|
+
export declare function bandScreens(settings: DitherSettings, gridShort: number): BandScreens;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { NodeLike } from "./lit.js";
|
|
2
|
+
/** One of three scene parts a host can tag (say platform, tree, background) to give it its own signal. */
|
|
3
|
+
export type SignalPart = 1 | 2 | 3;
|
|
4
|
+
/**
|
|
5
|
+
* The filters a part can wear on top of its signal, in the shader's numbering. Some move pixels
|
|
6
|
+
* (mosaic, vhs, wave, slitscan, pixelsort, datamosh), the rest change colour before the tones are
|
|
7
|
+
* stepped, so a filtered part is still dithered pixel art.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SIGNAL_FILTERS: readonly ["none", "snow", "film", "mosaic", "cga", "negative", "glow", "vhs", "bleed", "wave", "nightvision", "sparkle", "thermal", "neon", "rainbow", "slitscan", "pixelsort", "datamosh", "holo"];
|
|
10
|
+
export type SignalFilter = (typeof SIGNAL_FILTERS)[number];
|
|
11
|
+
/**
|
|
12
|
+
* A part's own scanlines, colour fringe and glitch, each 0 to 1, and an optional filter at `amount` (0 to 1, default
|
|
13
|
+
* 1).
|
|
14
|
+
*/
|
|
15
|
+
export interface SignalSpec {
|
|
16
|
+
readonly scanlines?: number;
|
|
17
|
+
readonly chroma?: number;
|
|
18
|
+
readonly glitch?: number;
|
|
19
|
+
readonly filter?: SignalFilter;
|
|
20
|
+
readonly amount?: number;
|
|
21
|
+
}
|
|
22
|
+
/** The alpha a tagged material writes into the scene target; untagged pixels keep 1. */
|
|
23
|
+
export declare const SIGNAL_TAG_ALPHA: Readonly<Record<SignalPart, number>>;
|
|
24
|
+
/** Packs up to three part signals into the shader's uniform, in part order. */
|
|
25
|
+
export declare function signalUniform(parts: readonly (SignalSpec | null | undefined)[]): Float32Array;
|
|
26
|
+
/** Packs up to three part filters into the shader's uniform: each filter's number and amount, in part order. */
|
|
27
|
+
export declare function filterUniform(parts: readonly (SignalSpec | null | undefined)[]): Float32Array;
|
|
28
|
+
export declare function tagTree(root: NodeLike, part: SignalPart): void;
|
|
29
|
+
/**
|
|
30
|
+
* The layer detail parts are drawn on. The world pass leaves it out and the
|
|
31
|
+
* detail pass sees nothing else; a host's camera should not use it.
|
|
32
|
+
*/
|
|
33
|
+
export declare const DETAIL_LAYER = 30;
|
|
34
|
+
export declare const DETAIL_MASK: number;
|
|
35
|
+
export declare function layerDetail(roots: ReadonlySet<NodeLike>, split: boolean): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './voxel-dither/index.js'
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
{
|
|
2
|
+
"protocol": "keel-module-inputs@1",
|
|
3
|
+
"fields": [
|
|
4
|
+
{
|
|
5
|
+
"key": "style",
|
|
6
|
+
"label": "Look",
|
|
7
|
+
"required": false,
|
|
8
|
+
"type": "select",
|
|
9
|
+
"options": [
|
|
10
|
+
{
|
|
11
|
+
"value": "smart",
|
|
12
|
+
"label": "Smart voxel"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"value": "pixel",
|
|
16
|
+
"label": "3D pixel art"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"value": "bayer",
|
|
20
|
+
"label": "Bayer cel"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"value": "soft",
|
|
24
|
+
"label": "Soft ordered"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"value": "halftone",
|
|
28
|
+
"label": "Halftone print"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"value": "engraving",
|
|
32
|
+
"label": "Engraving"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"value": "chunky",
|
|
36
|
+
"label": "Chunky 8-bit"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"value": "grain",
|
|
40
|
+
"label": "Noise grain"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"value": "blossom",
|
|
44
|
+
"label": "Blossom 16"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"value": "pocket",
|
|
48
|
+
"label": "Pocket green"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"value": "clean",
|
|
52
|
+
"label": "Clean cel"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"value": "crt",
|
|
56
|
+
"label": "CRT painted"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"default": "smart"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"key": "pixel",
|
|
63
|
+
"label": "Pixel size",
|
|
64
|
+
"required": false,
|
|
65
|
+
"help": "CSS pixels per art pixel. 0 picks one from the frame size.",
|
|
66
|
+
"type": "number",
|
|
67
|
+
"min": 0,
|
|
68
|
+
"max": 12,
|
|
69
|
+
"step": 1,
|
|
70
|
+
"control": "slider",
|
|
71
|
+
"unit": "px",
|
|
72
|
+
"default": 0
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"key": "screen",
|
|
76
|
+
"label": "Dither screen",
|
|
77
|
+
"required": false,
|
|
78
|
+
"placement": "advanced",
|
|
79
|
+
"type": "select",
|
|
80
|
+
"options": [
|
|
81
|
+
{
|
|
82
|
+
"value": "auto",
|
|
83
|
+
"label": "Auto (by depth band)"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"value": "bayer2",
|
|
87
|
+
"label": "Bayer 2x2"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"value": "bayer4",
|
|
91
|
+
"label": "Bayer 4x4"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"value": "bayer8",
|
|
95
|
+
"label": "Bayer 8x8"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"value": "halftone",
|
|
99
|
+
"label": "Halftone dots"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"value": "lines",
|
|
103
|
+
"label": "Lines"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"value": "diagonal",
|
|
107
|
+
"label": "Diagonal lines"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"value": "hatch",
|
|
111
|
+
"label": "Cross hatch"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"value": "ign",
|
|
115
|
+
"label": "Gradient noise"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"value": "stipple",
|
|
119
|
+
"label": "Stipple"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"value": "checker",
|
|
123
|
+
"label": "Checker"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"value": "none",
|
|
127
|
+
"label": "None (posterized)"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"key": "shading",
|
|
133
|
+
"label": "Shading",
|
|
134
|
+
"required": false,
|
|
135
|
+
"placement": "advanced",
|
|
136
|
+
"type": "select",
|
|
137
|
+
"options": [
|
|
138
|
+
{
|
|
139
|
+
"value": "cel",
|
|
140
|
+
"label": "Cel (stepped light)"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"value": "smooth",
|
|
144
|
+
"label": "Smooth (dithered light)"
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"key": "levels",
|
|
150
|
+
"label": "Tone steps",
|
|
151
|
+
"required": false,
|
|
152
|
+
"placement": "advanced",
|
|
153
|
+
"type": "number",
|
|
154
|
+
"min": 2,
|
|
155
|
+
"max": 16,
|
|
156
|
+
"step": 1,
|
|
157
|
+
"control": "slider"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"key": "bands",
|
|
161
|
+
"label": "Cel bands",
|
|
162
|
+
"required": false,
|
|
163
|
+
"placement": "advanced",
|
|
164
|
+
"type": "number",
|
|
165
|
+
"min": 2,
|
|
166
|
+
"max": 8,
|
|
167
|
+
"step": 1,
|
|
168
|
+
"control": "slider"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"key": "outline",
|
|
172
|
+
"label": "Outline",
|
|
173
|
+
"required": false,
|
|
174
|
+
"placement": "advanced",
|
|
175
|
+
"type": "number",
|
|
176
|
+
"min": 0,
|
|
177
|
+
"max": 1,
|
|
178
|
+
"step": 0.05,
|
|
179
|
+
"control": "slider"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"key": "crease",
|
|
183
|
+
"label": "Voxel creases",
|
|
184
|
+
"required": false,
|
|
185
|
+
"placement": "advanced",
|
|
186
|
+
"type": "number",
|
|
187
|
+
"min": 0,
|
|
188
|
+
"max": 1,
|
|
189
|
+
"step": 0.05,
|
|
190
|
+
"control": "slider"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"key": "lift",
|
|
194
|
+
"label": "Shadow lift",
|
|
195
|
+
"required": false,
|
|
196
|
+
"help": "Raises the darkest tones toward a cool blue, so night never crushes to black.",
|
|
197
|
+
"placement": "advanced",
|
|
198
|
+
"type": "number",
|
|
199
|
+
"min": 0,
|
|
200
|
+
"max": 0.3,
|
|
201
|
+
"step": 0.01,
|
|
202
|
+
"control": "slider"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"key": "clump",
|
|
206
|
+
"label": "Clump",
|
|
207
|
+
"required": false,
|
|
208
|
+
"help": "Gathers sub-pixel speckle into masses of one tone, so foliage reads and does not shimmer.",
|
|
209
|
+
"placement": "advanced",
|
|
210
|
+
"type": "number",
|
|
211
|
+
"min": 0,
|
|
212
|
+
"max": 1,
|
|
213
|
+
"step": 0.05,
|
|
214
|
+
"control": "slider"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"key": "ramp",
|
|
218
|
+
"label": "Hue ramps",
|
|
219
|
+
"required": false,
|
|
220
|
+
"help": "Lights lean warm and shadows cool, as pixel artists paint ramps.",
|
|
221
|
+
"placement": "advanced",
|
|
222
|
+
"type": "number",
|
|
223
|
+
"min": 0,
|
|
224
|
+
"max": 1,
|
|
225
|
+
"step": 0.05,
|
|
226
|
+
"control": "slider"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"key": "scanlines",
|
|
230
|
+
"label": "Scanlines",
|
|
231
|
+
"required": false,
|
|
232
|
+
"placement": "advanced",
|
|
233
|
+
"type": "number",
|
|
234
|
+
"min": 0,
|
|
235
|
+
"max": 1,
|
|
236
|
+
"step": 0.05,
|
|
237
|
+
"control": "slider"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"key": "chroma",
|
|
241
|
+
"label": "Colour fringe",
|
|
242
|
+
"required": false,
|
|
243
|
+
"placement": "advanced",
|
|
244
|
+
"type": "number",
|
|
245
|
+
"min": 0,
|
|
246
|
+
"max": 1,
|
|
247
|
+
"step": 0.05,
|
|
248
|
+
"control": "slider"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"key": "glitch",
|
|
252
|
+
"label": "Glitch",
|
|
253
|
+
"required": false,
|
|
254
|
+
"help": "Signal bursts that tear rows and drop blocks of the frame. Timed by setTime.",
|
|
255
|
+
"placement": "advanced",
|
|
256
|
+
"type": "number",
|
|
257
|
+
"min": 0,
|
|
258
|
+
"max": 1,
|
|
259
|
+
"step": 0.05,
|
|
260
|
+
"control": "slider"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"key": "palette",
|
|
264
|
+
"label": "Palette",
|
|
265
|
+
"required": false,
|
|
266
|
+
"help": "Up to 32 colors. When set, every pixel is one of them.",
|
|
267
|
+
"placement": "advanced",
|
|
268
|
+
"type": "palette",
|
|
269
|
+
"minItems": 0,
|
|
270
|
+
"maxItems": 32
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"key": "accent",
|
|
274
|
+
"label": "Spot inks",
|
|
275
|
+
"required": false,
|
|
276
|
+
"help": "Up to 4 colors beside the palette. A pixel takes one only when it is already clearly of that hue and is not sky.",
|
|
277
|
+
"placement": "advanced",
|
|
278
|
+
"type": "palette",
|
|
279
|
+
"minItems": 0,
|
|
280
|
+
"maxItems": 4
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"key": "skySaturation",
|
|
284
|
+
"label": "Sky push",
|
|
285
|
+
"required": false,
|
|
286
|
+
"help": "Pushes a light far band's saturation, so a fixed palette finds its blue instead of greys. Night skies are left alone.",
|
|
287
|
+
"placement": "advanced",
|
|
288
|
+
"type": "number",
|
|
289
|
+
"min": 0,
|
|
290
|
+
"max": 3,
|
|
291
|
+
"step": 0.1,
|
|
292
|
+
"control": "slider"
|
|
293
|
+
}
|
|
294
|
+
]
|
|
295
|
+
}
|