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

3d-sky-rays — скилл для Claude Code: солнечные лучи в 3D-сцене

Скилл добавляет в Three.js-сцену лучи света из-за крыш и сквозь листву. Пригодится, когда нужен золотой час в архитектурном рендере.

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

Что делает 3d-sky-rays

Скилл описывает, как сделать screen-space проход с лучами: сначала рисуется цвет сцены в linear HDR, потом строится маска открытого неба, а вдоль направления на солнце набираются затухающие сэмплы. Крыши и силуэты листьев сами режут лучи, когда камера двигается.

Перед работой скилл советует осмотреть рендерер: версию, render targets, альфу, depth-путь, tone mapping и порядок постобработки. Бэкенд WebGL или WebGPU остаётся прежним, но рецепт шейдера написан под WebGL, и для WebGPU его придётся переносить в node-пайплайн проекта. Направление на солнце должно быть одно для неба, источника лучей и directional-света.

Начинать советует с низкого солнца, тёплого нейтрального оттенка и сдержанной интенсивности, а для эксперимента взять 24–48 сэмплов и буфер лучей в половинном разрешении. Белая засветка обычно означает лишнюю интенсивность или плохую маску, а не нехватку bloom. Это художественное приближение, а не замена объёмному рассеянию с учётом глубины.

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

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

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

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

Как установить 3d-sky-rays

1Через Skills CLI (Vercel)

npx skills add MengTo/Skills --skill 3d-sky-rays -a claude-code

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

~/.claude/skills/3d-sky-rays/SKILL.md

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

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

Вопросы о 3d-sky-rays

Как установить 3d-sky-rays в Claude?

Выполните npx skills add MengTo/Skills --skill 3d-sky-rays -a claude-code. Скилл окажется в ~/.claude/skills/3d-sky-rays/SKILL.md.

Что делает 3d-sky-rays?

Описывает постобработку с лучами света: маска неба, проекция солнца, накопление затухающих сэмплов и аддитивная композиция до tone mapping. Крыши и листва формируют лучи при движении камеры.

Подойдёт ли скилл для WebGPU?

Рецепт шейдера описывает WebGL screen-space эффект. При WebGPU нужно реализовать эквивалент в node- или render-пайплайне проекта, сохранив существующий бэкенд.

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

SKILL.md · MIT
---
name: 3d-sky-rays
description: Add sun shafts and crepuscular rays to a Three.js or equivalent 3D scene, using scene occlusion, a projected sun position, controlled foreground spill, and scalable post-processing. Use for rays of light from the sky, sunlight through trees or roofs, and golden-hour architectural scenes.
---

# 3D Sky Rays

Make the light appear to travel through gaps in the scene. Roof edges and foliage should shape the shafts as the camera moves.

## Fit the existing renderer

Inspect the renderer version, render targets, alpha usage, depth path, tone mapping, and post-processing order. Keep the existing WebGL or WebGPU backend. The shader recipe below describes a WebGL screen-space effect; implement the equivalent in the project's node/render pipeline when using WebGPU.

Use one normalized world-space direction pointing **toward the sun** for the sky, ray source, and directional lighting. If the art direction deliberately offsets the visible sun from the lighting sun, document and control that offset in one place.

## Build an occlusion-aware ray pass

1. Render scene color in linear HDR. Obtain a mask identifying open sky: white for sky, black for opaque occluders. Match foliage alpha cutouts and vertex motion in the mask pass so leaves do not become solid rectangles.
2. A dedicated sky mask is the portable default. Reusing scene alpha is an optimization only when every preceding pass preserves its meaning: sky alpha 0, opaque geometry alpha 1. Transparent glass, particles, canvas compositing, and AO can break that convention; inspect the mask directly.
3. Project a point along the sun direction from the camera. Reject a source behind the camera before using projected coordinates. Convert NDC to UV with `uv = ndc.xy * 0.5 + 0.5`; account for the pipeline's texture orientation.
4. For each ray-buffer pixel, march toward the sun UV. Sample sky visibility multiplied by sky brightness above an HDR threshold. Accumulate decaying samples and divide by the sum of weights so sample-count changes do not change exposure.
5. Reject UVs outside the mask texture. Fade the effect as the sun moves far off-screen; clamping samples to the edge creates bright bands. A small overscan margin is useful for a sun just outside the frame.
6. Composite the ray color additively into linear scene color before the final tone-map/output transform. Preserve the input alpha if later passes need it.

Core accumulation, expressed as pseudocode:

```text
step = (pixelUV - sunUV) * density / sampleCount
sampleUV = pixelUV - step * jitter
sum = 0; weightSum = 0; weight = 1
repeat sampleCount times:
    sampleUV -= step
    if sampleUV is inside the texture:
        energy = max(luminance(scene(sampleUV)) - threshold, 0)
        sum += min(energy, energyCap) * skyMask(sampleUV) * weight
    weightSum += weight
    weight *= decay
rays = sum / max(weightSum, epsilon)
```

