К основному содержанию
скилл CX Codex

threejs-towers — скилл для Claude Code: процедурная архитектура

Собирает пагоды, замки и купола из параметров вместо меш-файлов и показывает, как постройка растёт снизу вверх.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add MengTo/Skills --skill threejs-towers -a claude-code
Открыть на GitHub

Что делает threejs-towers

Скилл даёт словарь из десяти маленьких билдеров — face, box, prism, prismN, sweepPlan, lathe, ring, arc, fan, tube. Все они дописывают вершины, нормали, UV и индексы в общие массивы, так что второй стиль стоит набора параметров, а не новой модели. Этим набором описывают японский донжон, китайскую пагоду, османский купол, кхмерский прасат.

Крыши держатся на одной функции roofPoint, которая отображает положение вдоль карниза в точку. Шесть чисел — lift, tip, flare, pow, trunc, ridge — задают весь характер кровли, включая задир углов. Тут же лежит главная ловушка: Math.pow от отрицательного числа даёт NaN, и черепица, вылезшая за карниз, молча стирает крышу целиком. Автор советует зажимать tc = Math.min(1, t) и обрабатывать выход отдельным линейным членом.

Анимация сборки — это одна секущая плоскость. Геометрия существует с первого кадра, плоскость едет вверх, и материалы режутся по ней через clippingPlanes и clipShadows. Леса клип игнорируют, поэтому всегда стоят на шаг впереди готовой кладки. У BoxGeometry UV каждой грани идут от 0 до 1 независимо от размера, из-за чего трёхметровая стойка и пятнадцатисантиметровая раскосина получают одинаковое зерно и выглядят как пластик — UV приходится переписывать в мировых единицах. Ставить скилл стоит в проект, где уже есть threejs-landscape и threejs-weather: автор прямо пишет, что сцена ставится в первый и обрабатывается вторым.

Какие задачи решает

  • построить пагоду или купол из параметров, а не из готового меша
  • сделать кровлю с задиром углов одной функцией профиля
  • показать сборку здания через растущую секущую плоскость
  • заполнить провалы между ярусами плоским кольцом
  • переписать UV у BoxGeometry, чтобы леса не выглядели пластиком

Примеры запросов агенту

  • сгенерируй пагоду в Three.js из параметров и покажи, как она собирается снизу вверх
  • сделай крышу с летящими карнизами через функцию roofPoint, шесть чисел вынеси в конфиг
  • добавь леса, которые не режутся секущей плоскостью и стоят на шаг впереди кладки

Как установить threejs-towers

1Через Skills CLI (Vercel)

npx skills add MengTo/Skills --skill threejs-towers -a claude-code

2Вручную: положить файлы

~/.claude/skills/threejs-towers/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/threejs-towers/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора148

browser-video-recording Собирает демо-видео интерфейса в 4K 60 fps с пропорциями 4:3 из снимков браузера. Пригодится для показа кликов и плавного зума в стиле Dribbble. CX Codex +1 1 300установок elevenlabs-tts Генерирует аудио ElevenLabs из текста или файла сценария через локальные голосовые профили. Подходит для озвучки, дикторских дорожек и голосовых вставок. CX Codex +1 1 300установок add-shader-cursor-trail Добавляет в проект hero-эффект на WebGPU: белый мерцающий полутоновый след за курсором с хроматическими волнами и плёночным зерном. С откатом на статичный кадр. CX Codex +1 1 300установок shaders-cursor-ripples Встраивает водяную рябь на WebGPU поверх изображений с помощью библиотеки shaders. Помогает заменить устаревший CSS-эффект прожектора без поломки вёрстки и доступности. CX Codex +1 1 400установок build-rigged-game-assets Скилл ведёт сборку игрового персонажа или монстра от исходной модели до загрузки в геймплей: риг, библиотека анимаций, сокеты, экипировка, каталог. CX Codex +1 1 200установок audit-ai-design-slop Скилл находит визуальный шум, нагромождение декоративных слоёв и дефекты интерфейса в коде или макетах. Помогает очистить проект без принудительного редизайна. CX Codex +1 1 200установок threejs-weather Добавляет в Three.js сцены управляемые состояния дождя, грозы и снега. Нужен для атмосферного фона, где погода меняет частицы, свет и поверхность. CX Codex +1 1 200установок threejs-landscape Скилл собирает живой ландшафт на Three.js: холмы, трава, камни, небо и смена времени суток. Годится для hero-фонов и сцен, где объект должен стоять в месте, а не висеть на градиенте. CX Codex +1 1 200установок

