Cel Toon 3D (Rot Squad's shading and movement)
This style makes 3D look and move like 2D animation. It has two halves, and both are needed:
- Shading: light falls in three hard bands instead of a smooth gradient. The shadow band is painted a cooler colour (as in ink-and-paint cels) rather than going grey, a thin hard rim light picks out silhouettes, and dark outlines sit around every shape.
- Movement: bodies hold each pose for a couple of frames, about 12 new poses a second, like hand-drawn animation on twos. Meanwhile positions, the camera and physics stay smooth at the full frame rate. Poses are big and readable, snapping between key positions instead of easing smoothly.
It has no palette, textures or UI style of its own. Use any colours, any theme, any HUD. (Rot Squad also had halftone dots, a comic print filter, neon pop colours and comic lettering. Those are not part of this skill; leave them out unless the user asks.)
Start from the starter
assets/starter/ is a working project: a small grassy scene in everyday colours, four example
characters (dancing, waving, cheering, one walking a loop), tap-to-jump, and
day / golden-hour / night lighting buttons.
- Copy
assets/starter/into the new project folder. npm install, thennpm run dev(builds todist/and serves http://127.0.0.1:5180).- Check the look is there, then replace
buildWorld()and thecastinsrc/main.jswith the game. Leavesrc/toon/as it is unless you're deliberately changing the style.
| File | Holds |
|---|---|
src/toon/shading.js | celMaterial, outlines (inkMaterial, inkShellMaterial), Kit (low-poly parts with outlines), toonify() for imported models, gradient sky, LIGHT_PRESETS + applyLight, EdgePass (inner lines), Quality |
src/toon/rig.js | 9-bone rig, assemble(), example makeHumanoid(look) + LOOKS, poseHumanoid() with on-twos timing, flash() |
src/main.js | Renderer, lights and pass setup, plus the demo |
To add the style to an existing three.js game, copy src/toon/ and the renderer, light and pass
setup from the top of src/main.js.
Shading: what to keep
- Renderer:
outputColorSpace = SRGBColorSpaceandtoneMapping = NoToneMapping(filmic tone mapping smears the hard bands into gradients), PCF shadows (crisp-edged cast shadows read as painted shapes),autoClear = falsefor the edge pass. celMaterialon every solid surface: a 3-texel gradient map with nearest filtering gives the bands. The darkest band is mixed towardshared.shadowTint(a cool blue/violet, never grey). A stepped rim light (step(0.66, …)) adds the edge highlight, andmaterial.userData.flashturns a character white when hit. It needs vertex colours plus anaGlowattribute: Kit parts already have them, and anything else goes throughtoonReady(geometry)ortoonify(object).- Outlines around every solid part, in a very dark, slightly coloured ink (
INK), not pure black. Kit builds them as back-face hulls. Widths: characters 0.034, props 0.045, big ground 0.08, eyes 0.018, tiny details 0.EdgePassadds inner and far lines from depth jumps; it's optional but helps at a distance. Skipping outlines entirely gives a softer anime/Fortnite read: set Kitink: 0and render withoutEdgePass. - Lighting: a strong hemisphere light does most of the fill (sky colour above, bounce colour
below), plus one shadow-casting sun, fog in the horizon colour, and a shadow tint and rim
colour that match the mood.
LIGHT_PRESETShasday,goldenandnight. Add your own with the same fields (references/shading.mdexplains each). - Quality steps down on slow frames (2 = edges + shadows, 1 = edges, 0 = plain), with pixel ratio capped at 1.5. That's what keeps it smooth on phones.
Movement: what to keep
-
On twos: pose functions run every frame, but they return early unless the 12-fps tick changed, and all pose maths uses the stepped time
t = tick / POSE_FPS:const tick = Math.floor(now / (1000 / POSE_FPS) + a.phase * 0.5); // phase de-syncs crowds if (tick === a.poseClock) return; a.poseClock = tick; const t = tick / POSE_FPS;Move the character's group (position, facing, jumping) every frame as usual. Only the limbs step.
-
Big key poses: limb angles of 0.4–1.2 rad, anticipation then action (wind up over ~55% of the cycle, snap through the rest), small overshoot jitter on held poses, small root bobs (0.05–0.12). Snap between poses rather than tweening.
-
Effects follow the same beat: anything that grows or pops (hit sparks, dust puffs, UI pops) changes size in held steps (about every 83 ms) instead of smoothly.
-
poseHumanoid(actor, now, { speed, airborne, down, emote, emoteT })already covers idle, walk to run (blended by speed), jump, crawl, dance, cheer, wave, sad and bonk.references/animation.mdhas the recipes and how to write new ones (attacks, enemies, bosses).
Models
Any model works with this look; the shading and movement carry the style.
- Built in code (fast and consistent):
Kitmerges low-poly parts (boxes, 4–8-sided cylinders and cones, low-detail balls, tori) with outlines into one mesh. For characters, tag each part with a rigboneand callassemble(kit.build(), rigDef(scale, proportions)), with no weight painting.makeHumanoid(look)is a ready example (a chunky ~1.9-unit body with a big head and big hands; switches for build, eyes, hair, hats, cape/tail/backpack). - Imported (GLTF from Blender, Mixamo or AI model tools):
toonify(gltf.scene, { ink })swaps incelMaterial(keeping colours and texture maps) and adds an outline shell that follows the skeleton. Use ink ≈ 2% of the model's height. Play its animations through anAnimationMixerthat only advances on the 12-fps tick, to keep the on-twos feel. - Flat colours and chunky shapes suit the look best. Detailed photo-textured models fight the bands.
references/models.md covers the Kit API, the rig, part recipes (faces, hands, shoes, hair) and
how Rot Squad built its zombies and boss.
Before you call it done
Take screenshots and look at them (headless Chromium needs --use-angle=swiftshader):
- Light falls in clear bands with a hard edge, and shadow sides are a cool colour, not grey.
- Outlines are visible around characters and props (unless deliberately turned off).
- Limbs move in visible steps (about 12 per second) while the character slides smoothly across the ground.
- Colours look as authored: tone mapping is off.
References
references/shading.md: every shading number (bands, shadow tint, rim, outline widths, edge pass), light preset fields, camera and scale, performance tiers.references/animation.md: on-twos timing, pose recipes, writing new poses, effect timing.references/models.md: Kit API, the rig, part recipes, enemies and bosses, imported models.
The style comes from Rot Squad, a co-op browser game: its characters, enemies and boss were built with the same Kit and rig, and its shading is this library plus a comic print filter.