Skip to content
SkillModel-led2,748 tokens in use

threejs-scene-setup

Set up and debug a three.js r187 scene: import maps, camera and renderer, a Timer render loop, resize, OrbitControls and WebGPURenderer.

9,684 stars on the repository Apache License 2.0gamedev-skills/awesome-gamedev-agent-skills · skills/web-engines/threejs-scene-setup
npx skills add gamedev-skills/awesome-gamedev-agent-skills
View source

Install command as written in the repository's README

Skill label

measured from its files

What installing threejs-scene-setup costs

98tokens idle
2,748tokens in use
4,143tokens, up to

Idle is what sits in context while the skill is installed. In use is its instructions, loaded when it runs. Up to adds the files its instructions link. Counts are approximate, made offline with cl100k_base.

Model dependence Model-led

Script-ledMixedModel-led

Mostly instructions, so how well it works depends on the model that follows them.

This describes the skill's structure, how much of it is scripts. It does not say how well it works.

Touches

shelldetected

Declared tags come from the skill's frontmatter; detected ones from its scripts, its code blocks and the commands it names in inline code. This is detected, not audited.

How it scores

Quality

How well the skill is written, counted from its own files: its frontmatter, its steps, examples, stated output and constraints, its size and whether every file it ships is one it names.How we score it →
Excellent
  • Frontmatter8/15
  • Structure25/25
  • Examples15/15
  • Output15/15
  • Size15/15
  • Resources15/15

Security

Starts at 100 and loses points for each thing in the skill's files that a reader should look at first.How we score it →
Excellent

No findings.

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Good
  • Development activity92
  • Maintenance96
  • Community60
  • Maturity24
  • Momentum40

This skill gives a coding agent the base every three.js game needs: module loading through an import map or bundler, a scene, camera and renderer, one render loop driven by setAnimationLoop with a clamped Timer delta, and resize handling. It proves the pipeline with an unlit mesh before any lighting is added.

It targets three.js r187 and reads the installed version first. It also covers a pixel ratio budget for phones and HiDPI screens, a switch to WebGPURenderer when node materials are needed, and a headless smoke test that checks draw calls and survives a lost WebGL context.

What You Get

  • Six code patterns: an import map without a bundler, scene camera and renderer, a Timer render loop, resize, OrbitControls and a WebGPURenderer start
  • A smoke.mjs script that fails on page errors, checks draw calls, saves screenshots and tests a lost and restored WebGL context
  • A gotcha list for module resolution errors, black canvases, stretched views after resize, frozen simulations after a hidden tab and OrbitControls damping
  • A reference on coordinates, Group parenting, orthographic cameras, disposing GPU resources, render on demand and adaptive resolution

Common Use Cases

  • Starting a new three.js game with a clean loop and resize handling
  • Fixing the error that three cannot be resolved as a module specifier
  • Finding why a canvas stays black with no console errors
  • Capping pixel ratio so a scene runs cool on phones

What Makes It Unique

The skill keeps game state in ordinary objects and copies it onto meshes each frame, so state can be saved and tested without a GPU. It documents a Timer quirk in r186 and r187 where a loop timestamp passed to update can give a negative delta, and its smoke test forces a WebGL context loss and restore to catch code that holds raw GPU objects.

Under The Hood

The agent loads the SKILL.md and reads the scene graph reference only when it needs depth. It edits your source and html, runs the project build or type check, and writes a smoke.mjs script. That script needs the Playwright package and a downloaded Chromium browser, installed through npm and npx commands; it opens your local dev server page in a headless browser and writes screenshot files. The example import map loads three.js from a public CDN, and the skill makes no other outside calls.

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers