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

3d-retina-resolution — скилл для Claude Code: установка

Настраивает чёткий 3D-рендеринг на Retina и HiDPI, включая фиксированный масштаб 200%. Нужен для WebGL-превью, где картинка теряет резкость.

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

Что делает 3d-retina-resolution

Скилл помогает выбрать режим масштаба: фиксированный 200%, автоматический Retina с ограничением 2× или значение относительно нативного DPR. Для Three.js он синхронизирует renderer, camera, composer и пользовательские targets, не меняя CSS-размеры холста и кадрирование сцены.

Внутри описаны обработка ResizeObserver, смена DPR при масштабировании браузера или переходе между дисплеями, нормализация указателя через getBoundingClientRect() и проверка размеров drawing buffer. Для ортографической камеры границы нужно обновлять по существующей политике кадрирования. Код также учитывает полноразмерные и уменьшенные проходы AO, bloom и ray tracing.

Скилл советует сначала измерить сцену в 1× и 2×, проверить лимиты GPU и снижать разрешение необязательных эффектов до основного вида. Это повод проверить composer: если передать ему уже удвоенные размеры при его собственном DPR 2, буфер станет в четыре раза больше по каждой оси.

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

  • сделать WebGL-холст резким на Retina-дисплее
  • синхронизировать размеры renderer и composer
  • исправить координаты указателя при HiDPI
  • обрабатывать смену DPR и размеров контейнера
  • подобрать fallback для тяжёлых постэффектов

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

  • Настрой фиксированный рендеринг 200% для Three.js-сцены и проверь размеры drawing buffer.
  • Исправь размытие WebGL-превью при смене DPR, не меняя CSS-размер холста.
  • Проверь renderer, composer и пользовательские targets при переходе между обычным и Retina-дисплеем.

Как установить 3d-retina-resolution

1Через Skills CLI (Vercel)

npx skills add MengTo/Skills --skill 3d-retina-resolution -a claude-code

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

~/.claude/skills/3d-retina-resolution/SKILL.md

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

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

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

build-interactive-particle-trail Скилл для интерактивных частиц: курсор или палец оставляет след из точек, которые летят по своей траектории. Пригодится в 3D-сценах и на лендингах. CX Codex +1 1 100установок web-technique-to-skill Помогает превратить готовый визуальный или интерактивный приём в переиспользуемый скилл для веб-дизайна — с демо, которое доказывает и механику, и точность. CX Codex +1 1 100установок add-mouse-driven-orbit Добавляет плавный параллакс и кинематографичное вращение сцены Three.js вслед за курсором мыши без OrbitControls. Пригодится для интерактивных hero-секций. CX Codex +1 1 200установок 3d-virtual-tour Скилл для сборки виртуальных туров по 3D-сцене: маршрут камеры, переходы между комнатами, осмотр модели. Пригодится для архитектурных обходов и шоурумов на Three.js. CX Codex +1 527установок 3d-high-resolution-textures Помогает подобрать разрешение и PBR-карты для 3D-материалов, чтобы близкие планы выглядели резко, а GPU-память не улетала в потолок. CX Codex +1 508установок 3d-sky-rays Скилл добавляет в Three.js-сцену лучи света из-за крыш и сквозь листву. Пригодится, когда нужен золотой час в архитектурном рендере. CX Codex +1 506установок 3d-sky-background Настраивает корректный фон неба в 3D-сцене: процедурную атмосферу, туман у горизонта, направленный солнечный свет и окружение для PBR. CX Codex +1 505установок 3d-falling-leaves Скилл для Three.js и похожих сцен: учит агента строить падающие листья в мировых координатах, с переворотом, сносом и переиспользованием инстансов. CX Codex +1 499установок

Похожие

threejs-animation CloudAI-X Скилл для работы с keyframe-анимацией, костями и морф-целями в Three.js. Помогает воспроизводить glTF-анимации, управлять костями скелета, миксировать и кроссфейдить клипы на WebGL и WebGPU. CX Codex +1 20 400установок 3d-web-experience sickn33 Помогает создавать и отлаживать 3D-сцены, конфигураторы товаров и портфолио для веба. Разбирает выбор стека, загрузку моделей и производительность. CX Codex +1 5 200установок design-dna zanwei Разбирает референсы на токены, стиль и визуальные эффекты, затем применяет профиль к макету. Нужен для работы со скриншотами, изображениями и URL. CX Codex +1 6 500установок threejs-geometry CloudAI-X Скилл учит ИИ-агента создавать стандартные и процедурные геометрии three.js, настраивать буферные атрибуты и генерировать 3D-текст. CX Codex +1 14 600установок 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установок

Рядом в теме «Фронтенд и UI»

Всё по теме «Фронтенд и UI» →

Вопросы о 3d-retina-resolution

Как установить 3d-retina-resolution в Codex?

Выполните npx skills add MengTo/Skills --skill 3d-retina-resolution -a codex. Файл скилла появится по пути .agents/skills/3d-retina-resolution/SKILL.md.

Что делает 3d-retina-resolution?

Скилл настраивает drawing buffer для Retina и HiDPI, синхронизирует размеры рендера и постобработки, а также сохраняет корректные координаты указателя.

Как скилл работает с автоматическим Retina-режимом?

Автоматический режим использует Math.min(window.devicePixelRatio || 1, 2), поэтому на обычном дисплее может работать в 1×. Фиксированный режим 200% остаётся на масштабе 2×, пока не потребуется явный fallback из-за аппаратного ограничения или ошибки выделения.

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