Похожие

threejs nexu-io Помогает ассистенту создавать 3D-сцены, настраивать материалы, камеру и пост-обработку на Three.js прямо в браузере. CX Codex +1 3 400установок threejs-geometry CloudAI-X Скилл учит ИИ-агента создавать стандартные и процедурные геометрии three.js, настраивать буферные атрибуты и генерировать 3D-текст. CX Codex +1 14 600установок threejs-loaders CloudAI-X Скилл обучает ИИ загружать 3D-модели glTF, текстуры и HDR-карты в three.js r186. Пригодится при настройке ассетов, цветовых пространств и шкалы прогресса для WebGL или WebGPU. CX Codex +1 12 900установок threejs-materials-lighting gamedev-skills Скилл для three.js: подбирает материал, ставит источники света, включает тени и подключает HDR-окружение, когда модель выглядит чёрной или плоской. CX Codex +1 5 500установок threejs-webgl freshtechbro Скилл учит агента настраивать сцены Three.js, рендереры WebGL и WebGPU, свет, материалы и загрузку glTF-моделей. Пригодится для 3D-визуализаций и конфигураторов. CX Codex +1 4 600установок threejs-aaa-graphics-builder majidmanzarpour Скилл переводит браузерную 3D-графику Three.js из прототипа в качественный продакшен: настраивает материалы, свет, шейдеры и проверяет сцену по шкале качества. CX Codex +1 3 200установок

Рядом в теме «Геймдев и 3D: Unity, Unreal, Godot, Blender»

Всё по теме «Геймдев и 3D: Unity, Unreal, Godot, Blender» →

Вопросы о threejs-towers

Как установить threejs-towers в Claude?

Выполните npx skills add MengTo/Skills --skill threejs-towers -a claude-code. После этого файл скилла лежит в ~/.claude/skills/threejs-towers/SKILL.md.

Что делает threejs-towers?

Строит архитектуру процедурно: десять билдеров собирают пагоды, замки, купола и шпили из параметров. Отдельно даёт анимацию сборки через секущую плоскость, которая поднимается вверх.

Почему крыша исчезает целиком?

Черепица, вышедшая за карниз, толкает параметр t за 1, а Math.pow от отрицательного числа возвращает NaN. Автор советует зажать tc = Math.min(1, t) и обрабатывать выход отдельным линейным членом.

Исходный текст

SKILL.md · MIT
---
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.

**Winding is the bug you will hit most.** A prism whose side faces are wound inward gets back-face culled and you find yourself looking at the inside of the far wall. Get one prism right, then copy its vertex order everywhere. When a surface goes missing, suspect winding before you suspect anything else.

## Roofs are a function of position along the eave

The whole character of an East Asian roof — flat near the ridge, steepening, then curling up at the corners — comes from one function that maps *(panel, position across, position down)* to a point:

```js
function roofPoint(o, p, u, t) {
  const tc = Math.min(1, t);
  const g = 1 - Math.pow(1 - tc, o.pow);              // the sag of the slope
  const corner = Math.pow(Math.abs(u), 2.0);          // 0 mid-eave, 1 at hips
  const flare = 1 + o.flare * corner * Math.pow(tc, 3.2);
  const y = o.yT - (o.yT - o.yE) * g
          + o.lift * corner * Math.pow(tc, 2.6);      // corners lift
  return [ /* lerp inner edge → outer edge × flare */ ];
}
```

Six numbers give you every roof in the set: `lift`, `tip`, `flare`, `pow`, `trunc`, `ridge`. `trunc` is the one that is easy to miss — it lets a lower roof die cleanly behind the wall above it instead of poking through.

**`Math.pow(negative, 2.35)` is NaN.** Tiles that overshoot the eave push `t` past 1, and the whole roof silently disappears. Clamp `tc = Math.min(1, t)` and handle the overshoot as a separate linear term.

## Non-square plans

`prismN` handles octagons and sixteen-sided drums. For anything with re-entrant corners — a Khmer prasat is a square pushed out on each axis and stepped back twice before the corner — build the outline once and sweep it:

