Skip to content

marselo-4/TotAuto / .claude/skills/threejs-webgl

threejs-webgl

Verified

Comprehensive skill for Three.js 3D web development. Use this skill when building interactive 3D scenes, WebGL/WebGPU applications, product configurators, 3D visualizations, or immersive web experiences. Triggers on tasks involving Three.js, 3D rendering, scenes, cameras, meshes, materials, lights, animations, textures, or WebGL/WebGPU rendering.

assets/starter_scene/README.md

View on GitHub
# Three.js Starter Scene

A complete, production-ready Three.js boilerplate project with modern best practices.

## Features

✅ WebGL renderer with antialiasing
✅ PBR materials (MeshStandardMaterial)
✅ Shadow mapping
✅ Tone mapping (ACES Filmic)
✅ Orbit controls with damping
✅ Responsive design
✅ Loading screen
✅ Animated demo objects
✅ Performance optimizations

## Quick Start

### Option 1: Local Development

```bash
# Serve with any static server
python -m http.server 8000
# Or
npx serve
```

Open `http://localhost:8000` in your browser.

### Option 2: Add to Existing Project

Copy `index.html` and `main.js` to your project and customize as needed.

## Project Structure

```
starter_scene/
├── index.html    # HTML with embedded styles and import map
├── main.js       # Main Three.js scene setup
└── README.md     # This file
```

## Customization

### Change Background Color

```javascript
// In main.js
scene.background = new THREE.Color(0x1a1a2e); // Change hex color
```

### Add Your Own Objects

```javascript
// After existing objects in main.js
const myGeometry = new THREE.BoxGeometry(1, 1, 1);
const myMaterial = new THREE.MeshStandardMaterial({ color: 0xff0000 });
const myMesh = new THREE.Mesh(myGeometry, myMaterial);
myMesh.position.set(x, y, z);
myMesh.castShadow = true;
scene.add(myMesh);
```

### Load 3D Models

```javascript
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';

const loader = new GLTFLoader();
loader.load('model.glb', (gltf) => {
  scene.add(gltf.scene);
});
```

### Adjust Performance

```javascript
// Reduce pixel ratio for better performance
renderer.setPixelRatio(1);

// Disable shadows
renderer.shadowMap.enabled = false;

// Simplify materials
material.roughness = 1.0; // More matte = faster
```

## Built-in Demo

The starter scene includes:
- **Red Cube**: Rotating on multiple axes
- **Cyan Sphere**: Bobbing up and down
- **Yellow Torus**: Rotating ring
- **Animated Point Light**: Orbiting the scene
- **Grid Floor**: With shadows

## Controls

- **Left Click + Drag**: Orbit camera
- **Scroll**: Zoom in/out
- **Right Click + Drag**: Pan (if enabled)

## Browser Compatibility

- Chrome/Edge: ✅ Excellent
- Firefox: ✅ Excellent
- Safari: ✅ Good (WebGL only)

## Performance Tips

1. Reduce `renderer.setPixelRatio()` to 1 on mobile
2. Lower shadow map size for better FPS
3. Use simpler materials (MeshLambertMaterial) on mobile
4. Implement LOD for complex scenes
5. Use `InstancedMesh` for repeated objects

## Next Steps

1. Replace demo objects with your own content
2. Add textures and materials
3. Implement raycasting for interactivity
4. Add post-processing effects
5. Optimize for production

## Resources

- [Three.js Documentation](https://threejs.org/docs/)
- [Three.js Examples](https://threejs.org/examples/)
- [Three.js Fundamentals](https://threejsfundamentals.org/)

## License

This starter template is provided as-is for use in any project.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall