/ghibli-threejs:threejs-ghibli-toon-shadingfrom ghibli-threejs
Patches three.js MeshStandardMaterial/MeshPhysicalMaterial with Studio Ghibli–style toon shading: banded diffuse, warm shadow fill, puff normals for foliage, backlit glow, rim light, painterly flecks, and world-space wind with moving shadows.
Ships in ghibli-threejs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Turns physically lit foliage into the soft-banded, sun-glowing canopy of a Ghibli background: each leaf clump shades as one puffy volume, light falls in 2–3 soft steps, leaves glow yellow-green when backlit, shadows are warm brown instead of grey, and everything sways with shadows that move in sync.
Stack: three.js WebGLRenderer (proven on r186), vanilla or R3F. Built materials (MeshStandardMaterial, MeshPhysicalMaterial, MeshDepthMaterial) are patched with onBeforeCompile so they keep three's shadows, fog, instancing and tone mapping. One shared uniform object means one lil-gui slider re-tunes every material at once.
MeshToonMaterial loses soft shadows/specular.Give the trees, bushes and leaves in
{{entry file}}an authentic Studio Ghibli look matching{{reference image}}. Use onepatch(material, options)helper aroundonBeforeCompilewith a single shared uniform object (options:toon,puff,flecks,rim,sss,bark,wind,flutter,fill), every value in a lil-gui "Ghibli Tune" folder.
- Puff normals: blend each leaf normal toward the vector from its clump centre,
normalize(mix(normal, sphereNormal, 0.6–0.8)). Baked GLB foliage has no clump data: derive a per-vertexclusterCenterwith seeded k-means over triangles (~36 clusters, 10 iterations). Blend afternormal_fragment_maps.- Banded toon light without banded shadows: inline
THREE.ShaderChunk.lights_fragment_begin,replaceAll('RE_Direct( directLight,', 'RE_Direct_Toon( directLight,'), scaledirectLight.colorbytoonRamp(ndl)/ndland call the stockRE_Direct_Physical. Inject the helper after#include <lights_physical_pars_fragment>.- Backlight SSS
pow(saturate(dot(-V, L)), 3) * translucencyin a warm yellow-green, a saturated rim on silhouettes, painterly object-space leaf flecks.- Warm shadow fill: record
gLit = ndl·shadowin the wrapper; afterlights_fragment_endaddalbedo · fillColour · fill · (1 − gLit).- Wind in a replaced
project_vertex, in world space afterinstanceMatrix: slow height-weighted sway + high-frequency flutter. Give every foliage mesh acustomDepthMaterialpatched with the identical wind.- Bark: warm painterly wood, vertical grain noise, darker at the roots and up inside the canopy. Screenshot close-up, eye-level and wide after each step and compare with the reference.
The complete helper is in references/ghibli-patch.js; k-means is in references/cluster-centers.js.
mat.customProgramCacheKey = () => JSON.stringify(options) — otherwise three shares one program between differently patched materials.#include <common>; set vLocal = position after begin_vertex (object-space coords for flecks/bark); replace project_vertex with instance → world → wind offset → view; replace worldpos_vertex so shadow lookups use the displaced wPos.common (defines + uniforms), lights_physical_pars_fragment (toon/SSS wrapper), lights_fragment_begin (inlined, with RE_Direct swapped — 4 call sites in r186: directional, point, spot, sun), lights_fragment_end (fill + rim), color_fragment (flecks, bark), normal_fragment_maps (puff).float toonRamp(float x){ float n = max(uBands,1.); float s = pow(x,.85)*n; float f = floor(s);
float t = smoothstep(.5-uSoft, .5+uSoft, fract(s)); return mix(x, clamp((f+t)/n,0.,1.), uToonMix); }
tl.color *= clamp(toonRamp(ndl)/max(ndl,1e-3), 0., 4.); // RE_Direct re-applies the cosine
Specular, clearcoat, sheen and PCF shadows stay stock. Values: bands 3, soft 0.10, mix 0.85.
| Uniform | Value | Note |
|---|---|---|
| puff blend | 0.72 | 0.6–0.8; >0.9 = plastic balls |
| translucency / SSS colour | 0.55 / 0xd6ff6a | natural GLB foliage: 0.24 / 0xc4dc8c |
| rim / colour | 0.30 / 0xbfff8a | pow(1-N·V,3), brighter toward the sun |
| fleck strength / scale | 0.55 / 3.2 per m | object space |
| shadow fill / colour | 0.14 / 0xffb27a | >~0.2 turns sunlit grass lime |
| hemisphere | sky 0xd9e6ff, ground 0x7d6a36, 0.55 | keep ambient strong and warm |
| bark warm / mix / grain | 0x8a5a36 / .35 / .45 | root AO .45 (0–1.8 m), canopy AO .30 (3.2–6.5 m) |
| wind sway / flutter | 1.0 / 0.035 m | flutter at outer leaf edges |
Pass GLSL expressions: e.g. trees wind: 'clamp((position.y-2.)*.06,0.,.6)*.22', flutter: '.55'; grass wind: 'position.y*position.y*.16'. The depth material:
leaves.customDepthMaterial = patch(new THREE.MeshDepthMaterial({ depthPacking: THREE.RGBADepthPacking,
side: THREE.DoubleSide, map: mat.map, alphaTest: mat.alphaTest }), { wind: w, flutter: fl })
k-means per triangle (so a card never straddles two clusters), seeded, 10 iterations, ~36 clusters → per-vertex clusterCenter in object space. In the vertex shader sN = normalize(position - clusterCenter), rotated by mat3(instanceMatrix) and normalMatrix; in the fragment shader blend after normal_fragment_maps so the double-sided face flip of the card survives.
customDepthMaterial leaves shadows frozen.clusterCenter) there too; weight displacement from position, never by reading a varying back in the vertex shader.ndl in a ramp(ndl)/ndl ramp below ~0.85 — grazing light gets boosted ~3× and the scene washes out.lights_physical_pars_fragment, never into a shared noise block that depth materials and custom ShaderMaterials also include (they have no PhysicalMaterial type → compile error).onBeforeCompile sees unexpanded #includes — that's why lights_fragment_begin must be inlined from THREE.ShaderChunk before the replaceAll.onBeforeCompile, inject helper GLSL before any code that calls it.position (vLocal). Compress GLBs with Draco, not meshopt: meshopt's quantisation moves position into a normalised range under a node transform.alphaTest (~0.5), not transparent: true (sorting glitches).flecks off for flowers/sakura.threejs-procedural-vegetation, threejs-ghibli-sky-clouds, threejs-postprocessing-anime-grade, threejs-ghibli-night-mode, threejs-stylized-rock-material.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
31 skills in this plugin
/threejs-blender-glb-pipelineBuilds a reference-image-driven asset pipeline from headless Blender to GLB for a three.js scene — an asset contract (units, axes, grounding, required mesh/material names, budgets, attachment numbers), one parallel subagent per asset group writing craft_<slug>.py generators, preview renders compared against the reference, measured-bounding-box placement in the web scene, Draco compression, and a scored asset quality pass. Use when the user has a reference picture and wants a 3D scene from it, asks to model props/trees/characters in Blender for three.js, export GLBs, fix glTF export issues (vertex-colour alpha, UV flip, axes, custom normals), compress models, or rate and improve every asset in a scene./threejs-boat-buoyancy-steeringFloats a boat (or any buoyant prop) on three.js water with Gerstner waves generated from one JS table that feeds both the GLSL vertex shader and a CPU waveHeight(), four-probe heave/pitch/roll damped springs, an arc-length drift lane that bends round rocks, click-to-steer W/A/S/D rowing with momentum and drag, an autopilot that pursues the lane back, and a chase camera that keeps the orbit. Use when the user wants a drifting or steerable boat, buoyancy, objects bobbing on waves, Gerstner waves on a river/lake, a boat autopilot, or a follow/chase camera behind a vehicle on water.npx claudepluginhub nicksonthc/ghibli-threejs --plugin ghibli-threejs