```js
const oct = [[1+P,0],[1+P,0.30],[1.0,0.30],[1.0,0.45],[0.90,0.45], ... ];
const half = oct.concat(oct.slice(0,-1).reverse().map(q => [q[1], q[0]]));
// mirror across the diagonal, then rotate four times
```

Then every storey is the same outline at a smaller scale, and the silhouette is coherent for free.

**Deck the ledges.** Where a storey steps back onto the one above, the gap between the two outlines is open. Fill it with a flat annulus on the plan or the tower reads as a stack of floating shelves with daylight between them.

## Size detail to the surface it sits on

The most common modelling mistake is not the geometry, it is the proportion. A doorway sized for a face that turns out to be a third as wide spills onto the returns and reads as noise. Measure the face first, then size the door, the colonnettes and the pediment as fractions of it — and check that the pediment finishes *under* the cornice rather than through it.

## The build animation is one clipping plane

Everything exists from the first frame. A plane facing down travels up, and every structural material clips against it:

```js
renderer.localClippingEnabled = true;
const CLIP = new THREE.Plane(new THREE.Vector3(0, -1, 0), 0);
['stone','plaster','tile','timber', ...].forEach(k => {
  MAT[k].clippingPlanes = [CLIP];
  MAT[k].clipShadows = true;                     // or the shadow builds early
});
CLIP.constant = heightAt(t);
```

A clipped shell is hollow, so add a cap mesh at the plane's height, scaled to the footprint. That is what turns a see-through section into what reads as a solid course of masonry.

**The cap has to match the plan it is capping.** A square cap dropped into an octagonal tower leaves four wedges open to the sky. Let each style declare the plan of its own section — four sides through a hall, eight through a drum, sixteen through a dome — and rebuild the cap geometry as the plane passes from one into the next:

```js
caps: [[0, 4.74, 2.56], [4.74, 5.42, 2.02, 8], [5.42, 6.46, 1.86, 16]]
//      y0    y1   radius  sides
```

For interiors, a capped inner volume on a `DoubleSide` dark material reads as solid stone from any angle, and costs almost nothing.

## Scaffolding is the exception to the plane

It ignores the clip, so it always stands one step ahead of the finished work. That single relationship is what makes the animation read as construction rather than as a wipe.

**`BoxGeometry` gives every face UVs of 0..1 regardless of size.** A three-metre pole and a fifteen-centimetre brace therefore get the same grain, and both read as plastic. Rewrite the UVs in world units before upload:

```js
const dims = [[sz,sy],[sz,sy],[sx,sz],[sx,sz],[sx,sy],[sx,sy]];
for (let f = 0; f < 6; f++) {
  const du = dims[f][0], dv = dims[f][1], swap = dv > du;
  for (let i = 0; i < 4; i++) { /* scale by real size, offset randomly */ }
}
```

Grow each tier in with a short eased scale — verticals scale in Y, horizontals in X — and let it fall away just before the next stage lands.

## Stages carry the timeline

Give each style a list of `[local caption, ENGLISH, target height]` and ease the plane between targets. The caption names what is happening, which is most of what makes a construction study legible:

```js
stages: [['準備','READY',0.00], ['石垣普請','STONEWORK',3.36],
         ['柱梁組立','TIMBER',6.24], ['白壁塗籠','PLASTER',8.80], ...]
```

Fire a one-shot sound on each stage change and a bell on the last. Keep the whole build short — four to five seconds — and put a large percentage somewhere quiet in the frame. People will rebuild it repeatedly if it is fast.

## Emissive light leaks

If you light windows at night with an emissive material, that glow escapes through every opening you did not deck: under eaves, through truncated roofs, out of hollow storeys. Deck the truncated roofs and split enclosed volumes onto a non-emissive material. The symptom is a building that glows along its silhouette like a lantern.

## What to check before you call it done

- Orbit a full turn at ground level. Missing walls are inverted winding; long bars flying out of faces are a rotation sign error on face-mounted boxes.
- Scrub the timeline slowly through every stage. The cap should stay inside the walls at every height, and never poke out at the corners.
- Look at the roof from directly above once. Overshooting tiles and NaN panels only show from there.
- Switch styles ten times. If memory climbs, you are not disposing the previous group's geometries.
- Count draw calls per style. If one style is triple the others, a material is not shared.

© MengTo · MIT · MengTo/Skills

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой