@call-me-sensei/toonlab 0.2.0 → 0.3.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/AGENTS.md +127 -4
- package/ATTRIBUTION.md +41 -3
- package/README.md +234 -34
- package/docs/characters.md +144 -0
- package/docs/debug-panel.md +126 -0
- package/docs/docs.css +589 -0
- package/docs/environment.md +186 -0
- package/docs/getting-started.md +180 -0
- package/docs/index.html +14 -0
- package/docs/lab-architecture.md +100 -0
- package/docs/lighting.md +825 -0
- package/docs/main.jsx +739 -0
- package/docs/mcp.md +97 -0
- package/docs/post-processing.md +98 -0
- package/docs/settings-reference.md +1878 -0
- package/docs/shader-constants.md +77 -0
- package/docs/sky.md +182 -0
- package/docs/style-labs.md +309 -0
- package/docs/texture-lab.md +135 -0
- package/docs/toon-shading.md +183 -0
- package/docs/tsl-conventions.md +167 -0
- package/docs/vegetation-sky.md +275 -0
- package/docs/water.md +430 -0
- package/docs/weather.md +200 -0
- package/docs/world-scale.md +111 -0
- package/mcp/server.mjs +610 -0
- package/mcp/style-lab-tools.mjs +371 -0
- package/mcp/vite-plugin.mjs +174 -0
- package/mcp/workspace.mjs +397 -0
- package/package.json +64 -5
- package/src/ambientfx/INTEGRATION.md +164 -0
- package/src/ambientfx/ambientFxPresets.js +83 -0
- package/src/ambientfx/ambientFxSettings.js +368 -0
- package/src/ambientfx/emitters.js +169 -0
- package/src/ambientfx/index.js +5 -0
- package/src/ambientfx/particleBackbone.js +493 -0
- package/src/ambientfx/stylizedAmbientFx.js +450 -0
- package/src/assetlib/ambientcg.js +117 -0
- package/src/assetlib/assetRef.js +91 -0
- package/src/assetlib/importedEntry.js +40 -0
- package/src/assetlib/index.js +23 -0
- package/src/assetlib/kaykit.js +192 -0
- package/src/assetlib/kaykitStaticIndex.js +700 -0
- package/src/assetlib/loadImported.js +143 -0
- package/src/assetlib/opensource3d.js +113 -0
- package/src/assetlib/polyhaven.js +182 -0
- package/src/assetlib/polypizza.js +115 -0
- package/src/assetlib/smithsonian.js +214 -0
- package/src/assetlib/sources.js +279 -0
- package/src/assetlib/zip.js +58 -0
- package/src/biome/biomeGenerator.js +385 -0
- package/src/biome/biomeRuntime.js +299 -0
- package/src/biome/index.js +2 -0
- package/src/buildinggen/buildingAsset.js +44 -0
- package/src/buildinggen/buildingGrammar.js +311 -0
- package/src/buildinggen/buildingMesh.js +451 -0
- package/src/buildinggen/buildingPresets.js +46 -0
- package/src/buildinggen/buildingRecipe.js +100 -0
- package/src/buildinggen/buildingSettings.js +238 -0
- package/src/buildinggen/index.js +6 -0
- package/src/camera/cameraDirector.js +157 -0
- package/src/camera/cameraGenerator.js +367 -0
- package/src/camera/cameraRig.js +570 -0
- package/src/camera/cameraSettings.js +236 -0
- package/src/camera/index.js +7 -0
- package/src/catalog/builtinEntries.js +245 -0
- package/src/catalog/catalog.js +210 -0
- package/src/catalog/index.js +3 -0
- package/src/catalog/manifest.js +84 -0
- package/src/core/generation.js +529 -0
- package/src/environment/environmentRigs.js +21 -1
- package/src/environment/environmentSettings.js +4 -0
- package/src/environment/environmentSunShadowPass.js +8 -0
- package/src/fauna/INTEGRATION.md +174 -0
- package/src/fauna/boids.js +861 -0
- package/src/fauna/faunaBodies.js +492 -0
- package/src/fauna/faunaPresets.js +52 -0
- package/src/fauna/faunaSettings.js +525 -0
- package/src/fauna/index.js +5 -0
- package/src/fauna/stylizedFauna.js +395 -0
- package/src/game-feel/gameFeelGenerator.js +402 -0
- package/src/game-feel/gameFeelRuntime.js +549 -0
- package/src/game-feel/index.js +2 -0
- package/src/index.js +17 -6
- package/src/lighting/colorIntensity.js +177 -0
- package/src/lighting/index.js +161 -0
- package/src/lighting/lightDescriptors.js +249 -0
- package/src/lighting/lightingCapabilities.js +79 -0
- package/src/lighting/lightingDocuments.js +247 -0
- package/src/lighting/lightingFixtures.js +446 -0
- package/src/lighting/lightingGenerator.js +449 -0
- package/src/lighting/lightingPresets.js +319 -0
- package/src/lighting/lightingRuntime.js +723 -0
- package/src/lighting/lightingStyle.js +386 -0
- package/src/lighting/lightingSystem.js +774 -0
- package/src/lighting/unrealExport.js +186 -0
- package/src/lighting/utils.js +87 -0
- package/src/motion/index.js +5 -0
- package/src/motion/motionClip.js +441 -0
- package/src/motion/motionController.js +628 -0
- package/src/motion/motionDocuments.js +225 -0
- package/src/motion/motionGraph.js +307 -0
- package/src/motion/motionSettings.js +222 -0
- package/src/pathgen/index.js +7 -0
- package/src/pathgen/pathBridge.js +232 -0
- package/src/pathgen/pathPresets.js +35 -0
- package/src/pathgen/pathRibbon.js +410 -0
- package/src/pathgen/pathRouter.js +380 -0
- package/src/pathgen/pathSettings.js +335 -0
- package/src/pathgen/pathTextures.js +123 -0
- package/src/pathgen/stylizedPaths.js +453 -0
- package/src/post/index.js +1 -0
- package/src/post/postGenerator.js +177 -0
- package/src/post/postProcessing.js +41 -0
- package/src/propgen/generatorsWave1.js +379 -0
- package/src/propgen/generatorsWave2.js +462 -0
- package/src/propgen/index.js +5 -0
- package/src/propgen/propAsset.js +323 -0
- package/src/propgen/propParts.js +170 -0
- package/src/propgen/propPlacement.js +459 -0
- package/src/propgen/propPresets.js +82 -0
- package/src/propgen/propSettings.js +395 -0
- package/src/shaders-tsl/chunks/projected-water-caustics.js +242 -0
- package/src/shaders-tsl/chunks/vegetation-style.js +360 -0
- package/src/shaders-tsl/chunks/water-shore-state.js +31 -0
- package/src/shaders-tsl/chunks/water-waves.js +90 -11
- package/src/shaders-tsl/environment.js +15 -1
- package/src/shaders-tsl/flower.js +279 -30
- package/src/shaders-tsl/grass.js +60 -33
- package/src/shaders-tsl/sky.js +125 -31
- package/src/shaders-tsl/tree-leaf.js +61 -25
- package/src/shaders-tsl/water-breaker.js +7 -4
- package/src/shaders-tsl/water-shore-state-simulation.js +523 -0
- package/src/shaders-tsl/water.js +439 -49
- package/src/shaders-tsl/woody-surface.js +154 -0
- package/src/sky/sceneOverrideLayers.js +10 -0
- package/src/sky/skyQuality.js +26 -0
- package/src/sky/stylizedSky.js +753 -45
- package/src/soundscape/index.js +4 -0
- package/src/soundscape/soundscapeGenerator.js +179 -0
- package/src/soundscape/soundscapeRuntime.js +806 -0
- package/src/soundscape/soundscapeSettings.js +292 -0
- package/src/styles/index.js +13 -0
- package/src/styles/styleBundle.js +325 -0
- package/src/stylizedTerrain.js +32 -2
- package/src/stylizedWorld.js +423 -20
- package/src/texgen/evaluateTexture.js +675 -0
- package/src/texgen/index.js +60 -0
- package/src/texgen/noise2.js +210 -0
- package/src/texgen/textureAi.js +436 -0
- package/src/texgen/textureGenerators.js +516 -0
- package/src/texgen/texturePresets.js +490 -0
- package/src/texgen/textureSettings.js +342 -0
- package/src/texgen/textureThree.js +59 -0
- package/src/vegetation/flowerSpecies.js +15 -3
- package/src/vegetation/grassPalettes.js +153 -0
- package/src/vegetation/index.js +6 -0
- package/src/vegetation/stylizedBush.js +2 -0
- package/src/vegetation/stylizedFlower.js +82 -0
- package/src/vegetation/stylizedFlowers.js +48 -7
- package/src/vegetation/stylizedForest.js +29 -1
- package/src/vegetation/stylizedGrass.js +291 -56
- package/src/vegetation/stylizedTree.js +38 -2
- package/src/vegetation/stylizedTreeFoliage.js +2 -1
- package/src/vegetation/vegetationShaders.js +1110 -0
- package/src/vfxgen/INTEGRATION.md +145 -0
- package/src/vfxgen/core/burstBackbone.js +380 -0
- package/src/vfxgen/core/projectileCore.js +92 -0
- package/src/vfxgen/core/spriteShapes.js +98 -0
- package/src/vfxgen/core/trailRibbon.js +272 -0
- package/src/vfxgen/core/vfxRandom.js +29 -0
- package/src/vfxgen/effects/emitHelpers.js +37 -0
- package/src/vfxgen/effects/magicEffects.js +162 -0
- package/src/vfxgen/effects/movementEffects.js +87 -0
- package/src/vfxgen/effects/weaponEffects.js +118 -0
- package/src/vfxgen/index.js +18 -0
- package/src/vfxgen/moves/moveController.js +146 -0
- package/src/vfxgen/moves/moveLibrary.js +335 -0
- package/src/vfxgen/vfxPresets.js +98 -0
- package/src/vfxgen/vfxSettings.js +384 -0
- package/src/vfxgen/vfxSystem.js +449 -0
- package/src/vfxgen/weapons/stylizedWeapons.js +137 -0
- package/src/villagegen/index.js +4 -0
- package/src/villagegen/stylizedVillage.js +490 -0
- package/src/villagegen/villageArchetypes.js +160 -0
- package/src/villagegen/villageNames.js +40 -0
- package/src/villagegen/villageSites.js +105 -0
- package/src/water/sceneOverrideLayers.js +23 -0
- package/src/water/water.js +5 -0
- package/src/water/waterBreakerSystem.js +15 -1
- package/src/water/waterCurrentField.js +447 -0
- package/src/water/waterMaterial.js +12 -0
- package/src/water/waterNearshorePhase.js +320 -0
- package/src/water/waterScenePasses.js +83 -30
- package/src/water/waterSettings.js +325 -13
- package/src/water/waterShoreMaterial.js +322 -0
- package/src/water/waterShoreStateField.js +605 -0
- package/src/water/waterSurface.js +797 -28
- package/src/weather/index.js +6 -0
- package/src/weather/weatherPrecipitation.js +221 -0
- package/src/weather/weatherPresets.js +258 -0
- package/src/weather/weatherSettings.js +269 -0
- package/src/weather/weatherSystem.js +871 -0
- package/src/worldMinimap.js +62 -0
- package/src/worldPresets.js +4 -1
package/AGENTS.md
CHANGED
|
@@ -94,11 +94,134 @@ Every cluster has a `default` and a studio-managed `call_me_sensei` preset.
|
|
|
94
94
|
|
|
95
95
|
## Subpath imports
|
|
96
96
|
|
|
97
|
-
`/toon` `/environment` `/water` `/vegetation` (incl. scatter helpers +
|
|
98
|
-
`StylizedForest`) `/sky` `/post` `/character` `/loaders` `/rockgen`
|
|
99
|
-
`/debrisgen` `/debug`; root adds `createStylizedTerrain`,
|
|
97
|
+
`/toon` `/environment` `/lighting` `/weather` `/water` `/vegetation` (incl. scatter helpers +
|
|
98
|
+
`StylizedForest`) `/vegetation-shaders` `/grass-palettes` `/sky` `/post` `/character` `/loaders` `/rockgen`
|
|
99
|
+
`/debrisgen` `/pathgen` `/debug`; root adds `createStylizedTerrain`,
|
|
100
100
|
`createStylizedWorld`, `createWorldCollision`, `createWorldMinimap`,
|
|
101
|
-
`resolveWorldPreset`.
|
|
101
|
+
`resolveWorldPreset`, `createStylizedPaths`.
|
|
102
|
+
|
|
103
|
+
Authoring scope: Character/Vegetation/Environment Shader Labs save reusable
|
|
104
|
+
IP-wide material treatments; Tree/Flower/Grass and other Asset Labs save asset
|
|
105
|
+
identity and geometry; Water/Sky Labs save complete runtime-system presets
|
|
106
|
+
with their shader controls embedded, so do not create separate Water Shader or
|
|
107
|
+
Sky Shader documents. Current lighting, weather, camera, and interactions
|
|
108
|
+
remain host-owned.
|
|
109
|
+
|
|
110
|
+
Sky and Water keep authored and current-scene state separate. `.settings` is
|
|
111
|
+
the portable authored baseline; `.renderedSettings` is the composition after
|
|
112
|
+
named transient layers. Lighting, Weather, and other owners must use unique
|
|
113
|
+
ids with `setSceneOverrideLayer`, clear only their own id with
|
|
114
|
+
`clearSceneOverrideLayer`, and never persist the composed result. The manual
|
|
115
|
+
`setSceneOverrides`/`clearSceneOverrides` pair owns only the `scene` layer;
|
|
116
|
+
`clearAllSceneOverrideLayers` is for explicit host teardown.
|
|
117
|
+
|
|
118
|
+
`lighting.attachWorld(world)` owns the world sun adapter plus private
|
|
119
|
+
priority-100 Sky/Water layers. If Weather is present it also installs Lighting
|
|
120
|
+
as Weather's sun/ambient/fog bridge: Lighting remains the sole writer, Weather
|
|
121
|
+
provides modulation and private priority-200 Sky/Water layers, and either
|
|
122
|
+
system removes only its own state on detach/dispose.
|
|
123
|
+
The adapter is `world.setSun({ direction, color, sky })`; it aligns the real
|
|
124
|
+
light/shadows with Grass, Flower, Forest, Ambient FX, Sky, and Water inputs.
|
|
125
|
+
For a standalone custom Weather coordinator, supply paired `getSun`/`setSun`
|
|
126
|
+
and baselines for any write-only cloud/surface adapters so teardown is exact.
|
|
127
|
+
|
|
128
|
+
Sky documents contain exactly 46 portable art fields; constructor-only radius
|
|
129
|
+
and quality are excluded. Sky quality is compile-time (`low`/`medium`/`high`
|
|
130
|
+
= 2/3/4 cloud octaves, or custom `{ cloudOctaves: 1..5 }`), and
|
|
131
|
+
`sky.setQuality()` rebuilds the material while preserving authored/layered
|
|
132
|
+
state. Water quality is selected when constructing `WaterSurface`; a tier
|
|
133
|
+
change requires replacing/rebuilding the surface, never `applySettings()`.
|
|
134
|
+
|
|
135
|
+
Lighting (`/lighting`) owns portable, versioned recipes and looks rather than
|
|
136
|
+
a replacement renderer. Use `createLightingManager({ scene, camera, renderer,
|
|
137
|
+
recipe, quality })`, call `update()` as the focus/camera moves, and save JSON
|
|
138
|
+
with the recipe/look serializers. Luminaire, rig, look, and quality presets
|
|
139
|
+
come from `getLightingPresetOptions(kind)`. Disc/tube area lights, IES, tag
|
|
140
|
+
linking, and Unreal Engine 5.8 MegaLights/Lumen are explicit adapter intent;
|
|
141
|
+
the capability report and diagnostics state each runtime fallback. Author and
|
|
142
|
+
stress-test them in `/lighting-lab/`.
|
|
143
|
+
|
|
144
|
+
`createLightingManager` is the lower-level rig-realization API. For a composed
|
|
145
|
+
world and day cycle, use `createLightingSystem(...)`, then call
|
|
146
|
+
`lighting.attachWorld(world)` for the sun/Sky/Water ownership and Weather
|
|
147
|
+
modulation bridge described above.
|
|
148
|
+
|
|
149
|
+
Paths/roads/bridges: `createStylizedWorld({ paths: { seed, auto: { count: 4,
|
|
150
|
+
styles: ['dirt', 'stone'] } } })` routes seeded trails around slopes, bridges
|
|
151
|
+
water crossings, parts grass/trees around the ribbon, and feeds the flattened
|
|
152
|
+
profile to `world.collision.groundHeight` — use that (not raw `heightAt`) for
|
|
153
|
+
character ground so bridges carry the walk. Minimap: pass `paths: world.paths`
|
|
154
|
+
to `createWorldMinimap` for the network overlay.
|
|
155
|
+
|
|
156
|
+
Catalog (`@call-me-sensei/toonlab/catalog`): the whole procedural library,
|
|
157
|
+
queryable and spawnable —
|
|
158
|
+
`catalog.list({ tags, cluster, text })`, `catalog.get(id)`, and the headline
|
|
159
|
+
`catalog.spawn(id, { seed })` → a PropAsset for any prop / building / tree /
|
|
160
|
+
rock / debris entry (settings presets throw with their copy-paste snippet
|
|
161
|
+
instead). `catalog.register(entry)` adds user assets;
|
|
162
|
+
`catalog.addSource(url, { headers })` mounts remote registries (the pro
|
|
163
|
+
seam). The browser Gallery at `/gallery/` searches third-party open assets;
|
|
164
|
+
the procedural Catalog itself is a runtime API rather than a standalone lab.
|
|
165
|
+
|
|
166
|
+
Villages (`/villagegen`): `createStylizedWorld({ pois: { seed, villages: 2,
|
|
167
|
+
shrines: 1, pierHamlets: 1, size } })` → named settlements (seeded syllable
|
|
168
|
+
names) with streets merged into the world path network, buildings facing
|
|
169
|
+
their street behind picket fences, wells/lanterns/clutter by archetype, POI
|
|
170
|
+
entries auto-connected by roads. `world.pois` feeds
|
|
171
|
+
`createWorldMinimap({ markers })` labels. Fully-shadowed building facades
|
|
172
|
+
need `parameters.sunShadowStrength ≈ 0.7` in worlds that run near-zero
|
|
173
|
+
ambient (full-strength cast shadows crush large vertical masses to black).
|
|
174
|
+
|
|
175
|
+
Fauna (`/fauna`) and ambient VFX (`/ambientfx`) are one option each:
|
|
176
|
+
`createStylizedWorld({ fauna: { species: { birds: 40, fish: 80 } },
|
|
177
|
+
ambientfx: { effects: { petals: true, fireflies: true } } })` — both join
|
|
178
|
+
the world's fog/wind/cloud-shadow automatically.
|
|
179
|
+
|
|
180
|
+
Weather (`/weather`) is a cross-system coordinator, not an environment
|
|
181
|
+
catch-all: `createStylizedWorld({ weather: { preset: 'snow' } })`, then
|
|
182
|
+
`world.setWeather('thunderstorm', { duration: 4 })`. Its 22 shared presets
|
|
183
|
+
drive sky/sun/fog/cloud shadows, wind across vegetation/fauna/ambient FX,
|
|
184
|
+
one-draw GPU rain/snow/sleet/hail/dust, water waves/ripples, lightning and
|
|
185
|
+
thunder events. Surface `{ wetness, snowCover, ice }` values are host-facing
|
|
186
|
+
outputs for custom terrain/prop/character materials. Labs should read
|
|
187
|
+
`getWeatherPresetOptions()` rather than maintaining a private condition list.
|
|
188
|
+
|
|
189
|
+
Gameplay VFX (`/vfxgen`): event-driven combat/movement effects, spawned at
|
|
190
|
+
gameplay moments (not a world option) — `createVfxSystem({ seed, preset,
|
|
191
|
+
heightAt })` then `vfx.spawn('slash' | 'impact' | 'fireball' | 'footstep' |
|
|
192
|
+
'landing', { at | follow, power, look })` and `vfx.update(delta, camera)`
|
|
193
|
+
per frame. All bursts share TWO draw calls; slash trails / fireball cores
|
|
194
|
+
are pooled meshes. `vfx.setDistanceFog(...)` joins the height-fog layer;
|
|
195
|
+
`vfx.setTimeScale(0)` is hit-stop. Weapons + moves are batteries-included:
|
|
196
|
+
`createStylizedWeapon({ type: 'sword' | 'greatsword' | 'spear' | 'dagger'
|
|
197
|
+
| 'hammer' })` + `createMoveController({ weapon, vfx })` →
|
|
198
|
+
`attack.play('slash' | 'overhead' | 'thrust' | 'spin' | 'plunge')` — authored
|
|
199
|
+
phase-based motions whose event tracks fire the VFX at the right beats
|
|
200
|
+
(plunge = the full crouch→leap→dive→landfall decomposition); weapon weight
|
|
201
|
+
scales timing and hit power. Design interactively in the VFX Lab
|
|
202
|
+
(`/vfx-lab/`): weapon picker + move triggers + schema panels, exports a
|
|
203
|
+
recipe (preset + seed + overrides) that drops straight into `createVfxSystem`.
|
|
204
|
+
The `call_me_sensei` preset targets the reference action-RPG hit language
|
|
205
|
+
(smooth gradient arcs, four-point star + shockwave circle per hit,
|
|
206
|
+
hard-saturated pyro fireball). Demo loop: `examples/vfx-arena/`.
|
|
207
|
+
|
|
208
|
+
Buildings (`/buildinggen`): seeded grammar exteriors —
|
|
209
|
+
`buildingAsset({ type: 'cottage' | 'shed' | 'farmhouse' | 'watchtower' |
|
|
210
|
+
'shrine', seed })` is a PropAsset (multi-circle footprint, buried foundation
|
|
211
|
+
skirt for slopes ≤ ~20°, hi/lo LOD, `door` anchor with outward normal for
|
|
212
|
+
street-facing placement). `createBuildingFromRecipe(recipe)` rebuilds
|
|
213
|
+
deterministically; ≤ 6 draw calls per building.
|
|
214
|
+
|
|
215
|
+
Props (`/propgen`): every placeable thing is a PropAsset —
|
|
216
|
+
`createPropAsset({ asset: { type: 'lantern', variant: 'stoneToro', seed } })`
|
|
217
|
+
or `propAssetFromObject(importedGlb)` (auto footprint + ground anchor).
|
|
218
|
+
Place with ONE call: `placeAlongSpline({ asset, spline: world.paths.splines[0],
|
|
219
|
+
spacing, offset, mask, heightAt: world.paths.heightAt, collision:
|
|
220
|
+
world.collision, parent })` (fences/walls build continuously; point props
|
|
221
|
+
instance with hi/lo LOD — call the returned `update(delta, camera)` per
|
|
222
|
+
frame), or `scatterProps`/`placeProps`. Props added after `createStylizedWorld`
|
|
223
|
+
need `applyEnvironmentShader(propsRoot, { parameters: { …fog } })` to join the
|
|
224
|
+
look; pass a dry-land `mask` so dressing never marches into water.
|
|
102
225
|
|
|
103
226
|
## Symptom table — check before debugging blind
|
|
104
227
|
|
package/ATTRIBUTION.md
CHANGED
|
@@ -8,9 +8,18 @@ Code is MIT-licensed by Hyperbond Studio PTE. LTD. (see LICENSE). The assets bun
|
|
|
8
8
|
|---|---|---|---|
|
|
9
9
|
| Mannequin character (45 embedded animation clips) | `public/characters/mannequin.glb` | CC0 1.0 | [Quaternius — Universal Animation Library](https://quaternius.com/packs/universalanimationlibrary.html), recolored to neutral grays. See `public/characters/LICENSE.md`. |
|
|
10
10
|
| Landscape textures (grassy-land, land, mountain, rock, sand, tree-trunk) | `labs/shared/textures/` | CC0 1.0 | First-party (created by the toonlab authors), dedicated to the public domain. |
|
|
11
|
+
| Water Lab sea fern model | `public/water-lab/cc0/quaternius/fern-1.glb` | CC0 1.0 | [Quaternius — Fern 1, Stylized Nature MegaKit](https://quaternius.itch.io/stylized-nature-megakit), selected through the [ToonLab catalog](https://toonlab.io/asset/quaternius:stylized-nature-megakit-fern-1). |
|
|
12
|
+
| Water Lab Coast Sand 01 texture set | `public/water-lab/cc0/polyhaven/` | CC0 1.0 | [Rob Tuytel — Coast Sand 01, Poly Haven](https://polyhaven.com/a/coast_sand_01), selected through the [ToonLab catalog](https://toonlab.io/asset/polyhaven:coast_sand_01). |
|
|
13
|
+
| City street models (buildings, roads, cars, street props — 28 models) | `public/props/cc0/kaykit-city/` | CC0 1.0 | [Kay Lousberg — KayKit City Builder Bits](https://kaylousberg.com). Attribution optional under CC0; credited with thanks. See the bundled `LICENSE.txt`. |
|
|
14
|
+
| Furniture models (tables, chairs, couch, lamps, shelves — 17 models) | `public/props/cc0/kaykit-furniture/` | CC0 1.0 | [Kay Lousberg — KayKit Furniture Bits](https://kaylousberg.com). Attribution optional under CC0; credited with thanks. See the bundled `LICENSE.txt`. |
|
|
15
|
+
| Environment Lab Wood Floor texture | `public/environments/cc0/polyhaven/wood-floor-diff-1k.jpg` | CC0 1.0 | [Dimitrios Savva — Wood Floor, Poly Haven](https://polyhaven.com/a/wood_floor) |
|
|
16
|
+
| Environment Lab Painted Plaster Wall texture | `public/environments/cc0/polyhaven/painted-plaster-wall-diff-1k.jpg` | CC0 1.0 | [Amal Kumar — Painted Plaster Wall, Poly Haven](https://polyhaven.com/a/painted_plaster_wall) |
|
|
17
|
+
| Environment Lab photoscanned furniture (Sofa 02, Modern Arm Chair 01, Round Wooden Table 01, Classic Console 01, Steel Frame Shelves 01, Potted Plant 04) | `public/environments/cc0/polyhaven/models/` | CC0 1.0 | [Poly Haven models](https://polyhaven.com/models) (1k glTF), per-asset credits on each asset page |
|
|
18
|
+
| Environment Lab museum scans (baluster vase F1980.190-.194; Colonoware pot) | `public/environments/cc0/smithsonian/` | CC0 1.0 | [Smithsonian Open Access 3D](https://3d.si.edu), selected through the [ToonLab catalog](https://toonlab.io/gallery?src=smithsonian) |
|
|
19
|
+
| Draco + Basis decoders (model decompression) | `public/draco/`, `public/basis/` | Apache 2.0 | [google/draco](https://github.com/google/draco), [BinomialLLC/basis_universal](https://github.com/BinomialLLC/basis_universal) — bundled three.js decoder builds |
|
|
11
20
|
|
|
12
21
|
Everything else that renders — water, sky, grass, flowers, trees, foliage,
|
|
13
|
-
splashes, post-processing — is procedural code
|
|
22
|
+
splashes, post-processing — is procedural code.
|
|
14
23
|
|
|
15
24
|
## Not bundled (bring your own)
|
|
16
25
|
|
|
@@ -32,9 +41,38 @@ folder that is **not** part of this repository:
|
|
|
32
41
|
|
|
33
42
|
## Recommended free sources
|
|
34
43
|
|
|
44
|
+
The machine-readable version of this list (license facts, integration level,
|
|
45
|
+
quality tier, enable/disable flags) is `src/assetlib/sources.js`; the Asset
|
|
46
|
+
Browser lab surfaces it.
|
|
47
|
+
|
|
35
48
|
- [Quaternius](https://quaternius.com) — CC0 models + the Universal
|
|
36
|
-
Animation Library (v1 and v2 free tiers)
|
|
49
|
+
Animation Library (v1 and v2 free tiers); most of the catalog is
|
|
50
|
+
searchable via Poly Pizza.
|
|
37
51
|
- [Poly Haven](https://polyhaven.com) — CC0 textures/HDRIs/models.
|
|
38
|
-
- [Kenney](https://kenney.nl) — CC0 game assets.
|
|
52
|
+
- [Kenney](https://kenney.nl) — CC0 game assets (no file API; manual import).
|
|
53
|
+
- [KayKit](https://kaylousberg.com) — CC0 stylized low-poly packs (city,
|
|
54
|
+
furniture, dungeon, characters …) on GitHub; integrated in the Asset
|
|
55
|
+
Browser (disabled by default — below the platform quality bar).
|
|
56
|
+
Attribution optional; credited with thanks.
|
|
57
|
+
- [Open Source 3D Assets](https://opensource3dassets.com) — keyless CC0
|
|
58
|
+
registry (Polygonal Mind collections); integrated, pending quality review.
|
|
59
|
+
- [Poly Pizza](https://poly.pizza) — low-poly aggregator, CC0/CC-BY
|
|
60
|
+
(BYO free API key).
|
|
61
|
+
- [Smithsonian 3D Open Access](https://3d.si.edu) — museum scans; only
|
|
62
|
+
records explicitly marked CC0.
|
|
63
|
+
- [Sketchfab CC0 search](https://sketchfab.com/search?features=downloadable&licenses=cc0&type=models)
|
|
64
|
+
— download manually (their download API is per-user OAuth with branding
|
|
65
|
+
terms; deliberately not automated).
|
|
66
|
+
- [The Base Mesh](https://thebasemesh.com) — CC0 base meshes (manual import).
|
|
67
|
+
- [3DTextures.me](https://3dtextures.me) — CC0 stylized materials
|
|
68
|
+
(manual import).
|
|
69
|
+
- [TextureCan](https://www.texturecan.com) — CC0 textures (manual import).
|
|
70
|
+
- [ShareTextures](https://www.sharetextures.com) — CC0 files, but their
|
|
71
|
+
platform terms prohibit automated downloads/hotlinking — browse manually
|
|
72
|
+
only, never wire an adapter.
|
|
39
73
|
- [OpenGameArt](https://opengameart.org) — filter by CC0/CC-BY.
|
|
74
|
+
- [Openverse](https://openverse.org) — openly licensed images/audio
|
|
75
|
+
(per-record license).
|
|
76
|
+
- [Freesound](https://freesound.org) — sounds; free API tier is
|
|
77
|
+
non-commercial.
|
|
40
78
|
- [VRoid Hub](https://hub.vroid.com) — VRM avatars (check per-model terms).
|
package/README.md
CHANGED
|
@@ -4,8 +4,9 @@ ToonLab by Call Me Sensei is a stylized anime-style game starter kit and
|
|
|
4
4
|
runtime library for [Three.js](https://threejs.org/). Its goal is to simplify
|
|
5
5
|
Three.js game development: you get a better-looking anime/stylized game
|
|
6
6
|
without having to develop shaders yourself, and procedurally generated assets
|
|
7
|
-
(trees, rocks, grass
|
|
8
|
-
on your core game logic instead.
|
|
7
|
+
(trees, rocks, grass) plus integrated procedural world systems (water, sky)
|
|
8
|
+
reduce content complexity so you can focus on your core game logic instead.
|
|
9
|
+
Clone it and a toon-shaded character is
|
|
9
10
|
walking and swimming through a fully stylized world: cel-shaded characters,
|
|
10
11
|
painterly environments, interactive water, procedural vegetation and sky,
|
|
11
12
|
post-processing, and a schema-driven tuning panel. Use it as a starter kit,
|
|
@@ -15,8 +16,8 @@ subpath exports per cluster).
|
|
|
15
16
|
## Quickstart
|
|
16
17
|
|
|
17
18
|
**No install** — use the hosted labs at **[toonlab.io](https://toonlab.io)**:
|
|
18
|
-
|
|
19
|
-
presets
|
|
19
|
+
define character, vegetation, and environment shaders; author stylized assets;
|
|
20
|
+
tune water and sky systems; and export portable presets from the browser.
|
|
20
21
|
|
|
21
22
|
**As a library** in your own Three.js app:
|
|
22
23
|
|
|
@@ -35,30 +36,78 @@ npm run dev
|
|
|
35
36
|
Vite serves the labs at `http://localhost:5175`. See
|
|
36
37
|
[Getting started](docs/getting-started.md) for a tour.
|
|
37
38
|
|
|
39
|
+
**Building with an AI coding agent?** That is the fastest path through all of
|
|
40
|
+
this — see [Build with an AI coding agent](#build-with-an-ai-coding-agent)
|
|
41
|
+
for the recommended setup (skills + MCP) and ready-to-paste starting prompts.
|
|
42
|
+
|
|
43
|
+
### Local MCP server
|
|
44
|
+
|
|
45
|
+
Running the labs locally also creates a disk-backed `.toonlab/` workspace
|
|
46
|
+
shared by the browser tools and the included MCP server. Open
|
|
47
|
+
`http://localhost:5175/settings/` for a checkout-specific configuration you
|
|
48
|
+
can paste into an MCP-compatible coding tool.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm run dev
|
|
52
|
+
# In an MCP client, use the command/config shown at /settings/.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The local server can search the built-in procedural catalog and public CC0
|
|
56
|
+
sources, read your saved presets and exported files, generate seeded recipes,
|
|
57
|
+
and import assets into the project. It uses stdio, requires no account or
|
|
58
|
+
OAuth, and keeps work on disk. See [Local MCP and workspace](docs/mcp.md).
|
|
59
|
+
|
|
38
60
|
## The labs
|
|
39
61
|
|
|
40
|
-
|
|
41
|
-
the
|
|
42
|
-
|
|
43
|
-
- **Shader
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- **
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- **
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
Lab UIs are development tools and are not published in the npm package. The
|
|
63
|
+
Labs home (`/`) presents them by the artifact they author:
|
|
64
|
+
|
|
65
|
+
- **Shader Labs** — Character Shader Lab (`/shader-lab/`), Vegetation Shader
|
|
66
|
+
Lab (`/vegetation-shader-lab/`), and Environment Shader Lab
|
|
67
|
+
(`/environment-lab/`) each save one reusable IP-wide material treatment.
|
|
68
|
+
- **Asset Labs** — Rock, Tree, Flower, Grass, Debris, and Texture Labs author
|
|
69
|
+
geometry, material data, recipes, and exports for individual asset classes.
|
|
70
|
+
Grass color palettes coordinate base, tip, and shadow tint as one set.
|
|
71
|
+
- **World Systems** — Water Lab (`/water-lab/`) authors waves, surface
|
|
72
|
+
shading, foam, reflections, interaction, and quality as one runtime preset;
|
|
73
|
+
Sky Lab (`/sky-lab/`) authors the gradient, sun, clouds, stars, and cloud
|
|
74
|
+
motion as one runtime preset. Their shader controls are embedded in the
|
|
75
|
+
complete system labs rather than duplicated as separate shader labs.
|
|
76
|
+
- **Playgrounds & demos** — Playground, Water Playground, Outdoor World, VFX
|
|
77
|
+
Arena, Fauna Demo, and Ambient VFX Demo validate the authored artifacts in
|
|
78
|
+
interactive scenes.
|
|
79
|
+
|
|
80
|
+
Supporting editors remain available by direct URL: Weather Lab
|
|
81
|
+
(`/weather-lab/`) coordinates current atmosphere, wind, precipitation,
|
|
82
|
+
lightning, and surface state; Lighting Lab (`/lighting-lab/`) authors light
|
|
83
|
+
rigs and budgets; Prop Lab (`/prop-lab/`) and Building Lab
|
|
84
|
+
(`/building-lab/`) expose the broader procedural library; Gallery
|
|
85
|
+
(`/gallery/`) searches supported open-asset sources. The procedural Catalog
|
|
86
|
+
is exposed through `@call-me-sensei/toonlab/catalog`. See
|
|
87
|
+
[Lab responsibilities](docs/lab-architecture.md) for the scope rules and
|
|
88
|
+
[Getting started](docs/getting-started.md) for every direct route.
|
|
89
|
+
|
|
90
|
+
Sky and Water are integrated runtime systems, not extra Shader Labs. Their
|
|
91
|
+
`.settings` are authored preset data; current Lighting and Weather state is
|
|
92
|
+
composed through named transient layers and exposed as `.renderedSettings`
|
|
93
|
+
without changing exported presets. Create a `LightingSystem`, then call
|
|
94
|
+
`lighting.attachWorld(world)` to own the Lighting layers and connect the
|
|
95
|
+
world's Weather coordinator as modulation, so each system can detach only its
|
|
96
|
+
own layer. The shared `world.setSun({ direction, color, sky })` adapter keeps
|
|
97
|
+
the physical light/shadows, vegetation scene inputs, Sky, and Water aligned;
|
|
98
|
+
Weather captures and restores every transient baseline it drives. Sky presets contain exactly 46
|
|
99
|
+
portable art fields; dome radius and compile-time quality stay outside the
|
|
100
|
+
document. Sky provides low/medium/high cloud graphs plus custom 1–5-octave
|
|
101
|
+
quality and can rebuild its material with `setQuality()`. Water quality is a
|
|
102
|
+
construction-time graph choice; switching it requires replacing/rebuilding
|
|
103
|
+
the surface rather than calling `applySettings()`.
|
|
104
|
+
|
|
105
|
+
Every URL parameter has a HUD control. In local development, lab state is
|
|
106
|
+
mirrored into `.toonlab/` so the MCP server and browser share it; existing
|
|
107
|
+
`localStorage` and IndexedDB data migrate on first run. Static hosted builds
|
|
108
|
+
fall back to browser storage. **Reset Lab** clears the current lab state.
|
|
109
|
+
Point any model-aware lab at your own model with the Model URL input or
|
|
110
|
+
`?model=` — see
|
|
62
111
|
[Characters](docs/characters.md).
|
|
63
112
|
|
|
64
113
|
## What's inside
|
|
@@ -67,14 +116,32 @@ with the Model URL input or `?model=` — see
|
|
|
67
116
|
|---|---|---|
|
|
68
117
|
| Toon character shading | `@call-me-sensei/toonlab/toon` | Modern anime character shader: cel bands with art-directed face lighting, skin-tone shadow management, shadow-color HSV control, scene/self/contact shadows, average-shadow smoothing, rim light (fresnel or screen-space depth), stylized + anisotropic hair highlights, eye catchlights, role-aware specular, source map routing (normal/AO/emissive/MatCap/ramp/detail), inverted-hull outlines, glitter, stickers, perspective removal, shell fur, dither fades — 23 settings groups, all preset-serializable. [Docs](docs/toon-shading.md) |
|
|
69
118
|
| Environment shading | `@call-me-sensei/toonlab/environment` | Modern anime-style scene shader for texture packs, standard glTF, and untextured scenes: material-role classification, wrapped lighting, packed-map hints, window cutouts, sun/lamp rigs, time-of-day, six-direction ambient probe, planar floor reflections, BVH vertex-AO baking, height fog, cloud shadows. [Docs](docs/environment.md) |
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
119
|
+
| Lighting | `@call-me-sensei/toonlab/lighting` | Versioned lighting recipes and looks, physical/artistic intensity helpers, reusable luminaire/rig/look/quality presets, deterministic light and shadow budgets, capability diagnostics, runtime Three.js realization, and a data-only Unreal Engine 5.8 MegaLights/Lumen handoff. [Docs](docs/lighting.md) |
|
|
120
|
+
| Weather | `@call-me-sensei/toonlab/weather` | Shared cross-system weather coordinator with 22 presets, smooth transitions, one-draw GPU precipitation (rain, snow, sleet, hail, dust), lightning/thunder events, and normalized wetness/snow/ice outputs. It drives sky, sun, fog, cloud shadows, wind, vegetation, water, fauna, and ambient effects through their public adapters. [Docs](docs/weather.md) |
|
|
121
|
+
| Water | `@call-me-sensei/toonlab/water` | Fully procedural integrated water system: Gerstner wave stack with a calm→storm dial, wave sets, plunging breakers you can surf, three-stop absorption color, refraction/caustics/foam, GPU ripple sim, splashes, wakes, rain, kelp, underwater view, construction-time quality, and a CPU mirror of the whole spectrum for buoyancy. [Docs](docs/water.md) |
|
|
122
|
+
| Vegetation | `@call-me-sensei/toonlab/vegetation` | Instanced grass and flower fields, procedural trees/flowers with serializable recipes, coordinated grass palettes (base, tip, and shadow tint), and one semantic-role `VegetationShaderProfile` shared across grass, foliage, flowers, bark, and stems. Asset identity and current wind/weather remain separate. [Docs](docs/vegetation-sky.md) |
|
|
123
|
+
| Paths, roads & bridges | `@call-me-sensei/toonlab/pathgen` | Seeded path networks routed over any `heightAt`: cost-field router (slope/water aware), hand-drawn ribbon overlay in dirt/stone/planks, arched plank bridges with collision, stepped stone climbs, flattened `paths.heightAt` for walkability, scatter exclusion mask, minimap overlay. |
|
|
124
|
+
| Props & placement | `@call-me-sensei/toonlab/propgen` | The universal placement pipeline (the PropAsset contract: grounded, collided, instanced, hi/lo LOD by true 3D distance) + 12 seeded prop generators across fences, lanterns, signposts, stairs, milestones, wells, crates, firewood, torii, piers, stone walls, benches. `propAssetFromObject` drops any imported GLB into the same pipeline. |
|
|
125
|
+
| Buildings | `@call-me-sensei/toonlab/buildinggen` | Shape-grammar stylized exteriors (cottage/shed/farmhouse/watchtower/shrine): seeded recipes, timber facades with windows that never intersect beams, always-overhanging roofs (gable/hip/shed/pagoda-ish), buried foundation skirts for slopes, ≤ 6 draw calls per building, grammar invariants asserted across 1000 seeds. |
|
|
126
|
+
| Villages & POIs | `@call-me-sensei/toonlab/villagegen` | Seeded settlements composed from paths + props + buildings: site scoring, main-street layout with parcels facing the street, archetypes as data (village, fishing hamlet, shrine, campsite, ruin), seeded place names, world `pois` option that roads everything together. |
|
|
127
|
+
| Fauna | `@call-me-sensei/toonlab/fauna` | Instanced GPU-animated ambient creatures: flocking birds that perch and flush, butterflies over flower masks, hovering dragonflies, schooling koi — staggered boids, hard population budgets, ≤ 1 ms CPU at defaults. |
|
|
128
|
+
| Ambient VFX | `@call-me-sensei/toonlab/ambientfx` | One GPU particle backbone, five effects: falling petals and leaves, dusk fireflies, backlit pollen, shoreline mist — follow-window emission, shared wind with grass, time-of-day gates, 3 draw calls total. |
|
|
129
|
+
| Asset catalog | `@call-me-sensei/toonlab/catalog` | Every recipe/preset as a searchable manifest with one headline call: `catalog.spawn(id, { seed })` → a placeable PropAsset for props, buildings, trees, rocks, and debris. `catalog.addSource(url)` mounts remote registries. |
|
|
130
|
+
| Sky | `@call-me-sensei/toonlab/sky` | Integrated gradient/sun/painterly-cloud/star system with exactly 46 portable art fields, named live scene layers, compile-time quality tiers/custom 1–5 cloud octaves, meaningful built-in looks, and water-reflection compatibility. [Docs](docs/sky.md) |
|
|
73
131
|
| Post-processing | `@call-me-sensei/toonlab/post` | Optional single-pipeline compositor: character-aware bloom, color grade, LUT, vignette, screen outline, depth cue — schema-driven, preset-serializable. [Docs](docs/post-processing.md) |
|
|
132
|
+
| Camera | `@call-me-sensei/toonlab/camera` | Extensible camera operator stack, generated recipe/preset documents, follow/framing/collision/damping/noise/impulse behavior, and a director for blending reusable rigs. [Style domain docs](docs/style-labs.md#camera) |
|
|
133
|
+
| Game feel | `@call-me-sensei/toonlab/game-feel` | Event-driven response scheduler for camera punches, hit-stop/time warp, squash, flashes, audio, and haptics through capability-safe adapters, extensible effect factories, and bounded concurrency. [Style domain docs](docs/style-labs.md#game-feel) |
|
|
134
|
+
| Procedural textures | `@call-me-sensei/toonlab/texgen` | Seamless CPU-baked PBR texture generator: 25 tileable pattern/noise generators, layered detail + colored overlays (moss, rust, grime), five-stop cel-capable color ramp, cavity/sheen hand-painted read, derived normal/AO/roughness/metalness/height/ORM/emissive maps, 60+ presets, and a natural-language recipe mapper (offline keywords or BYO-key Gemini/OpenAI). [Docs](docs/texture-lab.md) |
|
|
74
135
|
| Character pipeline | `@call-me-sensei/toonlab/character` | Bone-role adapters for VRM/MMD/Mixamo/Rigify rigs, native-clip conventions, Mixamo retarget helpers, and a procedural freestyle swim clip. [Docs](docs/characters.md) |
|
|
75
136
|
| Model loaders | `@call-me-sensei/toonlab/loaders` | Optional GLB/glTF, VRM 0+1, PMX/PMD, FBX, OBJ, and text-USDZ loading helpers. Kept off the root import so apps that do not load models avoid loader dependencies. [Docs](docs/characters.md) |
|
|
76
137
|
| Debug panel | `@call-me-sensei/toonlab/debug` | One-line schema-driven tuning GUI for any settings module — the same panel the labs use. [Docs](docs/debug-panel.md) |
|
|
77
138
|
|
|
139
|
+
The main `vegetation` barrel exposes the complete runtime. Smaller consumers
|
|
140
|
+
can import the same bindings from
|
|
141
|
+
`@call-me-sensei/toonlab/vegetation-shaders` or
|
|
142
|
+
`@call-me-sensei/toonlab/grass-palettes`; package verification asserts that
|
|
143
|
+
the focused subpaths and root export reference the identical implementations.
|
|
144
|
+
|
|
78
145
|
Zero texture assets in the library: water, sky, grass, flowers, trees, and
|
|
79
146
|
splashes are all procedural. The one bundled model is a CC0 mannequin with 45
|
|
80
147
|
embedded animation clips.
|
|
@@ -101,6 +168,7 @@ const world = await createStylizedWorld({
|
|
|
101
168
|
renderer, scene, camera,
|
|
102
169
|
terrain: { heightAt: terrain.heightAt, root: terrainRoot, size: terrain.meshExtent },
|
|
103
170
|
water: { level: terrain.waterLevel },
|
|
171
|
+
weather: { preset: 'call_me_sensei' }, // 'snow' | 'hail' | 'thunderstorm' | ...
|
|
104
172
|
followTarget: character, // your character root (optional): splashes, wakes, grass push
|
|
105
173
|
});
|
|
106
174
|
character.position.copy(terrain.spawn); // probed: walkable, near a shore
|
|
@@ -168,13 +236,27 @@ stack, with WebGL2 fallback through the same TSL path.
|
|
|
168
236
|
|
|
169
237
|
## Documentation
|
|
170
238
|
|
|
239
|
+
- **In-browser docs** — with the labs running (`npm run dev`), open
|
|
240
|
+
`http://localhost:5175/docs/` for guided documentation: library usage,
|
|
241
|
+
MCP setup, the prompt cookbook, and the full settings reference. Hosted
|
|
242
|
+
features are marked "Pro"; the extended hosted docs live at
|
|
243
|
+
[toonlab.io/docs](https://toonlab.io/docs).
|
|
244
|
+
- [Lab responsibilities](docs/lab-architecture.md) — the boundary between
|
|
245
|
+
Shader Labs, Asset Labs, World Systems, and preview-only scene state.
|
|
171
246
|
- [Getting started](docs/getting-started.md) — clone, run, tour the labs,
|
|
172
247
|
load your own models.
|
|
173
248
|
- [Toon character shading](docs/toon-shading.md)
|
|
174
249
|
- [Environment shading](docs/environment.md)
|
|
250
|
+
- [Lighting](docs/lighting.md)
|
|
251
|
+
- [Weather system](docs/weather.md)
|
|
252
|
+
- [Generative style labs](docs/style-labs.md) — Post & Color, Camera, Motion,
|
|
253
|
+
UI Theme, Biome, Soundscape, and Game Feel; shared recipes, MCP authoring,
|
|
254
|
+
package runtimes, quality budgets, and engine design references.
|
|
175
255
|
- [Water](docs/water.md)
|
|
176
|
-
- [
|
|
256
|
+
- [Sky system](docs/sky.md)
|
|
257
|
+
- [Vegetation](docs/vegetation-sky.md)
|
|
177
258
|
- [Post-processing](docs/post-processing.md)
|
|
259
|
+
- [Texture Lab and texgen](docs/texture-lab.md)
|
|
178
260
|
- [Characters and animation](docs/characters.md)
|
|
179
261
|
- [Debug panel](docs/debug-panel.md)
|
|
180
262
|
- [World scale and world presets](docs/world-scale.md) — the meters
|
|
@@ -185,11 +267,129 @@ stack, with WebGL2 fallback through the same TSL path.
|
|
|
185
267
|
- [Shader constants](docs/shader-constants.md) — the deliberately unexposed
|
|
186
268
|
constants and where they live.
|
|
187
269
|
|
|
188
|
-
## AI coding
|
|
270
|
+
## Build with an AI coding agent
|
|
271
|
+
|
|
272
|
+
ToonLab is designed to be driven by a coding agent (Claude Code, Codex,
|
|
273
|
+
Cursor, …). The recommended setup has three parts: give the agent the ToonLab
|
|
274
|
+
skills, connect an MCP server for asset discovery, then start from a goal
|
|
275
|
+
prompt and iterate. Everything the agent needs ships in this repo under
|
|
276
|
+
`agents/` (not in the npm package — the package stays runtime-only).
|
|
277
|
+
|
|
278
|
+
### 1. Install the ToonLab skills in your game project
|
|
279
|
+
|
|
280
|
+
The skills teach the agent the assembly order, the frame-loop contract, and
|
|
281
|
+
each subsystem's API so it wires ToonLab correctly on the first try. Start
|
|
282
|
+
with `game-dev`; the other twelve cover individual features (water, weather,
|
|
283
|
+
lighting, camera, game feel, …).
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Claude Code — feature skills + project guidance
|
|
287
|
+
mkdir -p .claude/skills
|
|
288
|
+
cp -R path/to/toonlab/agents/skills/claude/* .claude/skills/
|
|
289
|
+
cat path/to/toonlab/agents/codex/AGENTS.md >> CLAUDE.md
|
|
290
|
+
|
|
291
|
+
# Codex — shared guide + Codex-oriented skills
|
|
292
|
+
cat path/to/toonlab/agents/codex/AGENTS.md >> AGENTS.md
|
|
293
|
+
cp -R path/to/toonlab/agents/skills/codex path/to/your-game/docs/toonlab-skills
|
|
294
|
+
|
|
295
|
+
# Cursor — rule file
|
|
296
|
+
mkdir -p .cursor/rules
|
|
297
|
+
cp path/to/toonlab/agents/cursor/toonlab.mdc .cursor/rules/
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
See [`agents/README.md`](agents/README.md) for the full layout.
|
|
301
|
+
|
|
302
|
+
### 2. Connect MCP for asset discovery
|
|
303
|
+
|
|
304
|
+
Two servers, and they compose:
|
|
305
|
+
|
|
306
|
+
**Local (free, no account).** The stdio server included in this package
|
|
307
|
+
searches the built-in procedural catalog and public CC0 sources, reads your
|
|
308
|
+
saved presets and lab exports, generates seeded recipes, and imports assets
|
|
309
|
+
into a disk-backed `.toonlab/` workspace:
|
|
310
|
+
|
|
311
|
+
```json
|
|
312
|
+
{
|
|
313
|
+
"mcpServers": {
|
|
314
|
+
"toonlab-local": {
|
|
315
|
+
"command": "npx",
|
|
316
|
+
"args": ["-y", "@call-me-sensei/toonlab@latest", "--workspace", "/absolute/path/to/your-game/.toonlab"]
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
If you run the labs from a checkout (`npm run dev`), open
|
|
323
|
+
`http://localhost:5175/settings/` for a ready-made config instead. See
|
|
324
|
+
[Local MCP and workspace](docs/mcp.md).
|
|
325
|
+
|
|
326
|
+
**ToonLab Pro (remote, OAuth).** [toonlab.io](https://toonlab.io) hosts a
|
|
327
|
+
remote MCP server that adds an indexed CC0 asset search with ToonLab-styled
|
|
328
|
+
previews, AI generation (concept art, seamless textures, image→3D model
|
|
329
|
+
chaining) on credits, stored characters with reference-image consistency, and
|
|
330
|
+
your cloud library of presets and style bundles. Requires a Pro or Team plan.
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
# Claude Code
|
|
334
|
+
claude mcp add --transport http toonlab https://toonlab.io/mcp
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Other clients: add `https://toonlab.io/mcp` as a remote MCP server and
|
|
338
|
+
authorize in the browser. Full client-by-client setup and a tool reference
|
|
339
|
+
live at [toonlab.io/docs/mcp](https://toonlab.io/docs/mcp).
|
|
340
|
+
|
|
341
|
+
### 3. The first prompt
|
|
342
|
+
|
|
343
|
+
Give the agent a goal, name the skill, and let it verify its own work:
|
|
344
|
+
|
|
345
|
+
```text
|
|
346
|
+
Using the ToonLab game-dev skill, set up a new Three.js + Vite project with
|
|
347
|
+
@call-me-sensei/toonlab. Build a 1 km seeded open world (archetype
|
|
348
|
+
"lakeland") with the bundled toon-shaded mannequin as the playable character,
|
|
349
|
+
water, sky, the "call_me_sensei" weather preset, post-processing, and a
|
|
350
|
+
follow camera with game feel. Follow the skill's assembly order and
|
|
351
|
+
frame-loop contract, then run the dev server and fix issues until I can walk
|
|
352
|
+
from spawn to the shoreline and swim.
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### 4. Prompts for common jobs
|
|
356
|
+
|
|
357
|
+
```text
|
|
358
|
+
Use the ToonLab MCP server to find CC0 props for a small fishing village —
|
|
359
|
+
lanterns, crates, a pier — then place them with the propgen placement
|
|
360
|
+
pipeline so they are grounded, collided, and LOD'd. Add a torii gate near
|
|
361
|
+
the spawn using catalog.spawn.
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
```text
|
|
365
|
+
Using the ToonLab water skill, make the ocean stormier as the player sails
|
|
366
|
+
away from shore, and let them surf the plunging breakers near the reef.
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
```text
|
|
370
|
+
Generate a seamless mossy stone texture with texgen and apply it to the
|
|
371
|
+
shrine path. I want a hand-painted look with a five-stop cel ramp.
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
```text
|
|
375
|
+
Using the ToonLab weather + lighting skills, add a day/night cycle with a
|
|
376
|
+
thunderstorm that rolls in at dusk: wind picks up in the grass, rain streaks
|
|
377
|
+
the water, lightning drives the sky and light rig.
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
```text
|
|
381
|
+
Search my ToonLab library for the "sunset-festival" style bundle and apply
|
|
382
|
+
it across toon shading, sky, water, and post so the whole game matches it.
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
```text
|
|
386
|
+
Give the sword swing anime game feel: hit-stop, a camera punch, a trail
|
|
387
|
+
ribbon and impact sparks from vfxgen, and a white flash on hit.
|
|
388
|
+
```
|
|
189
389
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
390
|
+
A more extensive prompt cookbook — including the Pro generation and
|
|
391
|
+
character-consistency workflows — is at
|
|
392
|
+
[toonlab.io/docs/prompts](https://toonlab.io/docs/prompts).
|
|
193
393
|
|
|
194
394
|
## License
|
|
195
395
|
|