GLSL post-processing module for Voxel.js
GLSL post-processing module for Voxel.js! This is a wrapper for
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.
npm install voxel-pp
Enable post processing.
Add a shader pass using the
fragmentShader string. Includes
sampler2D tDiffuse (the screen texture) and
vec2 vUv (the current pixel)
Same as above, but takes an object instead with the following properties, all optional:
EffectComposer.addPass - the following pass types are exposed
with each instance of
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
MaskPass) as the first argument, and the parameters
as the rest:
postprocessor(game).addPass('MaskPass', scene, camera)
demo.js for the
code used in the demo.
var game = require'voxel-engine'voxelpp = require'voxel-pp'var postprocessor = voxelppgamepostprocessoruserequire'./some/fragment/shader.fs'usefragmentShader: require'./another/fragment/shader.fs'uniforms:amount: type: 'f' value: 1