[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79QDXHHNZM4A66RYDT0PV9X":3,"skill-same:01M79QDXHHNZM4A66RYDT0PV9X":51},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M79QDXHHNZM4A66RYDT0PV9X","threejs-scene-setup",null,"Stand up a three.js scene: import maps and the three\u002Faddons path, the Scene\u002FPerspectiveCamera\u002FWebGLRenderer trio, the setAnimationLoop render loop, responsive resize, OrbitControls, and opting into WebGPURenderer. Use when starting or debugging a three.js app — when the user mentions three.js, THREE.Scene, WebGLRenderer, WebGPURenderer, PerspectiveCamera, the render loop, resizing, or OrbitControls. For models use threejs-gltf-loading; for materials\u002Flights use threejs-materials-lighting.","JunMystery\u002FAgent-Guidance","JunMystery","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F161468934?v=4","01M79MTMV8F0BY8NK1A92RA8A0","Jun","01M79MTMWCFBKPHN5B25E6V20B",0,"MIT","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fthreejs-scene-setup\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: threejs-scene-setup\ndescription: >\n  Stand up a three.js scene: import maps and the three\u002Faddons path, the\n  Scene\u002FPerspectiveCamera\u002FWebGLRenderer trio, the setAnimationLoop render loop,\n  responsive resize, OrbitControls, and opting into WebGPURenderer. Use when\n  starting or debugging a three.js app — when the user mentions three.js,\n  THREE.Scene, WebGLRenderer, WebGPURenderer, PerspectiveCamera, the render loop,\n  resizing, or OrbitControls. For models use\n  threejs-gltf-loading; for materials\u002Flights use threejs-materials-lighting.\n---\n\n# three.js Scene Setup\n\nCreate the foundation of a three.js app: module loading, the\nscene\u002Fcamera\u002Frenderer trio, the render loop, responsive resizing, and camera\ncontrols. Patterns target **r186**. Read the installed `three` version before\nchanging an existing project because examples and addons move across releases.\n\n## When to use\n\n- Use when bootstrapping a three.js scene, fixing a blank\u002Fblack canvas, making the\n  canvas responsive, setting up the animation loop, or adding `OrbitControls`.\n- Use when `package.json` depends on `three` and code does `import * as THREE from\n  'three'`.\n\n**When *not* to use:** loading `.gltf`\u002F`.glb` models or skinned animation →\n`threejs-gltf-loading`. Materials, lights, shadows, environment maps →\n`threejs-materials-lighting`. 2D rendering → `pixijs-rendering`.\n\n## Core workflow\n\n1. **Load three.js as an ES module with an import map.** Since r137 the bare\n   specifier `'three'` must be resolved by an import map (in HTML) or a bundler;\n   map `'three\u002Faddons\u002F'` too. Addons (controls, loaders) live under\n   `three\u002Faddons\u002F...`.\n2. **Create the trio.** A `Scene` (root of the graph), a `PerspectiveCamera(fov,\n   aspect, near, far)` moved back from the origin, and a `WebGLRenderer` whose\n   `domElement` is in the DOM. Set size and `pixelRatio`.\n3. **Add a mesh.** `new Mesh(geometry, material)` and `scene.add(mesh)`. With a\n   lit material you also need a light (see `threejs-materials-lighting`).\n4. **Drive a render loop with `renderer.setAnimationLoop(fn)`.** It's the modern,\n   WebXR-\u002FWebGPU-safe replacement for hand-rolled `requestAnimationFrame`. Use a\n   `Timer` for delta time (`Clock` is deprecated since r183).\n5. **Handle resize** so the camera aspect and renderer match the canvas; update\n   `camera.aspect`, call `updateProjectionMatrix()`, and `renderer.setSize(...)`.\n6. **Add `OrbitControls`** for orbit\u002Fpan\u002Fzoom while developing. Confirm something\n   actually renders (a lit cube, the controls responding) before assuming success.\n\n## Patterns\n\n### 1. HTML import map + module entry (no bundler)\n\n```html\n\u003Ccanvas id=\"c\">\u003C\u002Fcanvas>\n\u003Cscript type=\"importmap\">\n{\n  \"imports\": {\n    \"three\": \"https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fthree@0.186.1\u002Fbuild\u002Fthree.module.js\",\n    \"three\u002Faddons\u002F\": \"https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fthree@0.186.1\u002Fexamples\u002Fjsm\u002F\"\n  }\n}\n\u003C\u002Fscript>\n\u003Cscript type=\"module\" src=\".\u002Fmain.js\">\u003C\u002Fscript>\n```\n\nWith a bundler (Vite\u002Fwebpack), skip the import map and just\n`npm i three`; the same `import` statements resolve.\n\n### 2. Scene + camera + renderer\n\n```js\n\u002F\u002F main.js\nimport * as THREE from 'three';\n\nconst canvas = document.querySelector('#c');\nconst renderer = new THREE.WebGLRenderer({ canvas, antialias: true });\nrenderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5)); \u002F\u002F starting budget; profile on target hardware\nrenderer.setSize(window.innerWidth, window.innerHeight);\n\nconst scene = new THREE.Scene();\nscene.background = new THREE.Color(0x101018);\n\nconst camera = new THREE.PerspectiveCamera(\n  60,                                   \u002F\u002F vertical field of view (degrees)\n  window.innerWidth \u002F window.innerHeight, \u002F\u002F aspect\n  0.1,                                  \u002F\u002F near\n  100                                   \u002F\u002F far\n);\ncamera.position.set(3, 2, 5);\ncamera.lookAt(0, 0, 0);\n\nconst cube = new THREE.Mesh(\n  new THREE.BoxGeometry(1, 1, 1),\n  new THREE.MeshNormalMaterial()        \u002F\u002F unlit; shows orientation without a light\n);\nscene.add(cube);\n```\n\n### 3. The render loop (setAnimationLoop + Timer)\n\n```js\nconst timer = new THREE.Timer();        \u002F\u002F replaces the deprecated THREE.Clock (r183+)\ntimer.connect(document);                \u002F\u002F optional: no huge delta after a hidden tab\n\nrenderer.setAnimationLoop(() => {\n  timer.update();                      \u002F\u002F use performance.now(), like visibility reset\n  const dt = Math.min(Math.max(timer.getDelta(), 0), 0.1); \u002F\u002F seconds; bound stalls and negative deltas\n  cube.rotation.x += dt;                \u002F\u002F frame-rate independent\n  cube.rotation.y += dt * 0.7;\n  renderer.render(scene, camera);\n});\n\u002F\u002F renderer.setAnimationLoop(null); \u002F\u002F stop the loop\n\u002F\u002F timer.dispose();                 \u002F\u002F remove visibility listener when tearing down\n```\n\nIn r186, visibility reset samples `performance.now()`. A supplied animation-frame\ntimestamp can precede that reset and produce a negative delta. Using `update()`\nkeeps the clock source consistent; the lower clamp also protects a fixed-step\naccumulator. Feed the bounded `dt` into simulation, not raw `getDelta()`.\nThe 0.1-second upper bound deliberately drops excess time after a stall; tune it\nto the game's catch-up policy rather than using it for real-world deadlines.\n\n### 4. Responsive resize\n\n```js\nfunction onResize() {\n  const w = window.innerWidth, h = window.innerHeight;\n  camera.aspect = w \u002F h;\n  camera.updateProjectionMatrix();      \u002F\u002F required after changing aspect\n  renderer.setSize(w, h);\n}\nwindow.addEventListener('resize', onResize);\n```\n\n### 5. OrbitControls (orbit \u002F pan \u002F zoom)\n\n```js\nimport { OrbitControls } from 'three\u002Faddons\u002Fcontrols\u002FOrbitControls.js';\n\nconst controls = new OrbitControls(camera, renderer.domElement);\ncontrols.enableDamping = true;          \u002F\u002F inertial feel\ncontrols.target.set(0, 0, 0);\n\nrenderer.setAnimationLoop(() => {\n  controls.update();                    \u002F\u002F needed every frame when damping is on\n  renderer.render(scene, camera);\n});\n```\n\n### 6. Opting into WebGPURenderer (only when you need it)\n\n`WebGLRenderer` stays the default choice for compatibility. Switch to\n`WebGPURenderer` when the project needs TSL node materials or compute shaders; it\nfalls back to a WebGL 2 backend where WebGPU is unavailable.\n\n```js\n\u002F\u002F Official WebGPU examples map both \"three\" and \"three\u002Fwebgpu\" to\n\u002F\u002F build\u002Fthree.webgpu.js, plus \"three\u002Ftsl\" to build\u002Fthree.tsl.js.\nimport * as THREE from 'three\u002Fwebgpu';\n\nconst renderer = new THREE.WebGPURenderer({ antialias: true });\nrenderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5)); \u002F\u002F starting budget; profile on target hardware\nrenderer.setSize(window.innerWidth, window.innerHeight);\ndocument.body.appendChild(renderer.domElement);\nawait renderer.init();                  \u002F\u002F required before direct render()\u002Fcompute()\n\nrenderer.setAnimationLoop(() => renderer.render(scene, camera));\n```\n\nScenes, cameras, built-in `Mesh*Material`s, and most addons carry over; custom\nGLSL (`ShaderMaterial`, `onBeforeCompile`) does not.\n\n### 7. Resolution is a performance budget\n\nA ratio of 2 draws four times as many pixels as 1 at the same CSS size. A cap\nof 2 does nothing on a 2× display. Start games around 1.25–1.5, expose a resolution\nsetting, and profile the target device; these are tuning defaults, not an FPS guarantee.\nLower resolution helps fill-rate bottlenecks, not CPU-bound simulation.\n\nFor adaptive resolution, measure several seconds of frame time after assets and\nshader warm-up. Ignore hidden-tab intervals and loading stalls. If sustained\nGPU\u002Ffill-rate pressure exceeds the budget, lower the ratio in 0.25 steps to a\nchosen floor (for example 1), never above the device ratio or user setting.\nUse a cooldown and a separate recovery threshold before raising it again to avoid\noscillation. Reapply the chosen ratio on display\u002FDPR changes and resize render\ntargets or postprocessing buffers consistently with the renderer.\n\n## Pitfalls\n\n- **`Failed to resolve module specifier \"three\"`** → missing import map (or bundler\n  config). Map both `\"three\"` and `\"three\u002Faddons\u002F\"`; addon paths must end with `\u002F`.\n- **Black canvas, no errors** → camera is at the origin (inside\u002Fbehind the object),\n  or you used a lit material (`MeshStandardMaterial`) with no light. Move the camera\n  back; use `MeshNormalMaterial`\u002F`MeshBasicMaterial` to verify geometry first.\n- **Nothing animates** → you never called `renderer.render` inside the loop, or you\n  call `setAnimationLoop` but render outside it.\n- **Stretched \u002F squashed view on resize** → you resized the renderer but didn't\n  update `camera.aspect` + `updateProjectionMatrix()`.\n- **Blurry or slow on HiDPI** → balance sharpness against fill rate with a resolution\n  setting. Start around 1.25–1.5; a cap of 2 still renders 4× the pixels of 1×.\n- **Simulation freezes after restoring a tab** → r186 can mix a frame timestamp\n  with visibility-reset time. Use `timer.update()` and clamp simulation delta to\n  `[0, 0.1]` as above so a negative delta cannot drain the fixed-step accumulator.\n- **OrbitControls feel dead** → with `enableDamping = true` you must call\n  `controls.update()` every frame.\n- **Old tutorials use `\u003Cscript src=\"three.min.js\">` or `examples\u002Fjs\u002F...`** →\n  `examples\u002Fjs` was removed in r148 and `build\u002Fthree.min.js` in r161; use\n  `type=\"module\"` + import maps.\n- **`.render() called before the backend is initialized`** (WebGPURenderer) → call\n  `await renderer.init()` before any direct `render()`\u002F`compute()`, or render only\n  from `setAnimationLoop`, which initializes first.\n- **`Material \"ShaderMaterial\" is not compatible`, or an `onBeforeCompile` patch is\n  ignored** (WebGPURenderer) → it renders node materials only; port the effect to\n  TSL, or stay on `WebGLRenderer`.\n\n## References\n\n- Primary sources: [r186 Timer implementation](https:\u002F\u002Fgithub.com\u002Fmrdoob\u002Fthree.js\u002Fblob\u002Fr186\u002Fsrc\u002Fcore\u002FTimer.js)\n  and [r186 responsive rendering manual](https:\u002F\u002Fgithub.com\u002Fmrdoob\u002Fthree.js\u002Fblob\u002Fr186\u002Fmanual\u002Fpages\u002Fresponsive.html).\n\n- For coordinate conventions, the scene-graph (`Group`, parent\u002Fchild transforms,\n  `Object3D` add\u002Fremove), `OrthographicCamera` for 2.5D, and disposing of\n  geometries\u002Fmaterials\u002Ftextures to avoid leaks, read `references\u002Fscene-graph.md`.\n\n## Related skills\n\n- `threejs-materials-lighting` — give surfaces a lit look (lights, shadows, PBR).\n- `threejs-gltf-loading` — load 3D models and play their animations.\n- `pixijs-rendering` — 2D rendering in the browser.\n- `fps-shooter` — a 3D genre template that composes three.js skills.\n","# three.js Scene Setup\n\nCreate the foundation of a three.js app: module loading, the\nscene\u002Fcamera\u002Frenderer trio, the render loop, responsive resizing, and camera\ncontrols. Patterns target **r186**. Read the installed `three` version before\nchanging an existing project because examples and addons move across releases.\n\n## When to use\n\n- Use when bootstrapping a three.js scene, fixing a blank\u002Fblack canvas, making the\n  canvas responsive, setting up the animation loop, or adding `OrbitControls`.\n- Use when `package.json` depends on `three` and code does `import * as THREE from\n  'three'`.\n\n**When *not* to use:** loading `.gltf`\u002F`.glb` models or skinned animation →\n`threejs-gltf-loading`. Materials, lights, shadows, environment maps →\n`threejs-materials-lighting`. 2D rendering → `pixijs-rendering`.\n\n## Core workflow\n\n1. **Load three.js as an ES module with an import map.** Since r137 the bare\n   specifier `'three'` must be resolved by an import map (in HTML) or a bundler;\n   map `'three\u002Faddons\u002F'` too. Addons (controls, loaders) live under\n   `three\u002Faddons\u002F...`.\n2. **Create the trio.** A `Scene` (root of the graph), a `PerspectiveCamera(fov,\n   aspect, near, far)` moved back from the origin, and a `WebGLRenderer` whose\n   `domElement` is in the DOM. Set size and `pixelRatio`.\n3. **Add a mesh.** `new Mesh(geometry, material)` and `scene.add(mesh)`. With a\n   lit material you also need a light (see `threejs-materials-lighting`).\n4. **Drive a render loop with `renderer.setAnimationLoop(fn)`.** It's the modern,\n   WebXR-\u002FWebGPU-safe replacement for hand-rolled `requestAnimationFrame`. Use a\n   `Timer` for delta time (`Clock` is deprecated since r183).\n5. **Handle resize** so the camera aspect and renderer match the canvas; update\n   `camera.aspect`, call `updateProjectionMatrix()`, and `renderer.setSize(...)`.\n6. **Add `OrbitControls`** for orbit\u002Fpan\u002Fzoom while developing. Confirm something\n   actually renders (a lit cube, the controls responding) before assuming success.\n\n## Patterns\n\n### 1. HTML import map + module entry (no bundler)\n\n```html\n\u003Ccanvas id=\"c\">\u003C\u002Fcanvas>\n\u003Cscript type=\"importmap\">\n{\n  \"imports\": {\n    \"three\": \"https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fthree@0.186.1\u002Fbuild\u002Fthree.module.js\",\n    \"three\u002Faddons\u002F\": \"https:\u002F\u002Fcdn.jsdelivr.net\u002Fnpm\u002Fthree@0.186.1\u002Fexamples\u002Fjsm\u002F\"\n  }\n}\n\u003C\u002Fscript>\n\u003Cscript type=\"module\" src=\".\u002Fmain.js\">\u003C\u002Fscript>\n```\n\nWith a bundler (Vite\u002Fwebpack), skip the import map and just\n`npm i three`; the same `import` statements resolve.\n\n### 2. Scene + camera + renderer\n\n```js\n\u002F\u002F main.js\nimport * as THREE from 'three';\n\nconst canvas = document.querySelector('#c');\nconst renderer = new THREE.WebGLRenderer({ canvas, antialias: true });\nrenderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5)); \u002F\u002F starting budget; profile on target hardware\nrenderer.setSize(window.innerWidth, window.innerHeight);\n\nconst scene = new THREE.Scene();\nscene.background = new THREE.Color(0x101018);\n\nconst camera = new THREE.PerspectiveCamera(\n  60,                                   \u002F\u002F vertical field of view (degrees)\n  window.innerWidth \u002F window.innerHeight, \u002F\u002F aspect\n  0.1,                                  \u002F\u002F near\n  100                                   \u002F\u002F far\n);\ncamera.position.set(3, 2, 5);\ncamera.lookAt(0, 0, 0);\n\nconst cube = new THREE.Mesh(\n  new THREE.BoxGeometry(1, 1, 1),\n  new THREE.MeshNormalMaterial()        \u002F\u002F unlit; shows orientation without a light\n);\nscene.add(cube);\n```\n\n### 3. The render loop (setAnimationLoop + Timer)\n\n```js\nconst timer = new THREE.Timer();        \u002F\u002F replaces the deprecated THREE.Clock (r183+)\ntimer.connect(document);                \u002F\u002F optional: no huge delta after a hidden tab\n\nrenderer.setAnimationLoop(() => {\n  timer.update();                      \u002F\u002F use performance.now(), like visibility reset\n  const dt = Math.min(Math.max(timer.getDelta(), 0), 0.1); \u002F\u002F seconds; bound stalls and negative deltas\n  cube.rotation.x += dt;                \u002F\u002F frame-rate independent\n  cube.rotation.y += dt * 0.7;\n  renderer.render(scene, camera);\n});\n\u002F\u002F renderer.setAnimationLoop(null); \u002F\u002F stop the loop\n\u002F\u002F timer.dispose();                 \u002F\u002F remove visibility listener when tearing down\n```\n\nIn r186, visibility reset samples `performance.now()`. A supplied animation-frame\ntimestamp can precede that reset and produce a negative delta. Using `update()`\nkeeps the clock source consistent; the lower clamp also protects a fixed-step\naccumulator. Feed the bounded `dt` into simulation, not raw `getDelta()`.\nThe 0.1-second upper bound deliberately drops excess time after a stall; tune it\nto the game's catch-up policy rather than using it for real-world deadlines.\n\n### 4. Responsive resize\n\n```js\nfunction onResize() {\n  const w = window.innerWidth, h = window.innerHeight;\n  camera.aspect = w \u002F h;\n  camera.updateProjectionMatrix();      \u002F\u002F required after changing aspect\n  renderer.setSize(w, h);\n}\nwindow.addEventListener('resize', onResize);\n```\n\n### 5. OrbitControls (orbit \u002F pan \u002F zoom)\n\n```js\nimport { OrbitControls } from 'three\u002Faddons\u002Fcontrols\u002FOrbitControls.js';\n\nconst controls = new OrbitControls(camera, renderer.domElement);\ncontrols.enableDamping = true;          \u002F\u002F inertial feel\ncontrols.target.set(0, 0, 0);\n\nrenderer.setAnimationLoop(() => {\n  controls.update();                    \u002F\u002F needed every frame when damping is on\n  renderer.render(scene, camera);\n});\n```\n\n### 6. Opting into WebGPURenderer (only when you need it)\n\n`WebGLRenderer` stays the default choice for compatibility. Switch to\n`WebGPURenderer` when the project needs TSL node materials or compute shaders; it\nfalls back to a WebGL 2 backend where WebGPU is unavailable.\n\n```js\n\u002F\u002F Official WebGPU examples map both \"three\" and \"three\u002Fwebgpu\" to\n\u002F\u002F build\u002Fthree.webgpu.js, plus \"three\u002Ftsl\" to build\u002Fthree.tsl.js.\nimport * as THREE from 'three\u002Fwebgpu';\n\nconst renderer = new THREE.WebGPURenderer({ antialias: true });\nrenderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5)); \u002F\u002F starting budget; profile on target hardware\nrenderer.setSize(window.innerWidth, window.innerHeight);\ndocument.body.appendChild(renderer.domElement);\nawait renderer.init();                  \u002F\u002F required before direct render()\u002Fcompute()\n\nrenderer.setAnimationLoop(() => renderer.render(scene, camera));\n```\n\nScenes, cameras, built-in `Mesh*Material`s, and most addons carry over; custom\nGLSL (`ShaderMaterial`, `onBeforeCompile`) does not.\n\n### 7. Resolution is a performance budget\n\nA ratio of 2 draws four times as many pixels as 1 at the same CSS size. A cap\nof 2 does nothing on a 2× display. Start games around 1.25–1.5, expose a resolution\nsetting, and profile the target device; these are tuning defaults, not an FPS guarantee.\nLower resolution helps fill-rate bottlenecks, not CPU-bound simulation.\n\nFor adaptive resolution, measure several seconds of frame time after assets and\nshader warm-up. Ignore hidden-tab intervals and loading stalls. If sustained\nGPU\u002Ffill-rate pressure exceeds the budget, lower the ratio in 0.25 steps to a\nchosen floor (for example 1), never above the device ratio or user setting.\nUse a cooldown and a separate recovery threshold before raising it again to avoid\noscillation. Reapply the chosen ratio on display\u002FDPR changes and resize render\ntargets or postprocessing buffers consistently with the renderer.\n\n## Pitfalls\n\n- **`Failed to resolve module specifier \"three\"`** → missing import map (or bundler\n  config). Map both `\"three\"` and `\"three\u002Faddons\u002F\"`; addon paths must end with `\u002F`.\n- **Black canvas, no errors** → camera is at the origin (inside\u002Fbehind the object),\n  or you used a lit material (`MeshStandardMaterial`) with no light. Move the camera\n  back; use `MeshNormalMaterial`\u002F`MeshBasicMaterial` to verify geometry first.\n- **Nothing animates** → you never called `renderer.render` inside the loop, or you\n  call `setAnimationLoop` but render outside it.\n- **Stretched \u002F squashed view on resize** → you resized the renderer but didn't\n  update `camera.aspect` + `updateProjectionMatrix()`.\n- **Blurry or slow on HiDPI** → balance sharpness against fill rate with a resolution\n  setting. Start around 1.25–1.5; a cap of 2 still renders 4× the pixels of 1×.\n- **Simulation freezes after restoring a tab** → r186 can mix a frame timestamp\n  with visibility-reset time. Use `timer.update()` and clamp simulation delta to\n  `[0, 0.1]` as above so a negative delta cannot drain the fixed-step accumulator.\n- **OrbitControls feel dead** → with `enableDamping = true` you must call\n  `controls.update()` every frame.\n- **Old tutorials use `\u003Cscript src=\"three.min.js\">` or `examples\u002Fjs\u002F...`** →\n  `examples\u002Fjs` was removed in r148 and `build\u002Fthree.min.js` in r161; use\n  `type=\"module\"` + import maps.\n- **`.render() called before the backend is initialized`** (WebGPURenderer) → call\n  `await renderer.init()` before any direct `render()`\u002F`compute()`, or render only\n  from `setAnimationLoop`, which initializes first.\n- **`Material \"ShaderMaterial\" is not compatible`, or an `onBeforeCompile` patch is\n  ignored** (WebGPURenderer) → it renders node materials only; port the effect to\n  TSL, or stay on `WebGLRenderer`.\n\n## References\n\n- Primary sources: [r186 Timer implementation](https:\u002F\u002Fgithub.com\u002Fmrdoob\u002Fthree.js\u002Fblob\u002Fr186\u002Fsrc\u002Fcore\u002FTimer.js)\n  and [r186 responsive rendering manual](https:\u002F\u002Fgithub.com\u002Fmrdoob\u002Fthree.js\u002Fblob\u002Fr186\u002Fmanual\u002Fpages\u002Fresponsive.html).\n\n- For coordinate conventions, the scene-graph (`Group`, parent\u002Fchild transforms,\n  `Object3D` add\u002Fremove), `OrthographicCamera` for 2.5D, and disposing of\n  geometries\u002Fmaterials\u002Ftextures to avoid leaks, read `references\u002Fscene-graph.md`.\n\n## Related skills\n\n- `threejs-materials-lighting` — give surfaces a lit look (lights, shadows, PBR).\n- `threejs-gltf-loading` — load 3D models and play their animations.\n- `pixijs-rendering` — 2D rendering in the browser.\n- `fps-shooter` — a 3D genre template that composes three.js skills.\n",{"name":5,"description":7},"main","5d0a87185c0e172c3901e2a6e5916b6d544b8b94","skills\u002Fthreejs-scene-setup","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance","https:\u002F\u002Fgithub.com\u002FJunMystery","AI is the typist, I am the architect. Building efficient, secure, and user-centric products through disciplined AI prompt engineering.","2026-11-13 17:41:25",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add JunMystery\u002FAgent-Guidance --skill threejs-scene-setup",{"tool":37,"command":38},"bunx","bunx skills add JunMystery\u002FAgent-Guidance --skill threejs-scene-setup",{"tool":40,"command":41},"pnpm","pnpm dlx skills add JunMystery\u002FAgent-Guidance --skill threejs-scene-setup","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fthreejs-scene-setup\u002FSKILL.md",true,[45],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"references\u002Fscene-graph.md","REFERENCE","参考文档",4859,"https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fthreejs-scene-setup\u002Freferences\u002Fscene-graph.md",[52,58,64,70,76,82],{"skillNo":53,"name":54,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M79QR1E309VJ6CTQKB32AWWA","zero-trust-architecture-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fzero-trust-architecture-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M79QQV7GHYR02DYGN41S23WN","xss-filter-evasion-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxss-filter-evasion-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M79QQNSN7YB8XB61FFSCS3WH","xs-leaks-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxs-leaks-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M79QQHZZJKFDY9132G5A65C2","xpath-injection-prevention-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxpath-injection-prevention-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M79QQB9ZSD3DJG8658EHQXR1","xml-security-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxml-security-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M79QQ60WKV7PFMXWT9CW8PM6","xml-external-entity-prevention-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxml-external-entity-prevention-cheat-sheet\u002FSKILL.md",[],[]]