Skip to content
Back to skills

3d Features

ASecurity

Add or modify Three.js 3D features in the viewer. Use when: adding rendering features, new GUI controls, camera behavior, loaders, post-processing, environment maps, animation features, display toggles, materials, or extending the Viewer class.

  • 7 stars
  • 0 votes
  • 0 copies
  • 7 views
  • Added June 7, 2026
design

Works with

  • cli

Security analysis

A100/100

Scanned June 7, 2026

npx -y skills add nirholas/three-ui --skill 3d-features --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 3d Features?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 3d Features
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nirholas-3d-features/badge)](https://www.skillsdirectory.com/skills/nirholas-3d-features)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: 3d-features
description: 'Add or modify Three.js 3D features in the viewer. Use when: adding rendering features, new GUI controls, camera behavior, loaders, post-processing, environment maps, animation features, display toggles, materials, or extending the Viewer class.'
argument-hint: 'Describe the 3D feature to add or change'
---

# 3D Feature Development

## When to Use

- Adding new rendering capabilities (post-processing, shadows, new material types)
- Adding or modifying dat.gui control panels
- Changing camera behavior or adding camera modes
- Adding new loaders or asset format support
- Modifying lighting, environment maps, or tone mapping
- Adding display toggles (wireframe, skeleton, grid, etc.)
- Animation playback features or morph target controls

## Key File: `src/viewer.js`

The `Viewer` class manages all Three.js rendering. Key sections:

### State Object

All GUI-controllable state lives in `this.state` (defined in constructor). To add a new toggle:

1. Add default value to `this.state`
2. Add GUI control in the appropriate `addGUI()` subfolder
3. Add the handler method on the `Viewer` class

### GUI Folders

dat.gui controls are organized into folders created in `addGUI()`:

- **Lights** — Ambient/directional intensity, punctual lights, exposure, tone mapping
- **Display** — Wireframe, skeleton, grid, axes, auto-rotate, background
- **Animation** — Playback speed, individual clip controls, morph targets
- **Cameras** — Default + scene cameras

### Loaders

| Loader           | Purpose              | CDN Path                          |
| ---------------- | -------------------- | --------------------------------- |
| `GLTFLoader`     | glTF/GLB models      | Built-in Three.js                 |
| `DRACOLoader`    | Compressed geometry  | `unpkg.com/three@.../draco/gltf/` |
| `KTX2Loader`     | Basis textures       | `unpkg.com/three@.../basis/`      |
| `MeshoptDecoder` | Meshopt geometry     | Built-in Three.js                 |
| `EXRLoader`      | HDR environment maps | Built-in Three.js                 |

### Environment Maps

Defined in `src/environments.js` as an array of `{ id, name, path, format }` objects. To add a new environment:

1. Add entry to the array in `environments.js`
2. The viewer auto-discovers it via the `environments` import

## Procedure

1. Identify which section of `src/viewer.js` to modify
2. For new GUI controls: add state → add GUI control → add handler
3. For new loaders: import from `three/addons/`, configure in constructor
4. For new environments: add to `src/environments.js`
5. Test with `npm run dev` at `http://localhost:3000`
6. Test with various glTF models (drag-and-drop or `?model=` param)

## Three.js Patterns Used

- `PMREMGenerator` for environment map preprocessing
- `AnimationMixer` for animation playback with `clipAction()`
- `OrbitControls` for camera interaction
- `Box3` for model bounding box / auto-framing
- `traverse()` for material/mesh iteration
- `LoadingManager` for coordinated asset loading

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.