Three.js architecture: production-level scene/camera/renderer resize cleanup. Use when implementing, reviewing or testing three.js architecture for React, Vite, Next.js or Perfect_AI projects.
Installs into .claude/skills of the current project.
Are you the author of Zt Three Scene?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/realjustawall-zt-three-scene)
---
name: zt-three-scene
description: Three.js architecture: production-level scene/camera/renderer resize cleanup. Use when implementing, reviewing or testing three.js architecture for React, Vite, Next.js or Perfect_AI projects.
---
# Three.js architecture
## When to activate
Use on tasks involving **scene/camera/renderer resize cleanup**. For unrelated backend tasks do not load this skill.
## Implementation sequence
1. Choose perspective or orthographic camera, scene graph, model coordinate scale and render target.
2. Allocate geometry and materials outside render loop; use indexed/instanced buffers when repeated objects.
3. Constrain frame rendering to actual need, remove handlers and dispose GPU resources.
4. Integrate screen-space text as DOM accessible overlay and provide WebGL failure fallback.
5. Verify 320/375/768/1440, low end DPR=1 and interaction at 30/60FPS.
## Task-specific requirements
- Scope: **scene/camera/renderer resize cleanup**. Design the full execution path, not a screenshot placeholder.
- Identify dependency version and actual supported API signature; avoid inventing APIs.
- Use original code, or install licensed upstream through its maintained tool if the user wants upstream code.
- Choose measurable states, error handling, accessibility and performance budgets.
## Implementation starter
```ts
import * as THREE from 'three';
const scene=new THREE.Scene();
const camera=new THREE.PerspectiveCamera(40, 1, .1, 100);
camera.position.z=6;
const renderer=new THREE.WebGLRenderer({antialias:true,alpha:true});
renderer.setPixelRatio(Math.min(devicePixelRatio,1.5));
// On resize: renderer.setSize(width,height,false); camera.aspect=width/height; camera.updateProjectionMatrix();
// On unmount: renderer.dispose();
```
## Evidence / acceptance
- Renderer disposes; fallback provides content; no runaway GPU usage; no clipped subject at narrow widths.
- Test common, edge, interrupted, accessibility and responsive states; provide concrete artifacts/evidence.
## Deep references
- `../perfect-ai-master/references/02-threejs-3d.md`
- `../perfect-ai-master/references/13-threejs-animation-atlas.md`
- `../perfect-ai-master/references/17-threejs-production-guide.md`