Use aspect-correct distance from the source for radial falloff. Keep any angular variation broad and subtle; the scene occlusion should provide most of the structure. On opaque foreground surfaces, attenuate the screen-space overlay strongly so wood and stone retain contrast. This is an artistic approximation, not a substitute for depth-integrated volumetric scattering.

## Tune appearance before cost

Start with a low sun, warm neutral tint, visible gaps, and restrained intensity. View from behind a roofline and through a canopy. Whiteout usually means excessive intensity or a bad mask, not insufficient bloom.

Use roughly 24–48 samples and a half-resolution ray buffer as a starting experiment; increase only when visible banding warrants it. Seijaku's reference uses 72 samples, which is a reference choice rather than a required quality floor. Smooth noise jitter can reduce bands, but animated jitter can shimmer; use stable noise for still or reduced-motion views unless temporal accumulation is available.

Skip the pass when its contribution is zero. Resize its buffers with the drawing buffer, dispose replaced targets, and measure its incremental GPU/frame cost with rays enabled and disabled. Avoid synchronous GPU readback in the render loop.

## Verify

- Roofs and leaf silhouettes visibly interrupt shafts; no rectangular foliage halos.
- Turning away from the sun removes the effect without a mirrored source or flash.
- Entering an interior preserves surface contrast; unrelated emissive objects do not become suns.
- Camera orbit, portrait resize, dusk, and a static reduced-motion frame remain stable.
- Desktop and mobile checks include shader errors, frame time, and the actual ray-buffer size.

## Reference

Read [REFERENCES.md](REFERENCES.md) for the source and renderer documentation. In Seijaku, inspect `GodRayShader`, `makePost`, and the projected-source update. Its alpha-mask convention depends on its complete render pipeline; do not transplant that assumption alone.

© MengTo · MIT · MengTo/Skills

Похожие скиллы

Всё по теме «Геймдев и 3D: Unity, Unreal, Godot, Blender» →
three-best-practices three-agent-skills Скилл с набором правил по Three.js: подсказывает агенту, как не течь по памяти и держать кадры. Пригодится, когда пишете или чините 3D-сцену. CX Codex +1 1 500установок threejs mrgoonie Скилл для ИИ-кодинга, который помогает собирать 3D-сцены, шейдеры и VR-опыты на Three.js. Пригодится, когда проект упирается в WebGL или WebGPU. CX Codex +1 1 200установок threejs-shaders CloudAI-X Скилл помогает писать кастомные GLSL-шейдеры и материалы для Three.js r186, настраивать униформы и переводить код на TSL для WebGPU. CX Codex +1 15 600установок threejs-geometry CloudAI-X Скилл учит ИИ-агента создавать стандартные и процедурные геометрии three.js, настраивать буферные атрибуты и генерировать 3D-текст. CX Codex +1 14 600установок 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установок

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

add-mouse-driven-orbit Добавляет плавный параллакс и кинематографичное вращение сцены Three.js вслед за курсором мыши без OrbitControls. Пригодится для интерактивных hero-секций. CX Codex +1 1 200установок 3d-virtual-tour Скилл для сборки виртуальных туров по 3D-сцене: маршрут камеры, переходы между комнатами, осмотр модели. Пригодится для архитектурных обходов и шоурумов на Three.js. CX Codex +1 527установок 3d-retina-resolution Настраивает чёткий 3D-рендеринг на Retina и HiDPI, включая фиксированный масштаб 200%. Нужен для WebGL-превью, где картинка теряет резкость. CX Codex +1 512установок 3d-high-resolution-textures Помогает подобрать разрешение и PBR-карты для 3D-материалов, чтобы близкие планы выглядели резко, а GPU-память не улетала в потолок. CX Codex +1 508установок 3d-sky-background Настраивает корректный фон неба в 3D-сцене: процедурную атмосферу, туман у горизонта, направленный солнечный свет и окружение для PBR. CX Codex +1 505установок 3d-falling-leaves Скилл для Three.js и похожих сцен: учит агента строить падающие листья в мировых координатах, с переворотом, сносом и переиспользованием инстансов. CX Codex +1 499установок 3d-four-seasons Добавляет смену четырёх времён года в 3D-сцену через шейдерные uniform-переменные. Помогает переключать листву, свет и снег без пересборки геометрии мира. CX Codex +1 497установок codex-gpt-image-2-5-flare Скилл для генерации и правки графики встроенным инструментом Codex: прозрачные PNG, спрайты, эмблемы и элементы интерфейса. CX Codex +1 475установок

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

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