SKILL.md · MIT
---
name: 3d-retina-resolution
description: Render a 3D canvas sharply on Retina and HiDPI displays, including explicit 200 percent resolution, synchronized renderer and post-processing sizes, correct pointer coordinates, and measured quality fallbacks. Use for blurry WebGL output, 2x rendering, high-resolution previews, and display-density changes.
---

# 3D Retina Resolution

Treat an explicit **200% rendering** request as two drawing-buffer pixels per CSS pixel in each dimension. A 1200 × 800 CSS canvas therefore uses a 2400 × 1600 drawing buffer, or four times the pixels of 100%. Layout and camera framing stay unchanged.

## Choose the scale deliberately

- **Fixed 200%:** effective pixel ratio is `2`, independent of device pixel ratio. This is the default when the user explicitly requests 200%.
- **Automatic Retina, capped at 2×:** effective ratio is `Math.min(window.devicePixelRatio || 1, 2)`. This can render at 1× on an ordinary display; label it Auto rather than claiming it always renders at 200%.
- **Relative to native resolution:** multiply native DPR only when the user explicitly wants that meaning. Native 2× multiplied by another 2 becomes 4× per dimension, or sixteen times the CSS pixel count.

Keep an explicit quality selection distinct from automatic adaptation. Inspect the project's renderer and post-processing architecture before changing sizing.

## Synchronize the rendering pipeline

Use CSS to size the canvas and its container, then measure the container in CSS pixels. In Three.js WebGL, one consistent convention is logical sizes plus pixel ratio:

```js
function resize3D(width, height, ratio = 2) {
  if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) return;
  if (!Number.isFinite(ratio) || ratio <= 0) throw new RangeError('Invalid render ratio');
  renderer.setPixelRatio(ratio);
  renderer.setSize(width, height, false); // CSS owns displayed dimensions
  camera.aspect = width / height;        // perspective camera
  camera.updateProjectionMatrix();
  if (composer) {
    composer.setPixelRatio(ratio);
    composer.setSize(width, height);     // logical pixels; do not multiply again
  }
  const physicalWidth = renderer.domElement.width;
  const physicalHeight = renderer.domElement.height;
  resizeCustomTargets(physicalWidth, physicalHeight);
}
```

The snippet assumes an existing `renderer`, perspective `camera`, optional `composer` (or `null`), and a `resizeCustomTargets` adapter supplied by the app. For an orthographic camera, update its bounds according to the existing framing policy instead of setting `aspect`.

The adapter updates only app-owned targets and uniforms; composer-managed passes already receive sizing through the composer. Set full-resolution depth/normal targets to physical dimensions. Size lower-resolution AO, bloom, or ray targets by their deliberate scale factors. Set sampling-resolution uniforms to the dimensions of the texture actually sampled, including reciprocal resolution where the shader expects it.

The renderer and composer each maintain their own pixel ratio. Updating only the canvas can leave a lower-resolution intermediate image stretched to a Retina output. Conversely, passing already doubled dimensions into a composer that also has DPR 2 allocates 4× dimensions. See the [renderer](https://threejs.org/docs/pages/WebGLRenderer.html) and [composer](https://threejs.org/docs/pages/EffectComposer.html) sizing APIs.

## Handle layout and display changes

Observe the canvas container with `ResizeObserver`, coalesce notifications, and resize only when dimensions or effective ratio change. Skip zero-sized hidden views and retry when they become visible. Re-evaluate native DPR on browser zoom or display changes in Auto mode, including when CSS dimensions remain unchanged. Recreate a resolution media-query listener after each DPR change if using that approach.

Use `canvas.getBoundingClientRect()` for pointer normalization: `(clientX - rect.left) / rect.width`, and likewise for Y. Raycasting uses normalized coordinates derived from CSS space, not drawing-buffer pixels. Convert to physical pixels separately only for APIs such as a pixel readback.

Retina output does not automatically improve a blurry texture, coarse model, shadow map, or low-resolution reflection. Check those sources independently. Avoid CSS scaling or `image-rendering: pixelated` as a substitute for the correct drawing buffer. Higher resolution and antialiasing solve related but different artifacts.

## Budget and fallback

Measure the scene at 1× and 2× with the same camera. Track frame time, target dimensions, allocation failures, and total passes. Check GPU limits before allocating exceptionally large targets, including maximum texture/renderbuffer dimensions and viewport limits.

Reduce optional post-effect resolution or samples before compromising a requested crisp main view. Auto mode may step down after sustained poor frame time and recover with hysteresis; do not resize every few frames. A fixed 200% selection should stay fixed unless a concrete hardware/allocation failure requires a visible fallback. Report the actual effective scale rather than displaying 200% while silently rendering lower.

Pause hidden views and render static scenes on demand. Under reduced motion, keep the sharp still image; reducing animation does not require reducing resolution. Dispose replaced render targets.

## Verify

- At fixed 200%, compare canvas CSS size with `canvas.width`/`canvas.height` and `renderer.getDrawingBufferSize()`; expect approximately 2× on each axis with integer rounding.
- Confirm full-resolution composer buffers match and any reduced-size passes are intentional.
- Resize wide ↔ narrow, hide/show the view, and test browser zoom or display changes in Auto mode.
- Check thin edges and detailed materials at the same apparent size; pointer selection and UI alignment must remain correct.
- Test on a DPR 1 display and a Retina display: Fixed 200% remains 2×; Auto follows its cap.

Read [REFERENCES.md](REFERENCES.md) for APIs and the reference project. Seijaku has several renderer quality caps and an adaptive main path; those values are context, not evidence that its main view already renders at fixed 200%.

© MengTo · MIT · MengTo/Skills

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

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

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