GithubHelp home page GithubHelp logo

vanrez-nez / postprocessing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pmndrs/postprocessing

0.0 0.0 0.0 99.49 MB

A post processing library that provides the means to implement image filter effects for three.js.

License: zlib License

JavaScript 94.73% GLSL 5.27%

postprocessing's Introduction

Post Processing

Build status npm version Peer dependencies CDN

A post processing library that provides the means to implement image filter effects for three.js.

Demo · Sandbox · Documentation · Wiki

Installation

This library requires the peer dependency three.

npm install three postprocessing

Usage

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 clock = new Clock();

composer.addPass(new RenderPass(scene, camera));
composer.addPass(new EffectPass(camera, new BloomEffect()));

(function render() {

	requestAnimationFrame(render);
	composer.render(clock.getDelta());

}());

Output Encoding

Simply set WebGLRenderer.outputEncoding to the desired target color space and postprocessing will follow suit. Built-in passes automatically encode colors when they render to screen and internal render operations are always performed in linear color space. It's recommended to enable high precision frame buffers when using sRGBEncoding:

import { HalfFloatType } from "three";

const composer = new EffectComposer(renderer, {
	frameBufferType: HalfFloatType
});

Performance

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.

All fullscreen render operations also 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. This is especially beneficial for GPGPU passes and effects that use complex fragment shaders.

Performance Test

Included Effects

The total demo download size is about 60 MB.

Custom Effects

If you want to learn how to create custom effects or passes, please check the Wiki.

Contributing

Please refer to the contribution guidelines for details.

License

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.

postprocessing's People

Contributors

vanruesc avatar martin31821 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.