Giter Club home page Giter Club logo

voxel-pp's Introduction

voxel-pp

Deprecated

GLSL post-processing module for Voxel.js! This is a wrapper for @alteredq's THREE.EffectComposer, which allows you to stack fragment shaders for nice effects such as Bloom, Blur, Mosaic Filters and so on.

The demo is somewhat less graceful, but you get the idea.

Installation

npm install voxel-pp

Usage

postprocessor(game)

Enable post processing.

postprocessor(game).use(fragmentShader)

Add a shader pass using the fragmentShader string. Includes sampler2D tDiffuse (the screen texture) and vec2 vUv (the current pixel) by default.

postprocessor(game).use(options)

Same as above, but takes an object instead with the following properties, all optional:

  • fragmentShader
  • vertexShader
  • uniforms

postprocessor(game).addPass(pass)

Equivalent to EffectComposer.addPass - the following pass types are exposed with each instance of voxel-pp:

  • postprocessor(game).ShaderPass
  • postprocessor(game).RenderPass
  • postprocessor(game).MaskPass
  • postprocessor(game).ClearMaskPass

This method also returns the pass instead of the voxel-pp instance, so you can play around with it directly.

postprocessor(game).addPass(type, params, ...)

To keep things clean, you can pass the string name of the pass (e.g. ShaderPass or MaskPass) as the first argument, and the parameters as the rest:

postprocessor(game).addPass('MaskPass', scene, camera)

Example

See demo.js for the code used in the demo.

var game = require('voxel-engine')()
  , voxelpp = require('voxel-pp')

var postprocessor = voxelpp(game)

postprocessor
  .use(require('./some/fragment/shader.fs'))
  .use({
    fragmentShader: require('./another/fragment/shader.fs'),
    uniforms: {
      amount: { type: 'f', value: 1 }
    }
  })

voxel-pp's People

Contributors

hughsk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

voxel-pp's Issues

Random Pointer Lock Error

Doesn't happen often, but it does happen... The game's pointer lock isn't getting called in the example, possibly because of voxel-pp, meaning the player can't look around at all. Other controls (walking, clicking, etc.) are all working OK.

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.