postprocessing-pipeline
БесплатноБез исполняемых скриптовНе проверенBuild a correct three.js post-processing chain: EffectComposer with RenderPass, ambient occlusion (GTAOPass), bloom (UnrealBloomPass), OutputPass for tone…
от nirholas★ 289 звёзд на GitHubОб этом скилле
Post-processing pipelines in three.js
Targets three.js r187 ([email protected]). Every runnable block is executed in Chromium against
a real CC0 model before this plugin ships.
The rule that prevents most composer bugs: once you use a composer, tone mapping and the
sRGB conversion happen in OutputPass, not in the renderer. renderer.toneMapping is
still where you choose the curve, and OutputPass reads it. Without OutputPass the image
comes out dark and flat (linear values on an sRGB screen). With OutputPass in the wrong
place, effects after it run on already tone-mapped colors.
The order that works:
RenderPassdraws the scene into a half-float buffer (linear, HDR).- Effects that need linear HDR values: AO, bloom, depth of field.
OutputPass: tone mapping plus linear to sRGB.- Effects that want display colors:
SMAAPass, FXAA, film grain, vignette.
1. WebGLRenderer: bloom, output and MSAA
A composer renders into its own target, so the canvas antialias: true flag no longer
helps. Give the composer a multisampled render target instead (WebGL2 MSAA, cheap and sharp).
import * as THREE from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';
import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';
const renderer = new THREE.WebGLRenderer(); // antialias does nothing once a composer owns the frame
const pixelRatio = Math.min(window.devicePixelRatio, 2);
renderer.setPixelRatio(pixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.toneMapping = THREE.AgXToneMapping; // OutputPass applies this
renderer.toneMappingExposure = 1;
document.body.appendChild(renderer.domElement);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x1d2026);
scene.environment = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.04).texture;
const gltf = await new GLTFLoader().loadAsync('model.glb');
scene.add(gltf.scene);
const { center, radius } = new THREE.Box3().setFromObject(gltf.scene).getBoundingSphere(new THREE.Sphere());
// A bright emissive ring gives bloom something above 1.0 to catch.
const ring = new THREE.Mesh(
new THREE.TorusGeometry(radius * 1.15, radius * 0.02, 16, 128),
new THREE.MeshStandardMaterial({ color: 0x000000, emissive: 0x66ccff, emissiveIntensity: 6 }),
);
ring.position.copy(center);
ring.rotation.x = Math.PI / 2;
scene.add(ring);
const camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, radius / 50, radius * 50);
camera.position.copy(center).add(new THREE.Vector3(0.8, 0.5, 1).normalize().multiplyScalar(radius * 3.4));
camera.lookAt(center);
// HalfFloat keeps values above 1.0 so bloom and tone mapping have HDR to work with.
const target = new THREE.WebGLRenderTarget(window.innerWidth * pixelRatio, window.innerHeight * pixelRatio, {
type: THREE.HalfFloatType,
samples: 4,
});
const composer = new EffectComposer(renderer, target);
composer.setPixelRatio(pixelRatio);
composer.setSize(window.innerWidth, window.innerHeight);
composer.addPass(new RenderPass(scene, camera));
const bloom = new UnrealBloomPass(new THREE.Vector2(window.innerWidth, window.innerHeight), 0.6, 0.4, 1.0);
composer.addPass(bloom); // threshold 1.0: only HDR highlights glow, not white walls
composer.addPass(new OutputPass());
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
composer.setSize(window.innerWidth, window.innerHeight); // resizes every pass
});
const timer = new THREE.Timer();
renderer.setAnimationLoop((time) => {
timer.update(time);
ring.rotation.z = timer.getElapsed() * 0.4;
composer.render(timer.getDelta());
});
UnrealBloomPass(resolution, strength, radius, threshold). Keepthresholdnear 1 with HDR emissive materials so only genuine highlights bloom. A threshold of 0 blooms everything and reads as fog.composer.render(delta)passes the frame delta to time-based passes.THREE.Clockis deprecated since r183 and logs a warning; useTHREE.Timeras above.
2. Ambient occlusion with GTAOPass, antialiased by SMAA
GTAOPass renders the scene again for depth and normals, so it is the most expensive common
pass. Pair it with SMAAPass rather than a multisampled target: MSAA would multiply the cost
of every full-screen pass. SMAAPass goes after OutputPass because it finds edges in
display colors.
import * as THREE from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment
Установить postprocessing-pipeline в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл postprocessing-pipeline?
Build a correct three.js post-processing chain: EffectComposer with RenderPass, ambient occlusion (GTAOPass), bloom (UnrealBloomPass), OutputPass for tone mapping and sRGB, and antialiasing with an MSAA render target or SMAAPass, plus the WebGPU equivalent with RenderPipeline and TSL nodes (pass, bloom). Use when adding bloom, glow, ambient occlusion, SSAO, antialiasing or any screen effect, or when a scene gets washed out, too dark, banded, jagged or loses its colors after adding EffectComposer, or when porting post-processing to WebGPURenderer.
Как установить скилл postprocessing-pipeline?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл postprocessing-pipeline запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub