GithubHelp home page GithubHelp logo

conorluddy / postprocessing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pmndrs/postprocessing

0.0 1.0 0.0 26.37 MB

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

License: zlib License

JavaScript 93.91% HTML 0.16% CSS 0.23% GLSL 5.70%

postprocessing's Introduction

Post Processing

Build status npm version Dependencies

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

Extensive Demo โˆด API Reference

Installation

npm install postprocessing

Usage

Please refer to the usage example of three.js for information about how to setup the renderer, scene and camera.

Basics
import { Clock, PerspectiveCamera, Scene, WebGLRenderer } from "three";
import { EffectComposer, GlitchPass, RenderPass } from "postprocessing";

const composer = new EffectComposer(new WebGLRenderer());
composer.addPass(new RenderPass(new Scene(), new PerspectiveCamera()));

const pass = new GlitchPass();
pass.renderToScreen = true;
composer.addPass(pass);

const clock = new Clock();

(function render() {

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

}());
Custom Passes
import { Pass } from "postprocessing";
import { MyMaterial } from "./my-material.js";

export class MyPass extends Pass {

	constructor() {

		super();

		this.name = "MyPass";
		this.needsSwap = true;
		this.material = new MyMaterial();
		this.quad.material = this.material;

	}

	render(renderer, readBuffer, writeBuffer) {

		this.material.uniforms.tDiffuse.value = readBuffer.texture;
		renderer.render(this.scene, this.camera, this.renderToScreen ? null : writeBuffer);

	}

}

Passes don't have to use the buffers that are provided in the render method. Writing self-contained render-to-texture passes is also a feasible option.

Included Filters

Contributing

Maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

License

This library is licensed under the Zlib license.

The original code that this library is based on, was written by alteredq, miibond, zz85, felixturner and huwb and is licensed under the MIT license.

The film effect incorporates 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

Watchers

 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.