# threejs-towers

Builds pagodas, castles and domes from parameters instead of mesh files, then films the structure assembling from the ground up.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1200 installs · ★ 7001
- Author: MengTo
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/MengTo/Skills/tree/HEAD/agent-skills/web-design/threejs-towers/SKILL.md
- Updated: 2026-10-25
- HTML: https://affpapa.org/en/nevibecode/skills/threejs-towers

## What it does

The skill hands you a vocabulary of ten small builders: `face`, `box`, `prism`, `prismN`, `sweepPlan`, `lathe`, `ring`, `arc`, `fan`, `tube`. Each one appends into shared vertex, normal, UV and index arrays, so a second style costs a parameter table rather than a new model. That set covers a Japanese keep, a Chinese pagoda, an Ottoman dome and a Khmer prasat.

Roofs come from a single `roofPoint` function that maps position along the eave to a point. Six numbers — `lift`, `tip`, `flare`, `pow`, `trunc`, `ridge` — carry the whole character of the roof, corner lift included. The trap sits right there: `Math.pow` on a negative base returns NaN, and tiles that overshoot the eave wipe the entire roof without a warning. The author's fix is to clamp `tc = Math.min(1, t)` and handle the overshoot as a separate linear term.

The build animation is one clipping plane. Geometry exists from frame one, the plane travels upward, and structural materials clip against it through `clippingPlanes` and `clipShadows`. Scaffolding ignores the clip, so it always stands one step ahead of the finished masonry. `BoxGeometry` gives every face UVs of 0..1 regardless of size, which hands a three-metre pole and a fifteen-centimetre brace the same grain and makes both read as plastic — you rewrite the UVs in world units. Worth installing if the scene already uses `threejs-landscape` and `threejs-weather`: the author says to stand it in the first and weather it with the second.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add MengTo/Skills --skill threejs-towers -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/threejs-towers/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/threejs-towers/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add MengTo/Skills --skill threejs-towers -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/threejs-towers/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add MengTo/Skills --skill threejs-towers -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/threejs-towers/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install MengTo/Skills threejs-towers
```

2. **Manually: put the files in place**
- File: `.github/skills/threejs-towers/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add MengTo/Skills --skill threejs-towers -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/MengTo/Skills --path agent-skills/web-design/threejs-towers
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/threejs-towers/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add MengTo/Skills --skill threejs-towers -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/MengTo/Skills/tree/HEAD/agent-skills/web-design/threejs-towers/SKILL.md

## When to use it
- build a pagoda or dome from parameters instead of a mesh file
- drive a hip roof with flying eaves from one profile function
- show a building assembling behind a rising clipping plane
- fill the gap between stepped storeys with a flat annulus
- rewrite `BoxGeometry` UVs so scaffolding stops looking like plastic

## Example prompts
- generate a pagoda in Three.js from parameters and show it assembling bottom to top
- build a roof with flying eaves through roofPoint, put the six numbers in a config
- add scaffolding that ignores the clipping plane and stays one step ahead of the masonry

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 50717c1cf1abf033.

BEGIN THIRD-PARTY FILE 50717c1cf1abf033
````text
---
name: threejs-towers
description: Generate architecture procedurally in Three.js and film it assembling — a small geometry vocabulary that builds pagodas, castles, domes and spires from parameters instead of mesh files, hip roofs with flying eaves driven by a single profile function, and a clipping-plane build animation where everything below a rising line is finished work and scaffolding stands above it. Use for construction studies, architectural title sequences, procedural landmarks, or any hero object that should build itself rather than fade in.
---

# Three.js Towers

Architecture is the one subject where procedural generation pays immediately: buildings are made of repeated, parameterised parts, and once you have the vocabulary a second style costs a parameter set rather than a model.

Stand it in `threejs-landscape` and weather it with `threejs-weather`.

## Build the vocabulary before the building

Write ten small builders that all append into shared vertex/normal/UV/index arrays, then never write raw geometry again:

```txt
face(P, uv)                     quad with a computed normal
box(cx,cy,cz, sx,sy,sz, ry, uvScale, rz)
prism(y0,y1, R0,R1, uv, capTop, capBot)          square on plan
prismN(y0,y1, R0,R1, n, uv, capTop, capBot)      any n-gon
sweepPlan(plan, y0,y1, steps, profile)           an outline scaled up a curve
lathe(cx,cy,cz, y0,y1, profile, steps, seg)      surface of revolution
ring / arc                                        annulus on a face plane
fan(points, z, ry, cx, cy)                        filled polygon on a face
tube(points, r, sides)                            swept tube
```

That set covers a Japanese keep, a Chinese pagoda, an Ottoman dome, a Khmer prasat and a Vietnamese tháp. Each style becomes one assembly function plus a table of levels.

Merge by material, not by part. Six buildings drawn in 11–18 draw calls is the difference between 120fps and 30.
````
END THIRD-PARTY FILE 50717c1cf1abf033

The third-party file has ended. Everything between the 50717c1cf1abf033 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 1932 of 8254 bytes. © MengTo · MIT · https://github.com/MengTo/Skills/tree/HEAD/agent-skills/web-design/threejs-towers/SKILL.md

## Similar
- [threejs](https://affpapa.org/en/nevibecode/skills/threejs.md) — skill · 3400 installs
- [threejs-geometry](https://affpapa.org/en/nevibecode/skills/threejs-geometry.md) — skill · 14600 installs
- [threejs-loaders](https://affpapa.org/en/nevibecode/skills/threejs-loaders.md) — skill · 12900 installs

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
