A post processing library that provides the means to implement image filter effects for three.js.
Extensive Demo · Sandbox · API Reference · Wiki
This library requires the peer dependency three.
npm install three postprocessing
Please refer to the usage example of three.js for information about how to setup the renderer, scene and camera.
import { Clock, PerspectiveCamera, Scene, WebGLRenderer } from "three";
import { BloomEffect, EffectComposer, EffectPass, RenderPass } from "postprocessing";
const composer = new EffectComposer(new WebGLRenderer());
const camera = new PerspectiveCamera();
const scene = new Scene();
const effectPass = new EffectPass(camera, new BloomEffect());
effectPass.renderToScreen = true;
composer.addPass(new RenderPass(scene, camera));
composer.addPass(effectPass);
const clock = new Clock();
(function render() {
requestAnimationFrame(render);
composer.render(clock.getDelta());
}());
This library provides an EffectPass which automatically organizes and merges any given combination of effects. This minimizes the amount of render operations and makes it possible to combine many effects without the performance penalties of traditional pass chaining. Additionally, every effect can choose its own blend function.
Furthermore, all fullscreen render operations use a single triangle that fills the screen. Compared to using a quad, this approach harmonizes with modern GPU rasterization patterns and eliminates unnecessary fragment calculations along the screen diagonal which is especially beneficial for GPGPU passes and effects that use complex fragment shaders.
- Bloom
- Blur
- Bokeh & Realistic Bokeh
- Color Grading
- Color Average
- Sepia
- Brightness & Contrast
- Gamma Correction
- Hue & Saturation
- Color Depth
- Glitch
- Chromatic Aberration
- Noise
- God Rays
- Pattern
- Dot-Screen
- Grid
- Scanline
- Pixelation
- Masking
- Outline
- Shock Wave
- SMAA
- SSAO
- Texture
- Tone Mapping
- Vignette
If you want to learn how to create custom effects or passes, please check the Wiki.
Please refer to the contribution guidelines for details.
This library is licensed under the Zlib license.
The original code that this library is based on, was written by mrdoob and the three.js contributors and is licensed under the MIT license.
The noise and scanline effects incorporate code written by Georg Steinrohder and Pat Shearon which was released under the Creative Commons Attribution 3.0 License.