浏览代码

Splitted ShaderExtras into individual files.
Renamed screen shader to blit.
Throwing errors in *Pass if the shader aren't available.

Mr.doob 13 年之前
父节点
当前提交
4f4f87430f
共有 53 个文件被更改,包括 2007 次插入1932 次删除
  1. 0 1814
      examples/js/ShaderExtras.js
  2. 20 14
      examples/js/postprocessing/BloomPass.js
  3. 7 6
      examples/js/postprocessing/DotScreenPass.js
  4. 4 1
      examples/js/postprocessing/EffectComposer.js
  5. 3 0
      examples/js/postprocessing/FilmPass.js
  6. 4 1
      examples/js/postprocessing/SavePass.js
  7. 4 1
      examples/js/postprocessing/TexturePass.js
  8. 31 0
      examples/js/shaders/BasicShader.js
  9. 64 0
      examples/js/shaders/BleachBypassShader.js
  10. 51 0
      examples/js/shaders/BlendShader.js
  11. 46 0
      examples/js/shaders/BlitShader.js
  12. 116 0
      examples/js/shaders/BokehShader.js
  13. 58 0
      examples/js/shaders/BrightnessContrastShader.js
  14. 48 0
      examples/js/shaders/ColorCorrectionShader.js
  15. 49 0
      examples/js/shaders/ColorifyShader.js
  16. 101 0
      examples/js/shaders/ConvolutionShader.js
  17. 58 0
      examples/js/shaders/DOFMipMapShader.js
  18. 68 0
      examples/js/shaders/DotScreenShader.js
  19. 99 0
      examples/js/shaders/FXAAShader.js
  20. 6 6
      examples/js/shaders/FilmShader.js
  21. 91 0
      examples/js/shaders/FocusShader.js
  22. 62 0
      examples/js/shaders/HorizontalBlurShader.js
  23. 65 0
      examples/js/shaders/HorizontalTiltShiftShader.js
  24. 69 0
      examples/js/shaders/HueSaturationShader.js
  25. 50 0
      examples/js/shaders/LuminosityShader.js
  26. 53 0
      examples/js/shaders/NormalMapShader.js
  27. 259 0
      examples/js/shaders/SSAOShader.js
  28. 54 0
      examples/js/shaders/SepiaShader.js
  29. 78 0
      examples/js/shaders/TriangleBlurShader.js
  30. 57 0
      examples/js/shaders/UnpackDepthRGBAShader.js
  31. 62 0
      examples/js/shaders/VerticalBlurShader.js
  32. 65 0
      examples/js/shaders/VerticalTiltShiftShader.js
  33. 63 0
      examples/js/shaders/VignetteShader.js
  34. 1 1
      examples/misc_camera_fly.html
  35. 4 2
      examples/webgl_geometry_text.html
  36. 7 5
      examples/webgl_lines_colors.html
  37. 8 6
      examples/webgl_marching_cubes.html
  38. 4 4
      examples/webgl_materials_bumpmap_skin.html
  39. 17 9
      examples/webgl_materials_cubemap_dynamic.html
  40. 10 5
      examples/webgl_materials_normalmap2.html
  41. 7 4
      examples/webgl_materials_skin.html
  42. 5 4
      examples/webgl_materials_video.html
  43. 4 2
      examples/webgl_particles_dynamic.html
  44. 12 8
      examples/webgl_particles_shapes.html
  45. 21 13
      examples/webgl_postprocessing.html
  46. 3 2
      examples/webgl_postprocessing_dof.html
  47. 5 4
      examples/webgl_ribbons.html
  48. 6 4
      examples/webgl_sandbox.html
  49. 2 1
      examples/webgl_shader_lava.html
  50. 9 5
      examples/webgl_shading_physical.html
  51. 2 2
      examples/webgl_shadowmap.html
  52. 2 2
      examples/webgl_shadowmap_performance.html
  53. 13 6
      examples/webgl_terrain_dynamic.html

+ 0 - 1814
examples/js/ShaderExtras.js

@@ -1,1814 +0,0 @@
-/**
- * @author alteredq / http://alteredqualia.com/
- * @author zz85 / http://www.lab4games.net/zz85/blog
- * @author davidedc / http://www.sketchpatch.net/
- *
- * ShaderExtras currently contains:
- *
- *  screen
- *  convolution
- *  bokeh
- *  sepia
- *  dotscreen
- *  vignette
- *  bleachbypass
- *  basic
- *  dofmipmap
- *  focus
- *  triangleBlur
- *  horizontalBlur + verticalBlur
- *  horizontalTiltShift + verticalTiltShift
- *  blend
- *  fxaa
- *  luminosity
- *  colorCorrection
- *  brightnessContrast
- *  hueSaturation
- *  normalmap
- *  ssao
- *  colorify
- *  unpackDepthRGBA
- */
-
-THREE.ShaderExtras = {
-
-	/* -------------------------------------------------------------------------
-	//	Full-screen textured quad shader
-	 ------------------------------------------------------------------------- */
-
-	'screen': {
-
-		uniforms: {
-
-			tDiffuse: { type: "t", value: null },
-			opacity:  { type: "f", value: 1.0 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform float opacity;",
-
-			"uniform sampler2D tDiffuse;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vec4 texel = texture2D( tDiffuse, vUv );",
-				"gl_FragColor = opacity * texel;",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* ------------------------------------------------------------------------
-	//	Convolution shader
-	//	  - ported from o3d sample to WebGL / GLSL
-	//			http://o3d.googlecode.com/svn/trunk/samples/convolution.html
-	------------------------------------------------------------------------ */
-
-	'convolution': {
-
-		defines: {
-
-			"KERNEL_SIZE_FLOAT": "25.0",
-			"KERNEL_SIZE_INT": "25",
-
-		},
-
-		uniforms: {
-
-			"tDiffuse" : 		{ type: "t", value: null },
-			"uImageIncrement" : { type: "v2", value: new THREE.Vector2( 0.001953125, 0.0 ) },
-			"cKernel" : 		{ type: "fv1", value: [] }
-
-		},
-
-		vertexShader: [
-
-			"uniform vec2 uImageIncrement;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform float cKernel[ KERNEL_SIZE_INT ];",
-
-			"uniform sampler2D tDiffuse;",
-			"uniform vec2 uImageIncrement;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vec2 imageCoord = vUv;",
-				"vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );",
-
-				"for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {",
-
-					"sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];",
-					"imageCoord += uImageIncrement;",
-
-				"}",
-
-				"gl_FragColor = sum;",
-
-			"}"
-
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Depth-of-field shader with bokeh
-	//	ported from GLSL shader by Martins Upitis
-	//	http://artmartinsh.blogspot.com/2010/02/glsl-lens-blur-filter-with-bokeh.html
-	 ------------------------------------------------------------------------- */
-
-	'bokeh'	: {
-
-		uniforms: {
-			tColor:   { type: "t", value: null },
-			tDepth:   { type: "t", value: null },
-			focus:    { type: "f", value: 1.0 },
-			aspect:   { type: "f", value: 1.0 },
-			aperture: { type: "f", value: 0.025 },
-			maxblur:  { type: "f", value: 1.0 }
-		  },
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"varying vec2 vUv;",
-
-			"uniform sampler2D tColor;",
-			"uniform sampler2D tDepth;",
-
-			"uniform float maxblur;",  	// max blur amount
-			"uniform float aperture;",	// aperture - bigger values for shallower depth of field
-
-			"uniform float focus;",
-			"uniform float aspect;",
-
-			"void main() {",
-
-				"vec2 aspectcorrect = vec2( 1.0, aspect );",
-
-				"vec4 depth1 = texture2D( tDepth, vUv );",
-
-				"float factor = depth1.x - focus;",
-
-				"vec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );",
-
-				"vec2 dofblur9 = dofblur * 0.9;",
-				"vec2 dofblur7 = dofblur * 0.7;",
-				"vec2 dofblur4 = dofblur * 0.4;",
-
-				"vec4 col = vec4( 0.0 );",
-
-				"col += texture2D( tColor, vUv.xy );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur );",
-
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur9 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur9 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur9 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur9 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur9 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur9 );",
-
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur7 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur7 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur7 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur7 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur7 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur7 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur7 );",
-
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur4 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.4,   0.0  ) * aspectcorrect ) * dofblur4 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur4 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur4 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur4 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur4 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );",
-				"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur4 );",
-
-				"gl_FragColor = col / 41.0;",
-				"gl_FragColor.a = 1.0;",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Depth-of-field shader using mipmaps
-	//	- from Matt Handley @applmak
-	//	- requires power-of-2 sized render target with enabled mipmaps
-	 ------------------------------------------------------------------------- */
-
-	'dofmipmap': {
-
-		uniforms: {
-
-			tColor:   { type: "t", value: null },
-			tDepth:   { type: "t", value: null },
-			focus:    { type: "f", value: 1.0 },
-			maxblur:  { type: "f", value: 1.0 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform float focus;",
-			"uniform float maxblur;",
-
-			"uniform sampler2D tColor;",
-			"uniform sampler2D tDepth;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vec4 depth = texture2D( tDepth, vUv );",
-
-				"float factor = depth.x - focus;",
-
-				"vec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );",
-
-				"gl_FragColor = col;",
-				"gl_FragColor.a = 1.0;",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Sepia tone shader
-	//  - based on glfx.js sepia shader
-	//		https://github.com/evanw/glfx.js
-	 ------------------------------------------------------------------------- */
-
-	'sepia': {
-
-		uniforms: {
-
-			tDiffuse: { type: "t", value: null },
-			amount:   { type: "f", value: 1.0 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform float amount;",
-
-			"uniform sampler2D tDiffuse;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vec4 color = texture2D( tDiffuse, vUv );",
-				"vec3 c = color.rgb;",
-
-				"color.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );",
-				"color.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );",
-				"color.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );",
-
-				"gl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Dot screen shader
-	//  - based on glfx.js sepia shader
-	//		https://github.com/evanw/glfx.js
-	 ------------------------------------------------------------------------- */
-
-	'dotscreen': {
-
-		uniforms: {
-
-			tDiffuse: { type: "t", value: null },
-			tSize:    { type: "v2", value: new THREE.Vector2( 256, 256 ) },
-			center:   { type: "v2", value: new THREE.Vector2( 0.5, 0.5 ) },
-			angle:	  { type: "f", value: 1.57 },
-			scale:	  { type: "f", value: 1.0 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform vec2 center;",
-			"uniform float angle;",
-			"uniform float scale;",
-			"uniform vec2 tSize;",
-
-			"uniform sampler2D tDiffuse;",
-
-			"varying vec2 vUv;",
-
-			"float pattern() {",
-
-				"float s = sin( angle ), c = cos( angle );",
-
-				"vec2 tex = vUv * tSize - center;",
-				"vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;",
-
-				"return ( sin( point.x ) * sin( point.y ) ) * 4.0;",
-
-			"}",
-
-			"void main() {",
-
-				"vec4 color = texture2D( tDiffuse, vUv );",
-
-				"float average = ( color.r + color.g + color.b ) / 3.0;",
-
-				"gl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* ------------------------------------------------------------------------------------------------
-	//	Vignette shader
-	//	- based on PaintEffect postprocess from ro.me
-	//		http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js
-	 ------------------------------------------------------------------------------------------------ */
-
-	'vignette': {
-
-		uniforms: {
-
-			tDiffuse: { type: "t", value: null },
-			offset:   { type: "f", value: 1.0 },
-			darkness: { type: "f", value: 1.0 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform float offset;",
-			"uniform float darkness;",
-
-			"uniform sampler2D tDiffuse;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				// Eskil's vignette
-
-				"vec4 texel = texture2D( tDiffuse, vUv );",
-				"vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );",
-				"gl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );",
-
-				/*
-				// alternative version from glfx.js
-				// this one makes more "dusty" look (as opposed to "burned")
-
-				"vec4 color = texture2D( tDiffuse, vUv );",
-				"float dist = distance( vUv, vec2( 0.5 ) );",
-				"color.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );",
-				"gl_FragColor = color;",
-				*/
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Bleach bypass shader [http://en.wikipedia.org/wiki/Bleach_bypass]
-	//	- based on Nvidia example
-	//		http://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html#post_bleach_bypass
-	 ------------------------------------------------------------------------- */
-
-	'bleachbypass': {
-
-		uniforms: {
-
-			tDiffuse: { type: "t", value: null },
-			opacity:  { type: "f", value: 1.0 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform float opacity;",
-
-			"uniform sampler2D tDiffuse;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vec4 base = texture2D( tDiffuse, vUv );",
-
-				"vec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );",
-				"float lum = dot( lumCoeff, base.rgb );",
-				"vec3 blend = vec3( lum );",
-
-				"float L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );",
-
-				"vec3 result1 = 2.0 * base.rgb * blend;",
-				"vec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );",
-
-				"vec3 newColor = mix( result1, result2, L );",
-
-				"float A2 = opacity * base.a;",
-				"vec3 mixRGB = A2 * newColor.rgb;",
-				"mixRGB += ( ( 1.0 - A2 ) * base.rgb );",
-
-				"gl_FragColor = vec4( mixRGB, base.a );",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* --------------------------------------------------------------------------------------------------
-	//	Focus shader
-	//	- based on PaintEffect postprocess from ro.me
-	//		http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js
-	 -------------------------------------------------------------------------------------------------- */
-
-	'focus': {
-
-		uniforms : {
-
-			"tDiffuse": 		{ type: "t", value: null },
-			"screenWidth": 		{ type: "f", value: 1024 },
-			"screenHeight": 	{ type: "f", value: 1024 },
-			"sampleDistance": 	{ type: "f", value: 0.94 },
-			"waveFactor": 		{ type: "f", value: 0.00125 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform float screenWidth;",
-			"uniform float screenHeight;",
-			"uniform float sampleDistance;",
-			"uniform float waveFactor;",
-
-			"uniform sampler2D tDiffuse;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vec4 color, org, tmp, add;",
-				"float sample_dist, f;",
-				"vec2 vin;",
-				"vec2 uv = vUv;",
-
-				"add = color = org = texture2D( tDiffuse, uv );",
-
-				"vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );",
-				"sample_dist = dot( vin, vin ) * 2.0;",
-
-				"f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;",
-
-				"vec2 sampleSize = vec2(  1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );",
-
-				"add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );",
-				"if( tmp.b < color.b ) color = tmp;",
-
-				"add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );",
-				"if( tmp.b < color.b ) color = tmp;",
-
-				"add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );",
-				"if( tmp.b < color.b ) color = tmp;",
-
-				"add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );",
-				"if( tmp.b < color.b ) color = tmp;",
-
-				"add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );",
-				"if( tmp.b < color.b ) color = tmp;",
-
-				"add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );",
-				"if( tmp.b < color.b ) color = tmp;",
-
-				"add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );",
-				"if( tmp.b < color.b ) color = tmp;",
-
-				"color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );",
-				"color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );",
-
-				"gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );",
-
-			"}"
-
-
-		].join("\n")
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Triangle blur shader
-	//  - based on glfx.js triangle blur shader
-	//		https://github.com/evanw/glfx.js
-
-	// 	A basic blur filter, which convolves the image with a
-	// 	pyramid filter. The pyramid filter is separable and is applied as two
-	//  perpendicular triangle filters.
-	 ------------------------------------------------------------------------- */
-
-	'triangleBlur': {
-
-
-		uniforms : {
-
-			"texture": 	{ type: "t", value: null },
-			"delta": 	{ type: "v2", value:new THREE.Vector2( 1, 1 )  }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-		"#define ITERATIONS 10.0",
-
-		"uniform sampler2D texture;",
-		"uniform vec2 delta;",
-
-		"varying vec2 vUv;",
-
-		"float random( vec3 scale, float seed ) {",
-
-			// use the fragment position for a different seed per-pixel
-
-			"return fract( sin( dot( gl_FragCoord.xyz + seed, scale ) ) * 43758.5453 + seed );",
-
-		"}",
-
-		"void main() {",
-
-			"vec4 color = vec4( 0.0 );",
-
-			"float total = 0.0;",
-
-			// randomize the lookup values to hide the fixed number of samples
-
-			"float offset = random( vec3( 12.9898, 78.233, 151.7182 ), 0.0 );",
-
-			"for ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {",
-
-				"float percent = ( t + offset - 0.5 ) / ITERATIONS;",
-				"float weight = 1.0 - abs( percent );",
-
-				"color += texture2D( texture, vUv + delta * percent ) * weight;",
-				"total += weight;",
-
-			"}",
-
-			"gl_FragColor = color / total;",
-
-		"}",
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Simple test shader
-	 ------------------------------------------------------------------------- */
-
-	'basic': {
-
-		uniforms: {},
-
-		vertexShader: [
-
-			"void main() {",
-
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"void main() {",
-
-				"gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* --------------------------------------------------------------------------------------------------
-	//	Two pass Gaussian blur filter (horizontal and vertical blur shaders)
-	//	- described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/
-	//	  and used in http://www.cake23.de/traveling-wavefronts-lit-up.html
-	//
-	//	- 9 samples per pass
-	//	- standard deviation 2.7
-	//	- "h" and "v" parameters should be set to "1 / width" and "1 / height"
-	 -------------------------------------------------------------------------------------------------- */
-
-	'horizontalBlur': {
-
-		uniforms: {
-
-			"tDiffuse": { type: "t", value: null },
-			"h": 		{ type: "f", value: 1.0 / 512.0 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform sampler2D tDiffuse;",
-			"uniform float h;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vec4 sum = vec4( 0.0 );",
-
-				"sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, 		  	vUv.y ) ) * 0.1633;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;",
-
-				"gl_FragColor = sum;",
-
-			"}"
-
-
-		].join("\n")
-
-	},
-
-	'verticalBlur': {
-
-		uniforms: {
-
-			"tDiffuse": { type: "t", value: null },
-			"v": 		{ type: "f", value: 1.0 / 512.0 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform sampler2D tDiffuse;",
-			"uniform float v;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vec4 sum = vec4( 0.0 );",
-
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y			  ) ) * 0.1633;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;",
-
-				"gl_FragColor = sum;",
-
-			"}"
-
-
-		].join("\n")
-
-	},
-
-	/* --------------------------------------------------------------------------------------------------
-	//	Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position
-	//
-	//	- 9 samples per pass
-	//	- standard deviation 2.7
-	//	- "h" and "v" parameters should be set to "1 / width" and "1 / height"
-	//	- "r" parameter control where "focused" horizontal line lies
-	 -------------------------------------------------------------------------------------------------- */
-
-	'horizontalTiltShift': {
-
-		uniforms: {
-
-			"tDiffuse": { type: "t", value: null },
-			"h": 		{ type: "f", value: 1.0 / 512.0 },
-			"r": 		{ type: "f", value: 0.35 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform sampler2D tDiffuse;",
-			"uniform float h;",
-			"uniform float r;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vec4 sum = vec4( 0.0 );",
-
-				"float hh = h * abs( r - vUv.y );",
-
-				"sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, 		  	 vUv.y ) ) * 0.1633;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;",
-
-				"gl_FragColor = sum;",
-
-			"}"
-
-
-		].join("\n")
-
-	},
-
-	'verticalTiltShift': {
-
-		uniforms: {
-
-			"tDiffuse": { type: "t", value: null },
-			"v": 		{ type: "f", value: 1.0 / 512.0 },
-			"r": 		{ type: "f", value: 0.35 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform sampler2D tDiffuse;",
-			"uniform float v;",
-			"uniform float r;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vec4 sum = vec4( 0.0 );",
-
-				"float vv = v * abs( r - vUv.y );",
-
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y			   ) ) * 0.1633;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;",
-				"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;",
-
-				"gl_FragColor = sum;",
-
-			"}"
-
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Blend two textures
-	 ------------------------------------------------------------------------- */
-
-	'blend': {
-
-		uniforms: {
-
-			tDiffuse1: { type: "t", value: null },
-			tDiffuse2: { type: "t", value: null },
-			mixRatio:  { type: "f", value: 0.5 },
-			opacity:   { type: "f", value: 1.0 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform float opacity;",
-			"uniform float mixRatio;",
-
-			"uniform sampler2D tDiffuse1;",
-			"uniform sampler2D tDiffuse2;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vec4 texel1 = texture2D( tDiffuse1, vUv );",
-				"vec4 texel2 = texture2D( tDiffuse2, vUv );",
-				"gl_FragColor = opacity * mix( texel1, texel2, mixRatio );",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	NVIDIA FXAA by Timothy Lottes
-	//		http://timothylottes.blogspot.com/2011/06/fxaa3-source-released.html
-	//	- WebGL port by @supereggbert
-	//		http://www.glge.org/demos/fxaa/
-	 ------------------------------------------------------------------------- */
-
-	'fxaa': {
-
-		uniforms: {
-
-			"tDiffuse": 	{ type: "t", value: null },
-			"resolution": 	{ type: "v2", value: new THREE.Vector2( 1 / 1024, 1 / 512 )  }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform sampler2D tDiffuse;",
-			"uniform vec2 resolution;",
-
-			"varying vec2 vUv;",
-
-			"#define FXAA_REDUCE_MIN   (1.0/128.0)",
-			"#define FXAA_REDUCE_MUL   (1.0/8.0)",
-			"#define FXAA_SPAN_MAX     8.0",
-
-			"void main() {",
-
-				"vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;",
-				"vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;",
-				"vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;",
-				"vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;",
-				"vec4 rgbaM  = texture2D( tDiffuse,  gl_FragCoord.xy  * resolution );",
-				"vec3 rgbM  = rgbaM.xyz;",
-				"float opacity  = rgbaM.w;",
-
-				"vec3 luma = vec3( 0.299, 0.587, 0.114 );",
-
-				"float lumaNW = dot( rgbNW, luma );",
-				"float lumaNE = dot( rgbNE, luma );",
-				"float lumaSW = dot( rgbSW, luma );",
-				"float lumaSE = dot( rgbSE, luma );",
-				"float lumaM  = dot( rgbM,  luma );",
-				"float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );",
-				"float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );",
-
-				"vec2 dir;",
-				"dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));",
-				"dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));",
-
-				"float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );",
-
-				"float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );",
-				"dir = min( vec2( FXAA_SPAN_MAX,  FXAA_SPAN_MAX),",
-					  "max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),",
-							"dir * rcpDirMin)) * resolution;",
-
-				"vec3 rgbA = 0.5 * (",
-					"texture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ).xyz +",
-					"texture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ).xyz );",
-
-				"vec3 rgbB = rgbA * 0.5 + 0.25 * (",
-					"texture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * -0.5 ).xyz +",
-					"texture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * 0.5 ).xyz );",
-
-				"float lumaB = dot( rgbB, luma );",
-
-				"if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {",
-
-					"gl_FragColor = vec4( rgbA, opacity );",
-
-				"} else {",
-
-					"gl_FragColor = vec4( rgbB, opacity );",
-
-				"}",
-
-			"}",
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Luminosity
-	//	http://en.wikipedia.org/wiki/Luminosity
-	 ------------------------------------------------------------------------- */
-
-	'luminosity': {
-
-		uniforms: {
-
-			"tDiffuse": 	{ type: "t", value: null }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform sampler2D tDiffuse;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vec4 texel = texture2D( tDiffuse, vUv );",
-
-				"vec3 luma = vec3( 0.299, 0.587, 0.114 );",
-
-				"float v = dot( texel.xyz, luma );",
-
-				"gl_FragColor = vec4( v, v, v, texel.w );",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Color correction
-	 ------------------------------------------------------------------------- */
-
-	'colorCorrection': {
-
-		uniforms: {
-
-			"tDiffuse" : 	{ type: "t", value: null },
-			"powRGB" :		{ type: "v3", value: new THREE.Vector3( 2, 2, 2 ) },
-			"mulRGB" :		{ type: "v3", value: new THREE.Vector3( 1, 1, 1 ) }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform sampler2D tDiffuse;",
-			"uniform vec3 powRGB;",
-			"uniform vec3 mulRGB;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"gl_FragColor = texture2D( tDiffuse, vUv );",
-				"gl_FragColor.rgb = mulRGB * pow( gl_FragColor.rgb, powRGB );",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Brightness and contrast adjustment
-	//	https://github.com/evanw/glfx.js
-	//	brightness: -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white)
-	//	contrast: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
-	 ------------------------------------------------------------------------- */
-
-	'brightnessContrast': {
-
-		uniforms: {
-
-			"tDiffuse"   : { type: "t", value: null },
-			"brightness" : { type: "f", value: 0 },
-			"contrast"   : { type: "f", value: 0 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform sampler2D tDiffuse;",
-			"uniform float brightness;",
-			"uniform float contrast;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"gl_FragColor = texture2D( tDiffuse, vUv );",
-
-				"gl_FragColor.rgb += brightness;",
-
-				"if (contrast > 0.0) {",
-					"gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;",
-				"} else {",
-					"gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;",
-				"}",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Hue and saturation adjustment
-	//	https://github.com/evanw/glfx.js
-	//	hue: -1 to 1 (-1 is 180 degrees in the negative direction, 0 is no change, etc.
-	//	saturation: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
-	 ------------------------------------------------------------------------- */
-
-	'hueSaturation': {
-
-		uniforms: {
-
-			"tDiffuse"   : { type: "t", value: null },
-			"hue"        : { type: "f", value: 0 },
-			"saturation" : { type: "f", value: 0 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform sampler2D tDiffuse;",
-			"uniform float hue;",
-			"uniform float saturation;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"gl_FragColor = texture2D( tDiffuse, vUv );",
-
-				// hue
-				"float angle = hue * 3.14159265;",
-				"float s = sin(angle), c = cos(angle);",
-				"vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;",
-				"float len = length(gl_FragColor.rgb);",
-				"gl_FragColor.rgb = vec3(",
-					"dot(gl_FragColor.rgb, weights.xyz),",
-					"dot(gl_FragColor.rgb, weights.zxy),",
-					"dot(gl_FragColor.rgb, weights.yzx)",
-				");",
-
-				// saturation
-				"float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;",
-				"if (saturation > 0.0) {",
-					"gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));",
-				"} else {",
-					"gl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);",
-				"}",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Normal map shader
-	//	- compute normals from heightmap
-	 ------------------------------------------------------------------------- */
-
-	'normalmap': {
-
-		uniforms: {
-
-			"heightMap"	: { type: "t", value: null },
-			"resolution": { type: "v2", value: new THREE.Vector2( 512, 512 ) },
-			"scale"		: { type: "v2", value: new THREE.Vector2( 1, 1 ) },
-			"height"	: { type: "f", value: 0.05 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform float height;",
-			"uniform vec2 resolution;",
-			"uniform sampler2D heightMap;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"float val = texture2D( heightMap, vUv ).x;",
-
-				"float valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;",
-				"float valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;",
-
-				"gl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height  ) ) + 0.5 ), 1.0 );",
-
-			"}",
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Screen-space ambient occlusion shader
-	//	- ported from
-	//		SSAO GLSL shader v1.2
-	//		assembled by Martins Upitis (martinsh) (http://devlog-martinsh.blogspot.com)
-	//		original technique is made by ArKano22 (http://www.gamedev.net/topic/550699-ssao-no-halo-artifacts/)
-	//	- modifications
-	//		- modified to use RGBA packed depth texture (use clear color 1,1,1,1 for depth pass)
-	//		- made fog more compatible with three.js linear fog
-	//		- refactoring and optimizations
-	 ------------------------------------------------------------------------- */
-
-	'ssao': {
-
-		uniforms: {
-
-			"tDiffuse": 	{ type: "t", value: null },
-			"tDepth":   	{ type: "t", value: null },
-			"size": 		{ type: "v2", value: new THREE.Vector2( 512, 512 ) },
-			"cameraNear":	{ type: "f", value: 1 },
-			"cameraFar":	{ type: "f", value: 100 },
-			"fogNear":		{ type: "f", value: 5 },
-			"fogFar":		{ type: "f", value: 100 },
-			"fogEnabled":	{ type: "i", value: 0 },
-			"onlyAO":		{ type: "i", value: 0 },
-			"aoClamp":		{ type: "f", value: 0.3 },
-			"lumInfluence":	{ type: "f", value: 0.9 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform float cameraNear;",
-			"uniform float cameraFar;",
-
-			"uniform float fogNear;",
-			"uniform float fogFar;",
-
-			"uniform bool fogEnabled;",		// attenuate AO with linear fog
-			"uniform bool onlyAO;", 		// use only ambient occlusion pass?
-
-			"uniform vec2 size;",			// texture width, height
-			"uniform float aoClamp;", 		// depth clamp - reduces haloing at screen edges
-
-			"uniform float lumInfluence;",  // how much luminance affects occlusion
-
-			"uniform sampler2D tDiffuse;",
-			"uniform sampler2D tDepth;",
-
-			"varying vec2 vUv;",
-
-			//"#define PI 3.14159265",
-			"#define DL 2.399963229728653", // PI * ( 3.0 - sqrt( 5.0 ) )
-			"#define EULER 2.718281828459045",
-
-			// helpers
-
-			"float width = size.x;", 	// texture width
-			"float height = size.y;", 	// texture height
-
-			"float cameraFarPlusNear = cameraFar + cameraNear;",
-			"float cameraFarMinusNear = cameraFar - cameraNear;",
-			"float cameraCoef = 2.0 * cameraNear;",
-
-			// user variables
-
-			"const int samples = 8;", 		// ao sample count
-			"const float radius = 5.0;", 	// ao radius
-
-			"const bool useNoise = false;", 		 // use noise instead of pattern for sample dithering
-			"const float noiseAmount = 0.0003;", // dithering amount
-
-			"const float diffArea = 0.4;", 		// self-shadowing reduction
-			"const float gDisplace = 0.4;", 	// gauss bell center
-
-			"const vec3 onlyAOColor = vec3( 1.0, 0.7, 0.5 );",
-			//"const vec3 onlyAOColor = vec3( 1.0, 1.0, 1.0 );",
-
-
-			// RGBA depth
-
-			"float unpackDepth( const in vec4 rgba_depth ) {",
-
-				"const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );",
-				"float depth = dot( rgba_depth, bit_shift );",
-				"return depth;",
-
-			"}",
-
-			// generating noise / pattern texture for dithering
-
-			"vec2 rand( const vec2 coord ) {",
-
-				"vec2 noise;",
-
-				"if ( useNoise ) {",
-
-					"float nx = dot ( coord, vec2( 12.9898, 78.233 ) );",
-					"float ny = dot ( coord, vec2( 12.9898, 78.233 ) * 2.0 );",
-
-					"noise = clamp( fract ( 43758.5453 * sin( vec2( nx, ny ) ) ), 0.0, 1.0 );",
-
-				"} else {",
-
-					"float ff = fract( 1.0 - coord.s * ( width / 2.0 ) );",
-					"float gg = fract( coord.t * ( height / 2.0 ) );",
-
-					"noise = vec2( 0.25, 0.75 ) * vec2( ff ) + vec2( 0.75, 0.25 ) * gg;",
-
-				"}",
-
-				"return ( noise * 2.0  - 1.0 ) * noiseAmount;",
-
-			"}",
-
-			"float doFog() {",
-
-				"float zdepth = unpackDepth( texture2D( tDepth, vUv ) );",
-				"float depth = -cameraFar * cameraNear / ( zdepth * cameraFarMinusNear - cameraFar );",
-
-				"return smoothstep( fogNear, fogFar, depth );",
-
-			"}",
-
-			"float readDepth( const in vec2 coord ) {",
-
-				//"return ( 2.0 * cameraNear ) / ( cameraFar + cameraNear - unpackDepth( texture2D( tDepth, coord ) ) * ( cameraFar - cameraNear ) );",
-				"return cameraCoef / ( cameraFarPlusNear - unpackDepth( texture2D( tDepth, coord ) ) * cameraFarMinusNear );",
-
-
-			"}",
-
-			"float compareDepths( const in float depth1, const in float depth2, inout int far ) {",
-
-				"float garea = 2.0;", 						 // gauss bell width
-				"float diff = ( depth1 - depth2 ) * 100.0;", // depth difference (0-100)
-
-				// reduce left bell width to avoid self-shadowing
-
-				"if ( diff < gDisplace ) {",
-
-					"garea = diffArea;",
-
-				"} else {",
-
-					"far = 1;",
-
-				"}",
-
-				"float dd = diff - gDisplace;",
-				"float gauss = pow( EULER, -2.0 * dd * dd / ( garea * garea ) );",
-				"return gauss;",
-
-			"}",
-
-			"float calcAO( float depth, float dw, float dh ) {",
-
-				"float dd = radius - depth * radius;",
-				"vec2 vv = vec2( dw, dh );",
-
-				"vec2 coord1 = vUv + dd * vv;",
-				"vec2 coord2 = vUv - dd * vv;",
-
-				"float temp1 = 0.0;",
-				"float temp2 = 0.0;",
-
-				"int far = 0;",
-				"temp1 = compareDepths( depth, readDepth( coord1 ), far );",
-
-				// DEPTH EXTRAPOLATION
-
-				"if ( far > 0 ) {",
-
-					"temp2 = compareDepths( readDepth( coord2 ), depth, far );",
-					"temp1 += ( 1.0 - temp1 ) * temp2;",
-
-				"}",
-
-				"return temp1;",
-
-			"}",
-
-			"void main() {",
-
-				"vec2 noise = rand( vUv );",
-				"float depth = readDepth( vUv );",
-
-				"float tt = clamp( depth, aoClamp, 1.0 );",
-
-				"float w = ( 1.0 / width )  / tt + ( noise.x * ( 1.0 - noise.x ) );",
-				"float h = ( 1.0 / height ) / tt + ( noise.y * ( 1.0 - noise.y ) );",
-
-				"float pw;",
-				"float ph;",
-
-				"float ao;",
-
-				"float dz = 1.0 / float( samples );",
-				"float z = 1.0 - dz / 2.0;",
-				"float l = 0.0;",
-
-				"for ( int i = 0; i <= samples; i ++ ) {",
-
-					"float r = sqrt( 1.0 - z );",
-
-					"pw = cos( l ) * r;",
-					"ph = sin( l ) * r;",
-					"ao += calcAO( depth, pw * w, ph * h );",
-					"z = z - dz;",
-					"l = l + DL;",
-
-				"}",
-
-				"ao /= float( samples );",
-				"ao = 1.0 - ao;",
-
-				"if ( fogEnabled ) {",
-
-					"ao = mix( ao, 1.0, doFog() );",
-
-				"}",
-
-				"vec3 color = texture2D( tDiffuse, vUv ).rgb;",
-
-				"vec3 lumcoeff = vec3( 0.299, 0.587, 0.114 );",
-				"float lum = dot( color.rgb, lumcoeff );",
-				"vec3 luminance = vec3( lum );",
-
-				"vec3 final = vec3( color * mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );", // mix( color * ao, white, luminance )
-
-				"if ( onlyAO ) {",
-
-					"final = onlyAOColor * vec3( mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );", // ambient occlusion only
-
-				"}",
-
-				"gl_FragColor = vec4( final, 1.0 );",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Colorify shader
-	 ------------------------------------------------------------------------- */
-
-	'colorify': {
-
-		uniforms: {
-
-			tDiffuse: { type: "t", value: null },
-			color:    { type: "c", value: new THREE.Color( 0xffffff ) }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform vec3 color;",
-			"uniform sampler2D tDiffuse;",
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vec4 texel = texture2D( tDiffuse, vUv );",
-
-				"vec3 luma = vec3( 0.299, 0.587, 0.114 );",
-				"float v = dot( texel.xyz, luma );",
-
-				"gl_FragColor = vec4( v * color, texel.w );",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	/* -------------------------------------------------------------------------
-	//	Unpack RGBA depth shader
-	//	- show RGBA encoded depth as monochrome color
-	 ------------------------------------------------------------------------- */
-
-	'unpackDepthRGBA': {
-
-		uniforms: {
-
-			tDiffuse: { type: "t", value: null },
-			opacity:  { type: "f", value: 1.0 }
-
-		},
-
-		vertexShader: [
-
-			"varying vec2 vUv;",
-
-			"void main() {",
-
-				"vUv = uv;",
-				"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
-
-			"}"
-
-		].join("\n"),
-
-		fragmentShader: [
-
-			"uniform float opacity;",
-
-			"uniform sampler2D tDiffuse;",
-
-			"varying vec2 vUv;",
-
-			// RGBA depth
-
-			"float unpackDepth( const in vec4 rgba_depth ) {",
-
-				"const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );",
-				"float depth = dot( rgba_depth, bit_shift );",
-				"return depth;",
-
-			"}",
-
-			"void main() {",
-
-				"float depth = 1.0 - unpackDepth( texture2D( tDiffuse, vUv ) );",
-				"gl_FragColor = opacity * vec4( vec3( depth ), 1.0 );",
-
-			"}"
-
-		].join("\n")
-
-	},
-
-	// METHODS
-
-	buildKernel: function( sigma ) {
-
-		// We lop off the sqrt(2 * pi) * sigma term, since we're going to normalize anyway.
-
-		function gauss( x, sigma ) {
-
-			return Math.exp( - ( x * x ) / ( 2.0 * sigma * sigma ) );
-
-		}
-
-		var i, values, sum, halfWidth, kMaxKernelSize = 25, kernelSize = 2 * Math.ceil( sigma * 3.0 ) + 1;
-
-		if ( kernelSize > kMaxKernelSize ) kernelSize = kMaxKernelSize;
-		halfWidth = ( kernelSize - 1 ) * 0.5;
-
-		values = new Array( kernelSize );
-		sum = 0.0;
-		for ( i = 0; i < kernelSize; ++i ) {
-
-			values[ i ] = gauss( i - halfWidth, sigma );
-			sum += values[ i ];
-
-		}
-
-		// normalize the kernel
-
-		for ( i = 0; i < kernelSize; ++i ) values[ i ] /= sum;
-
-		return values;
-
-	}
-
-};

+ 20 - 14
examples/js/postprocessing/BloomPass.js

@@ -16,19 +16,22 @@ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
 	this.renderTargetX = new THREE.WebGLRenderTarget( resolution, resolution, pars );
 	this.renderTargetY = new THREE.WebGLRenderTarget( resolution, resolution, pars );
 
-	// screen material
+	// blit material
 
-	var screenShader = THREE.ShaderExtras[ "screen" ];
+	if ( THREE.BlitShader === undefined )
+		console.error( "THREE.BloomPass relies on THREE.BlitShader" );
 
-	this.screenUniforms = THREE.UniformsUtils.clone( screenShader.uniforms );
+	var blitShader = THREE.BlitShader;
 
-	this.screenUniforms[ "opacity" ].value = strength;
+	this.blitUniforms = THREE.UniformsUtils.clone( blitShader.uniforms );
 
-	this.materialScreen = new THREE.ShaderMaterial( {
+	this.blitUniforms[ "opacity" ].value = strength;
 
-		uniforms: this.screenUniforms,
-		vertexShader: screenShader.vertexShader,
-		fragmentShader: screenShader.fragmentShader,
+	this.materialBlit = new THREE.ShaderMaterial( {
+
+		uniforms: this.blitUniforms,
+		vertexShader: blitShader.vertexShader,
+		fragmentShader: blitShader.fragmentShader,
 		blending: THREE.AdditiveBlending,
 		transparent: true
 
@@ -36,12 +39,15 @@ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
 
 	// convolution material
 
-	var convolutionShader = THREE.ShaderExtras[ "convolution" ];
+	if ( THREE.ConvolutionShader === undefined )
+		console.error( "THREE.BloomPass relies on THREE.ConvolutionShader" );
+
+	var convolutionShader = THREE.ConvolutionShader;
 
 	this.convolutionUniforms = THREE.UniformsUtils.clone( convolutionShader.uniforms );
 
 	this.convolutionUniforms[ "uImageIncrement" ].value = THREE.BloomPass.blurx;
-	this.convolutionUniforms[ "cKernel" ].value = THREE.ShaderExtras.buildKernel( sigma );
+	this.convolutionUniforms[ "cKernel" ].value = THREE.ConvolutionShader.buildKernel( sigma );
 
 	this.materialConvolution = new THREE.ShaderMaterial( {
 
@@ -49,8 +55,8 @@ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
 		vertexShader:  convolutionShader.vertexShader,
 		fragmentShader: convolutionShader.fragmentShader,
 		defines: {
-				"KERNEL_SIZE_FLOAT": kernelSize.toFixed( 1 ),
-				"KERNEL_SIZE_INT": kernelSize.toFixed( 0 )
+			"KERNEL_SIZE_FLOAT": kernelSize.toFixed( 1 ),
+			"KERNEL_SIZE_INT": kernelSize.toFixed( 0 )
 		}
 
 	} );
@@ -86,9 +92,9 @@ THREE.BloomPass.prototype = {
 
 		// Render original scene with superimposed blur to texture
 
-		THREE.EffectComposer.quad.material = this.materialScreen;
+		THREE.EffectComposer.quad.material = this.materialBlit;
 
-		this.screenUniforms[ "tDiffuse" ].value = this.renderTargetY;
+		this.blitUniforms[ "tDiffuse" ].value = this.renderTargetY;
 
 		if ( maskActive ) renderer.context.enable( renderer.context.STENCIL_TEST );
 

+ 7 - 6
examples/js/postprocessing/DotScreenPass.js

@@ -4,15 +4,16 @@
 
 THREE.DotScreenPass = function ( center, angle, scale ) {
 
-	var shader = THREE.ShaderExtras[ "dotscreen" ];
+	if ( THREE.DotScreenShader === undefined )
+		console.error( "THREE.DotScreenPass relies on THREE.DotScreenShader" );
 
-	this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
+	var shader = THREE.DotScreenShader;
 
-	if ( center !== undefined )
-		this.uniforms[ "center" ].value.copy( center );
+	this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
-	if ( angle !== undefined )	this.uniforms[ "angle"].value = angle;
-	if ( scale !== undefined )	this.uniforms[ "scale"].value = scale;
+	if ( center !== undefined ) this.uniforms[ "center" ].value.copy( center );
+	if ( angle !== undefined ) this.uniforms[ "angle"].value = angle;
+	if ( scale !== undefined ) this.uniforms[ "scale"].value = scale;
 
 	this.material = new THREE.ShaderMaterial( {
 

+ 4 - 1
examples/js/postprocessing/EffectComposer.js

@@ -25,7 +25,10 @@ THREE.EffectComposer = function ( renderer, renderTarget ) {
 
 	this.passes = [];
 
-	this.copyPass = new THREE.ShaderPass( THREE.ShaderExtras[ "screen" ] );
+	if ( THREE.BlitShader === undefined )
+		console.error( "THREE.EffectComposer relies on THREE.BlitShader" );
+
+	this.copyPass = new THREE.ShaderPass( THREE.BlitShader );
 
 };
 

+ 3 - 0
examples/js/postprocessing/FilmPass.js

@@ -4,6 +4,9 @@
 
 THREE.FilmPass = function ( noiseIntensity, scanlinesIntensity, scanlinesCount, grayscale ) {
 
+	if ( THREE.FilmShader === undefined )
+		console.error( "THREE.FilmPass relies on THREE.FilmShader" );
+
 	var shader = THREE.FilmShader;
 
 	this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );

+ 4 - 1
examples/js/postprocessing/SavePass.js

@@ -4,7 +4,10 @@
 
 THREE.SavePass = function ( renderTarget ) {
 
-	var shader = THREE.ShaderExtras[ "screen" ];
+	if ( THREE.BlitShader === undefined )
+		console.error( "THREE.SavePass relies on THREE.BlitShader" );
+
+	var shader = THREE.BlitShader;
 
 	this.textureID = "tDiffuse";
 

+ 4 - 1
examples/js/postprocessing/TexturePass.js

@@ -4,7 +4,10 @@
 
 THREE.TexturePass = function ( texture, opacity ) {
 
-	var shader = THREE.ShaderExtras[ "screen" ];
+	if ( THREE.BlitShader === undefined )
+		console.error( "THREE.TexturePass relies on THREE.BlitShader" );
+
+	var shader = THREE.BlitShader;
 
 	this.uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 

+ 31 - 0
examples/js/shaders/BasicShader.js

@@ -0,0 +1,31 @@
+/**
+ * @author mrdoob / http://www.mrdoob.com
+ *
+ * Simple test shader
+ */
+
+THREE.BasicShader = {
+
+	uniforms: {},
+
+	vertexShader: [
+
+		"void main() {",
+
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"void main() {",
+
+			"gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );",
+
+		"}"
+
+	].join("\n")
+
+};

+ 64 - 0
examples/js/shaders/BleachBypassShader.js

@@ -0,0 +1,64 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Bleach bypass shader [http://en.wikipedia.org/wiki/Bleach_bypass]
+ * - based on Nvidia example
+ * http://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html#post_bleach_bypass
+ */
+
+THREE.BleachBypassShader = {
+
+	uniforms: {
+
+		"tDiffuse": { type: "t", value: null },
+		"opacity":  { type: "f", value: 1.0 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform float opacity;",
+
+		"uniform sampler2D tDiffuse;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vec4 base = texture2D( tDiffuse, vUv );",
+
+			"vec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );",
+			"float lum = dot( lumCoeff, base.rgb );",
+			"vec3 blend = vec3( lum );",
+
+			"float L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );",
+
+			"vec3 result1 = 2.0 * base.rgb * blend;",
+			"vec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );",
+
+			"vec3 newColor = mix( result1, result2, L );",
+
+			"float A2 = opacity * base.a;",
+			"vec3 mixRGB = A2 * newColor.rgb;",
+			"mixRGB += ( ( 1.0 - A2 ) * base.rgb );",
+
+			"gl_FragColor = vec4( mixRGB, base.a );",
+
+		"}"
+
+	].join("\n")
+
+};

+ 51 - 0
examples/js/shaders/BlendShader.js

@@ -0,0 +1,51 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Blend two textures
+ */
+
+THREE.BlendShader = {
+
+	uniforms: {
+
+		"tDiffuse1": { type: "t", value: null },
+		"tDiffuse2": { type: "t", value: null },
+		"mixRatio":  { type: "f", value: 0.5 },
+		"opacity":   { type: "f", value: 1.0 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform float opacity;",
+		"uniform float mixRatio;",
+
+		"uniform sampler2D tDiffuse1;",
+		"uniform sampler2D tDiffuse2;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vec4 texel1 = texture2D( tDiffuse1, vUv );",
+			"vec4 texel2 = texture2D( tDiffuse2, vUv );",
+			"gl_FragColor = opacity * mix( texel1, texel2, mixRatio );",
+
+		"}"
+
+	].join("\n")
+
+};

+ 46 - 0
examples/js/shaders/BlitShader.js

@@ -0,0 +1,46 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Full-screen textured quad shader
+ */
+
+THREE.BlitShader = {
+
+	uniforms: {
+
+		"tDiffuse": { type: "t", value: null },
+		"opacity":  { type: "f", value: 1.0 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform float opacity;",
+
+		"uniform sampler2D tDiffuse;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vec4 texel = texture2D( tDiffuse, vUv );",
+			"gl_FragColor = opacity * texel;",
+
+		"}"
+
+	].join("\n")
+
+};

+ 116 - 0
examples/js/shaders/BokehShader.js

@@ -0,0 +1,116 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Depth-of-field shader with bokeh
+ * ported from GLSL shader by Martins Upitis
+ * http://artmartinsh.blogspot.com/2010/02/glsl-lens-blur-filter-with-bokeh.html
+ */
+
+THREE.BokehShader = {
+
+	uniforms: {
+
+		"tColor":   { type: "t", value: null },
+		"tDepth":   { type: "t", value: null },
+		"focus":    { type: "f", value: 1.0 },
+		"aspect":   { type: "f", value: 1.0 },
+		"aperture": { type: "f", value: 0.025 },
+		"maxblur":  { type: "f", value: 1.0 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"varying vec2 vUv;",
+
+		"uniform sampler2D tColor;",
+		"uniform sampler2D tDepth;",
+
+		"uniform float maxblur;",  // max blur amount
+		"uniform float aperture;", // aperture - bigger values for shallower depth of field
+
+		"uniform float focus;",
+		"uniform float aspect;",
+
+		"void main() {",
+
+			"vec2 aspectcorrect = vec2( 1.0, aspect );",
+
+			"vec4 depth1 = texture2D( tDepth, vUv );",
+
+			"float factor = depth1.x - focus;",
+
+			"vec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );",
+
+			"vec2 dofblur9 = dofblur * 0.9;",
+			"vec2 dofblur7 = dofblur * 0.7;",
+			"vec2 dofblur4 = dofblur * 0.4;",
+
+			"vec4 col = vec4( 0.0 );",
+
+			"col += texture2D( tColor, vUv.xy );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur );",
+
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur9 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur9 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur9 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur9 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur9 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur9 );",
+
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur7 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur7 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur7 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur7 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur7 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur7 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur7 );",
+
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur4 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.4,   0.0  ) * aspectcorrect ) * dofblur4 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur4 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur4 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur4 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur4 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );",
+			"col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur4 );",
+
+			"gl_FragColor = col / 41.0;",
+			"gl_FragColor.a = 1.0;",
+
+		"}"
+
+	].join("\n")
+
+};

+ 58 - 0
examples/js/shaders/BrightnessContrastShader.js

@@ -0,0 +1,58 @@
+/**
+ * @author tapio / http://tapio.github.com/
+ *
+ * Brightness and contrast adjustment
+ * https://github.com/evanw/glfx.js
+ * brightness: -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white)
+ * contrast: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
+ */
+
+THREE.BrightnessContrastShader = {
+
+	uniforms: {
+
+		"tDiffuse":   { type: "t", value: null },
+		"brightness": { type: "f", value: 0 },
+		"contrast":   { type: "f", value: 0 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform sampler2D tDiffuse;",
+		"uniform float brightness;",
+		"uniform float contrast;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"gl_FragColor = texture2D( tDiffuse, vUv );",
+
+			"gl_FragColor.rgb += brightness;",
+
+			"if (contrast > 0.0) {",
+				"gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;",
+			"} else {",
+				"gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;",
+			"}",
+
+		"}"
+
+	].join("\n")
+
+};

+ 48 - 0
examples/js/shaders/ColorCorrectionShader.js

@@ -0,0 +1,48 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Color correction
+ */
+
+THREE.ColorCorrectionShader = {
+
+	uniforms: {
+
+		"tDiffuse": { type: "t", value: null },
+		"powRGB":   { type: "v3", value: new THREE.Vector3( 2, 2, 2 ) },
+		"mulRGB":   { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform sampler2D tDiffuse;",
+		"uniform vec3 powRGB;",
+		"uniform vec3 mulRGB;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"gl_FragColor = texture2D( tDiffuse, vUv );",
+			"gl_FragColor.rgb = mulRGB * pow( gl_FragColor.rgb, powRGB );",
+
+		"}"
+
+	].join("\n")
+
+};

+ 49 - 0
examples/js/shaders/ColorifyShader.js

@@ -0,0 +1,49 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Colorify shader
+ */
+
+THREE.ColorifyShader = {
+
+	uniforms: {
+
+		"tDiffuse": { type: "t", value: null },
+		"color":    { type: "c", value: new THREE.Color( 0xffffff ) }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform vec3 color;",
+		"uniform sampler2D tDiffuse;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vec4 texel = texture2D( tDiffuse, vUv );",
+
+			"vec3 luma = vec3( 0.299, 0.587, 0.114 );",
+			"float v = dot( texel.xyz, luma );",
+
+			"gl_FragColor = vec4( v * color, texel.w );",
+
+		"}"
+
+	].join("\n")
+
+};

+ 101 - 0
examples/js/shaders/ConvolutionShader.js

@@ -0,0 +1,101 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Convolution shader
+ * ported from o3d sample to WebGL / GLSL
+ * http://o3d.googlecode.com/svn/trunk/samples/convolution.html
+ */
+
+THREE.ConvolutionShader = {
+
+	defines: {
+
+		"KERNEL_SIZE_FLOAT": "25.0",
+		"KERNEL_SIZE_INT": "25",
+
+	},
+
+	uniforms: {
+
+		"tDiffuse":        { type: "t", value: null },
+		"uImageIncrement": { type: "v2", value: new THREE.Vector2( 0.001953125, 0.0 ) },
+		"cKernel":         { type: "fv1", value: [] }
+
+	},
+
+	vertexShader: [
+
+		"uniform vec2 uImageIncrement;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform float cKernel[ KERNEL_SIZE_INT ];",
+
+		"uniform sampler2D tDiffuse;",
+		"uniform vec2 uImageIncrement;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vec2 imageCoord = vUv;",
+			"vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );",
+
+			"for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {",
+
+				"sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];",
+				"imageCoord += uImageIncrement;",
+
+			"}",
+
+			"gl_FragColor = sum;",
+
+		"}"
+
+
+	].join("\n"),
+
+	buildKernel: function ( sigma ) {
+
+		// We lop off the sqrt(2 * pi) * sigma term, since we're going to normalize anyway.
+
+		function gauss( x, sigma ) {
+
+			return Math.exp( - ( x * x ) / ( 2.0 * sigma * sigma ) );
+
+		}
+
+		var i, values, sum, halfWidth, kMaxKernelSize = 25, kernelSize = 2 * Math.ceil( sigma * 3.0 ) + 1;
+
+		if ( kernelSize > kMaxKernelSize ) kernelSize = kMaxKernelSize;
+		halfWidth = ( kernelSize - 1 ) * 0.5;
+
+		values = new Array( kernelSize );
+		sum = 0.0;
+		for ( i = 0; i < kernelSize; ++i ) {
+
+			values[ i ] = gauss( i - halfWidth, sigma );
+			sum += values[ i ];
+
+		}
+
+		// normalize the kernel
+
+		for ( i = 0; i < kernelSize; ++i ) values[ i ] /= sum;
+
+		return values;
+
+	}
+
+};

+ 58 - 0
examples/js/shaders/DOFMipMapShader.js

@@ -0,0 +1,58 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Depth-of-field shader using mipmaps
+ * - from Matt Handley @applmak
+ * - requires power-of-2 sized render target with enabled mipmaps
+ */
+
+THREE.DOFMipMapShader = {
+
+	uniforms: {
+
+		"tColor":   { type: "t", value: null },
+		"tDepth":   { type: "t", value: null },
+		"focus":    { type: "f", value: 1.0 },
+		"maxblur":  { type: "f", value: 1.0 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform float focus;",
+		"uniform float maxblur;",
+
+		"uniform sampler2D tColor;",
+		"uniform sampler2D tDepth;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vec4 depth = texture2D( tDepth, vUv );",
+
+			"float factor = depth.x - focus;",
+
+			"vec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );",
+
+			"gl_FragColor = col;",
+			"gl_FragColor.a = 1.0;",
+
+		"}"
+
+	].join("\n")
+
+};

+ 68 - 0
examples/js/shaders/DotScreenShader.js

@@ -0,0 +1,68 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Dot screen shader
+ * based on glfx.js sepia shader
+ * https://github.com/evanw/glfx.js
+ */
+
+THREE.DotScreenShader = {
+
+	uniforms: {
+
+		"tDiffuse": { type: "t", value: null },
+		"tSize":    { type: "v2", value: new THREE.Vector2( 256, 256 ) },
+		"center":   { type: "v2", value: new THREE.Vector2( 0.5, 0.5 ) },
+		"angle":    { type: "f", value: 1.57 },
+		"scale":    { type: "f", value: 1.0 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform vec2 center;",
+		"uniform float angle;",
+		"uniform float scale;",
+		"uniform vec2 tSize;",
+
+		"uniform sampler2D tDiffuse;",
+
+		"varying vec2 vUv;",
+
+		"float pattern() {",
+
+			"float s = sin( angle ), c = cos( angle );",
+
+			"vec2 tex = vUv * tSize - center;",
+			"vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;",
+
+			"return ( sin( point.x ) * sin( point.y ) ) * 4.0;",
+
+		"}",
+
+		"void main() {",
+
+			"vec4 color = texture2D( tDiffuse, vUv );",
+
+			"float average = ( color.r + color.g + color.b ) / 3.0;",
+
+			"gl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );",
+
+		"}"
+
+	].join("\n")
+
+};

+ 99 - 0
examples/js/shaders/FXAAShader.js

@@ -0,0 +1,99 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ * @author davidedc / http://www.sketchpatch.net/
+ *
+ * NVIDIA FXAA by Timothy Lottes
+ * http://timothylottes.blogspot.com/2011/06/fxaa3-source-released.html
+ * - WebGL port by @supereggbert
+ * http://www.glge.org/demos/fxaa/
+ */
+
+THREE.FXAAShader = {
+
+	uniforms: {
+
+		"tDiffuse":   { type: "t", value: null },
+		"resolution": { type: "v2", value: new THREE.Vector2( 1 / 1024, 1 / 512 )  }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform sampler2D tDiffuse;",
+		"uniform vec2 resolution;",
+
+		"varying vec2 vUv;",
+
+		"#define FXAA_REDUCE_MIN   (1.0/128.0)",
+		"#define FXAA_REDUCE_MUL   (1.0/8.0)",
+		"#define FXAA_SPAN_MAX     8.0",
+
+		"void main() {",
+
+			"vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;",
+			"vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;",
+			"vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;",
+			"vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;",
+			"vec4 rgbaM  = texture2D( tDiffuse,  gl_FragCoord.xy  * resolution );",
+			"vec3 rgbM  = rgbaM.xyz;",
+			"float opacity  = rgbaM.w;",
+
+			"vec3 luma = vec3( 0.299, 0.587, 0.114 );",
+
+			"float lumaNW = dot( rgbNW, luma );",
+			"float lumaNE = dot( rgbNE, luma );",
+			"float lumaSW = dot( rgbSW, luma );",
+			"float lumaSE = dot( rgbSE, luma );",
+			"float lumaM  = dot( rgbM,  luma );",
+			"float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );",
+			"float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );",
+
+			"vec2 dir;",
+			"dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));",
+			"dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));",
+
+			"float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );",
+
+			"float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );",
+			"dir = min( vec2( FXAA_SPAN_MAX,  FXAA_SPAN_MAX),",
+				  "max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),",
+						"dir * rcpDirMin)) * resolution;",
+
+			"vec3 rgbA = 0.5 * (",
+				"texture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ).xyz +",
+				"texture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ).xyz );",
+
+			"vec3 rgbB = rgbA * 0.5 + 0.25 * (",
+				"texture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * -0.5 ).xyz +",
+				"texture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * 0.5 ).xyz );",
+
+			"float lumaB = dot( rgbB, luma );",
+
+			"if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {",
+
+				"gl_FragColor = vec4( rgbA, opacity );",
+
+			"} else {",
+
+				"gl_FragColor = vec4( rgbB, opacity );",
+
+			"}",
+
+		"}"
+
+	].join("\n")
+
+};

+ 6 - 6
examples/js/shaders/FilmShader.js

@@ -24,12 +24,12 @@ THREE.FilmShader = {
 
 	uniforms: {
 
-		tDiffuse:   { type: "t", value: null },
-		time: 	    { type: "f", value: 0.0 },
-		nIntensity: { type: "f", value: 0.5 },
-		sIntensity: { type: "f", value: 0.05 },
-		sCount: 	{ type: "f", value: 4096 },
-		grayscale:  { type: "i", value: 1 }
+		"tDiffuse":   { type: "t", value: null },
+		"time":       { type: "f", value: 0.0 },
+		"nIntensity": { type: "f", value: 0.5 },
+		"sIntensity": { type: "f", value: 0.05 },
+		"sCount":     { type: "f", value: 4096 },
+		"grayscale":  { type: "i", value: 1 }
 
 	},
 

+ 91 - 0
examples/js/shaders/FocusShader.js

@@ -0,0 +1,91 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Focus shader
+ * based on PaintEffect postprocess from ro.me
+ * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js
+ */
+
+THREE.FocusShader = {
+
+	uniforms : {
+
+		"tDiffuse":       { type: "t", value: null },
+		"screenWidth":    { type: "f", value: 1024 },
+		"screenHeight":   { type: "f", value: 1024 },
+		"sampleDistance": { type: "f", value: 0.94 },
+		"waveFactor":     { type: "f", value: 0.00125 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform float screenWidth;",
+		"uniform float screenHeight;",
+		"uniform float sampleDistance;",
+		"uniform float waveFactor;",
+
+		"uniform sampler2D tDiffuse;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vec4 color, org, tmp, add;",
+			"float sample_dist, f;",
+			"vec2 vin;",
+			"vec2 uv = vUv;",
+
+			"add = color = org = texture2D( tDiffuse, uv );",
+
+			"vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );",
+			"sample_dist = dot( vin, vin ) * 2.0;",
+
+			"f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;",
+
+			"vec2 sampleSize = vec2(  1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );",
+
+			"add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );",
+			"if( tmp.b < color.b ) color = tmp;",
+
+			"add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );",
+			"if( tmp.b < color.b ) color = tmp;",
+
+			"add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );",
+			"if( tmp.b < color.b ) color = tmp;",
+
+			"add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );",
+			"if( tmp.b < color.b ) color = tmp;",
+
+			"add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );",
+			"if( tmp.b < color.b ) color = tmp;",
+
+			"add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );",
+			"if( tmp.b < color.b ) color = tmp;",
+
+			"add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );",
+			"if( tmp.b < color.b ) color = tmp;",
+
+			"color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );",
+			"color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );",
+
+			"gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );",
+
+		"}"
+
+
+	].join("\n")
+};

+ 62 - 0
examples/js/shaders/HorizontalBlurShader.js

@@ -0,0 +1,62 @@
+/**
+ * @author zz85 / http://www.lab4games.net/zz85/blog
+ *
+ * Two pass Gaussian blur filter (horizontal and vertical blur shaders)
+ * - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/
+ *   and used in http://www.cake23.de/traveling-wavefronts-lit-up.html
+ *
+ * - 9 samples per pass
+ * - standard deviation 2.7
+ * - "h" and "v" parameters should be set to "1 / width" and "1 / height"
+ */
+
+THREE.HorizontalBlurShader = {
+
+	uniforms: {
+
+		"tDiffuse": { type: "t", value: null },
+		"h":        { type: "f", value: 1.0 / 512.0 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform sampler2D tDiffuse;",
+		"uniform float h;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vec4 sum = vec4( 0.0 );",
+
+			"sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;",
+
+			"gl_FragColor = sum;",
+
+		"}"
+
+	].join("\n")
+
+};

+ 65 - 0
examples/js/shaders/HorizontalTiltShiftShader.js

@@ -0,0 +1,65 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position
+ *
+ * - 9 samples per pass
+ * - standard deviation 2.7
+ * - "h" and "v" parameters should be set to "1 / width" and "1 / height"
+ * - "r" parameter control where "focused" horizontal line lies
+ */
+
+THREE.HorizontalTiltShiftShader = {
+
+	uniforms: {
+
+		"tDiffuse": { type: "t", value: null },
+		"h":        { type: "f", value: 1.0 / 512.0 },
+		"r":        { type: "f", value: 0.35 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform sampler2D tDiffuse;",
+		"uniform float h;",
+		"uniform float r;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vec4 sum = vec4( 0.0 );",
+
+			"float hh = h * abs( r - vUv.y );",
+
+			"sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;",
+
+			"gl_FragColor = sum;",
+
+		"}"
+
+	].join("\n")
+
+};

+ 69 - 0
examples/js/shaders/HueSaturationShader.js

@@ -0,0 +1,69 @@
+/**
+ * @author tapio / http://tapio.github.com/
+ *
+ * Hue and saturation adjustment
+ * https://github.com/evanw/glfx.js
+ * hue: -1 to 1 (-1 is 180 degrees in the negative direction, 0 is no change, etc.
+ * saturation: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
+ */
+
+THREE.HueSaturationShader = {
+
+	uniforms: {
+
+		"tDiffuse":   { type: "t", value: null },
+		"hue":        { type: "f", value: 0 },
+		"saturation": { type: "f", value: 0 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform sampler2D tDiffuse;",
+		"uniform float hue;",
+		"uniform float saturation;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"gl_FragColor = texture2D( tDiffuse, vUv );",
+
+			// hue
+			"float angle = hue * 3.14159265;",
+			"float s = sin(angle), c = cos(angle);",
+			"vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;",
+			"float len = length(gl_FragColor.rgb);",
+			"gl_FragColor.rgb = vec3(",
+				"dot(gl_FragColor.rgb, weights.xyz),",
+				"dot(gl_FragColor.rgb, weights.zxy),",
+				"dot(gl_FragColor.rgb, weights.yzx)",
+			");",
+
+			// saturation
+			"float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;",
+			"if (saturation > 0.0) {",
+				"gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));",
+			"} else {",
+				"gl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);",
+			"}",
+
+		"}"
+
+	].join("\n")
+
+};

+ 50 - 0
examples/js/shaders/LuminosityShader.js

@@ -0,0 +1,50 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Luminosity
+ * http://en.wikipedia.org/wiki/Luminosity
+ */
+
+THREE.LuminosityShader = {
+
+	uniforms: {
+
+		"tDiffuse": { type: "t", value: null }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform sampler2D tDiffuse;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vec4 texel = texture2D( tDiffuse, vUv );",
+
+			"vec3 luma = vec3( 0.299, 0.587, 0.114 );",
+
+			"float v = dot( texel.xyz, luma );",
+
+			"gl_FragColor = vec4( v, v, v, texel.w );",
+
+		"}"
+
+	].join("\n")
+
+};

+ 53 - 0
examples/js/shaders/NormalMapShader.js

@@ -0,0 +1,53 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Normal map shader
+ * - compute normals from heightmap
+ */
+
+THREE.NormalMapShader = {
+
+	uniforms: {
+
+		"heightMap":  { type: "t", value: null },
+		"resolution": { type: "v2", value: new THREE.Vector2( 512, 512 ) },
+		"scale":      { type: "v2", value: new THREE.Vector2( 1, 1 ) },
+		"height":     { type: "f", value: 0.05 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform float height;",
+		"uniform vec2 resolution;",
+		"uniform sampler2D heightMap;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"float val = texture2D( heightMap, vUv ).x;",
+
+			"float valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;",
+			"float valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;",
+
+			"gl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height  ) ) + 0.5 ), 1.0 );",
+
+		"}"
+
+	].join("\n")
+
+};

+ 259 - 0
examples/js/shaders/SSAOShader.js

@@ -0,0 +1,259 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Screen-space ambient occlusion shader
+ * - ported from
+ *   SSAO GLSL shader v1.2
+ *   assembled by Martins Upitis (martinsh) (http://devlog-martinsh.blogspot.com)
+ *   original technique is made by ArKano22 (http://www.gamedev.net/topic/550699-ssao-no-halo-artifacts/)
+ * - modifications
+ * - modified to use RGBA packed depth texture (use clear color 1,1,1,1 for depth pass)
+ * - made fog more compatible with three.js linear fog
+ * - refactoring and optimizations
+ */
+
+THREE.SSAOShader = {
+
+	uniforms: {
+
+		"tDiffuse":     { type: "t", value: null },
+		"tDepth":       { type: "t", value: null },
+		"size":         { type: "v2", value: new THREE.Vector2( 512, 512 ) },
+		"cameraNear":   { type: "f", value: 1 },
+		"cameraFar":    { type: "f", value: 100 },
+		"fogNear":      { type: "f", value: 5 },
+		"fogFar":       { type: "f", value: 100 },
+		"fogEnabled":   { type: "i", value: 0 },
+		"onlyAO":       { type: "i", value: 0 },
+		"aoClamp":      { type: "f", value: 0.3 },
+		"lumInfluence": { type: "f", value: 0.9 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform float cameraNear;",
+		"uniform float cameraFar;",
+
+		"uniform float fogNear;",
+		"uniform float fogFar;",
+
+		"uniform bool fogEnabled;",  // attenuate AO with linear fog
+		"uniform bool onlyAO;",      // use only ambient occlusion pass?
+
+		"uniform vec2 size;",        // texture width, height
+		"uniform float aoClamp;",    // depth clamp - reduces haloing at screen edges
+
+		"uniform float lumInfluence;",  // how much luminance affects occlusion
+
+		"uniform sampler2D tDiffuse;",
+		"uniform sampler2D tDepth;",
+
+		"varying vec2 vUv;",
+
+		// "#define PI 3.14159265",
+		"#define DL 2.399963229728653",  // PI * ( 3.0 - sqrt( 5.0 ) )
+		"#define EULER 2.718281828459045",
+
+		// helpers
+
+		"float width = size.x;",   // texture width
+		"float height = size.y;",  // texture height
+
+		"float cameraFarPlusNear = cameraFar + cameraNear;",
+		"float cameraFarMinusNear = cameraFar - cameraNear;",
+		"float cameraCoef = 2.0 * cameraNear;",
+
+		// user variables
+
+		"const int samples = 8;",     // ao sample count
+		"const float radius = 5.0;",  // ao radius
+
+		"const bool useNoise = false;",      // use noise instead of pattern for sample dithering
+		"const float noiseAmount = 0.0003;", // dithering amount
+
+		"const float diffArea = 0.4;",   // self-shadowing reduction
+		"const float gDisplace = 0.4;",  // gauss bell center
+
+		"const vec3 onlyAOColor = vec3( 1.0, 0.7, 0.5 );",
+		// "const vec3 onlyAOColor = vec3( 1.0, 1.0, 1.0 );",
+
+
+		// RGBA depth
+
+		"float unpackDepth( const in vec4 rgba_depth ) {",
+
+			"const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );",
+			"float depth = dot( rgba_depth, bit_shift );",
+			"return depth;",
+
+		"}",
+
+		// generating noise / pattern texture for dithering
+
+		"vec2 rand( const vec2 coord ) {",
+
+			"vec2 noise;",
+
+			"if ( useNoise ) {",
+
+				"float nx = dot ( coord, vec2( 12.9898, 78.233 ) );",
+				"float ny = dot ( coord, vec2( 12.9898, 78.233 ) * 2.0 );",
+
+				"noise = clamp( fract ( 43758.5453 * sin( vec2( nx, ny ) ) ), 0.0, 1.0 );",
+
+			"} else {",
+
+				"float ff = fract( 1.0 - coord.s * ( width / 2.0 ) );",
+				"float gg = fract( coord.t * ( height / 2.0 ) );",
+
+				"noise = vec2( 0.25, 0.75 ) * vec2( ff ) + vec2( 0.75, 0.25 ) * gg;",
+
+			"}",
+
+			"return ( noise * 2.0  - 1.0 ) * noiseAmount;",
+
+		"}",
+
+		"float doFog() {",
+
+			"float zdepth = unpackDepth( texture2D( tDepth, vUv ) );",
+			"float depth = -cameraFar * cameraNear / ( zdepth * cameraFarMinusNear - cameraFar );",
+
+			"return smoothstep( fogNear, fogFar, depth );",
+
+		"}",
+
+		"float readDepth( const in vec2 coord ) {",
+
+			// "return ( 2.0 * cameraNear ) / ( cameraFar + cameraNear - unpackDepth( texture2D( tDepth, coord ) ) * ( cameraFar - cameraNear ) );",
+			"return cameraCoef / ( cameraFarPlusNear - unpackDepth( texture2D( tDepth, coord ) ) * cameraFarMinusNear );",
+
+
+		"}",
+
+		"float compareDepths( const in float depth1, const in float depth2, inout int far ) {",
+
+			"float garea = 2.0;",                         // gauss bell width
+			"float diff = ( depth1 - depth2 ) * 100.0;",  // depth difference (0-100)
+
+			// reduce left bell width to avoid self-shadowing
+
+			"if ( diff < gDisplace ) {",
+
+				"garea = diffArea;",
+
+			"} else {",
+
+				"far = 1;",
+
+			"}",
+
+			"float dd = diff - gDisplace;",
+			"float gauss = pow( EULER, -2.0 * dd * dd / ( garea * garea ) );",
+			"return gauss;",
+
+		"}",
+
+		"float calcAO( float depth, float dw, float dh ) {",
+
+			"float dd = radius - depth * radius;",
+			"vec2 vv = vec2( dw, dh );",
+
+			"vec2 coord1 = vUv + dd * vv;",
+			"vec2 coord2 = vUv - dd * vv;",
+
+			"float temp1 = 0.0;",
+			"float temp2 = 0.0;",
+
+			"int far = 0;",
+			"temp1 = compareDepths( depth, readDepth( coord1 ), far );",
+
+			// DEPTH EXTRAPOLATION
+
+			"if ( far > 0 ) {",
+
+				"temp2 = compareDepths( readDepth( coord2 ), depth, far );",
+				"temp1 += ( 1.0 - temp1 ) * temp2;",
+
+			"}",
+
+			"return temp1;",
+
+		"}",
+
+		"void main() {",
+
+			"vec2 noise = rand( vUv );",
+			"float depth = readDepth( vUv );",
+
+			"float tt = clamp( depth, aoClamp, 1.0 );",
+
+			"float w = ( 1.0 / width )  / tt + ( noise.x * ( 1.0 - noise.x ) );",
+			"float h = ( 1.0 / height ) / tt + ( noise.y * ( 1.0 - noise.y ) );",
+
+			"float pw;",
+			"float ph;",
+
+			"float ao;",
+
+			"float dz = 1.0 / float( samples );",
+			"float z = 1.0 - dz / 2.0;",
+			"float l = 0.0;",
+
+			"for ( int i = 0; i <= samples; i ++ ) {",
+
+				"float r = sqrt( 1.0 - z );",
+
+				"pw = cos( l ) * r;",
+				"ph = sin( l ) * r;",
+				"ao += calcAO( depth, pw * w, ph * h );",
+				"z = z - dz;",
+				"l = l + DL;",
+
+			"}",
+
+			"ao /= float( samples );",
+			"ao = 1.0 - ao;",
+
+			"if ( fogEnabled ) {",
+
+				"ao = mix( ao, 1.0, doFog() );",
+
+			"}",
+
+			"vec3 color = texture2D( tDiffuse, vUv ).rgb;",
+
+			"vec3 lumcoeff = vec3( 0.299, 0.587, 0.114 );",
+			"float lum = dot( color.rgb, lumcoeff );",
+			"vec3 luminance = vec3( lum );",
+
+			"vec3 final = vec3( color * mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );",  // mix( color * ao, white, luminance )
+
+			"if ( onlyAO ) {",
+
+				"final = onlyAOColor * vec3( mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );",  // ambient occlusion only
+
+			"}",
+
+			"gl_FragColor = vec4( final, 1.0 );",
+
+		"}"
+
+	].join("\n")
+
+};

+ 54 - 0
examples/js/shaders/SepiaShader.js

@@ -0,0 +1,54 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Sepia tone shader
+ * based on glfx.js sepia shader
+ * https://github.com/evanw/glfx.js
+ */
+
+THREE.SepiaShader = {
+
+	uniforms: {
+
+		"tDiffuse": { type: "t", value: null },
+		"amount":   { type: "f", value: 1.0 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform float amount;",
+
+		"uniform sampler2D tDiffuse;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vec4 color = texture2D( tDiffuse, vUv );",
+			"vec3 c = color.rgb;",
+
+			"color.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );",
+			"color.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );",
+			"color.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );",
+
+			"gl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );",
+
+		"}"
+
+	].join("\n")
+
+};

+ 78 - 0
examples/js/shaders/TriangleBlurShader.js

@@ -0,0 +1,78 @@
+/**
+ * @author zz85 / http://www.lab4games.net/zz85/blog
+ *
+ * Triangle blur shader
+ * based on glfx.js triangle blur shader
+ * https://github.com/evanw/glfx.js
+ *
+ * A basic blur filter, which convolves the image with a
+ * pyramid filter. The pyramid filter is separable and is applied as two
+ * perpendicular triangle filters.
+ */
+
+THREE.TriangleBlurShader = {
+
+	uniforms : {
+
+		"texture": { type: "t", value: null },
+		"delta":   { type: "v2", value:new THREE.Vector2( 1, 1 )  }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"#define ITERATIONS 10.0",
+
+		"uniform sampler2D texture;",
+		"uniform vec2 delta;",
+
+		"varying vec2 vUv;",
+
+		"float random( vec3 scale, float seed ) {",
+
+			// use the fragment position for a different seed per-pixel
+
+			"return fract( sin( dot( gl_FragCoord.xyz + seed, scale ) ) * 43758.5453 + seed );",
+
+		"}",
+
+		"void main() {",
+
+			"vec4 color = vec4( 0.0 );",
+
+			"float total = 0.0;",
+
+			// randomize the lookup values to hide the fixed number of samples
+
+			"float offset = random( vec3( 12.9898, 78.233, 151.7182 ), 0.0 );",
+
+			"for ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {",
+
+				"float percent = ( t + offset - 0.5 ) / ITERATIONS;",
+				"float weight = 1.0 - abs( percent );",
+
+				"color += texture2D( texture, vUv + delta * percent ) * weight;",
+				"total += weight;",
+
+			"}",
+
+			"gl_FragColor = color / total;",
+
+		"}"
+
+	].join("\n")
+
+};

+ 57 - 0
examples/js/shaders/UnpackDepthRGBAShader.js

@@ -0,0 +1,57 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Unpack RGBA depth shader
+ * - show RGBA encoded depth as monochrome color
+ */
+
+THREE.UnpackDepthRGBAShader = {
+
+	uniforms: {
+
+		"tDiffuse": { type: "t", value: null },
+		"opacity":  { type: "f", value: 1.0 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform float opacity;",
+
+		"uniform sampler2D tDiffuse;",
+
+		"varying vec2 vUv;",
+
+		// RGBA depth
+
+		"float unpackDepth( const in vec4 rgba_depth ) {",
+
+			"const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );",
+			"float depth = dot( rgba_depth, bit_shift );",
+			"return depth;",
+
+		"}",
+
+		"void main() {",
+
+			"float depth = 1.0 - unpackDepth( texture2D( tDiffuse, vUv ) );",
+			"gl_FragColor = opacity * vec4( vec3( depth ), 1.0 );",
+
+		"}"
+
+	].join("\n")
+
+};

+ 62 - 0
examples/js/shaders/VerticalBlurShader.js

@@ -0,0 +1,62 @@
+/**
+ * @author zz85 / http://www.lab4games.net/zz85/blog
+ *
+ * Two pass Gaussian blur filter (horizontal and vertical blur shaders)
+ * - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/
+ *   and used in http://www.cake23.de/traveling-wavefronts-lit-up.html
+ *
+ * - 9 samples per pass
+ * - standard deviation 2.7
+ * - "h" and "v" parameters should be set to "1 / width" and "1 / height"
+ */
+
+THREE.VerticalBlurShader = {
+
+	uniforms: {
+
+		"tDiffuse": { type: "t", value: null },
+		"v":        { type: "f", value: 1.0 / 512.0 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform sampler2D tDiffuse;",
+		"uniform float v;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vec4 sum = vec4( 0.0 );",
+
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;",
+
+			"gl_FragColor = sum;",
+
+		"}"
+
+	].join("\n")
+
+};

+ 65 - 0
examples/js/shaders/VerticalTiltShiftShader.js

@@ -0,0 +1,65 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position
+ *
+ * - 9 samples per pass
+ * - standard deviation 2.7
+ * - "h" and "v" parameters should be set to "1 / width" and "1 / height"
+ * - "r" parameter control where "focused" horizontal line lies
+ */
+
+THREE.VerticalTiltShiftShader = {
+
+	uniforms: {
+
+		"tDiffuse": { type: "t", value: null },
+		"v":        { type: "f", value: 1.0 / 512.0 },
+		"r":        { type: "f", value: 0.35 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform sampler2D tDiffuse;",
+		"uniform float v;",
+		"uniform float r;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vec4 sum = vec4( 0.0 );",
+
+			"float vv = v * abs( r - vUv.y );",
+
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;",
+			"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;",
+
+			"gl_FragColor = sum;",
+
+		"}"
+
+	].join("\n")
+
+};

+ 63 - 0
examples/js/shaders/VignetteShader.js

@@ -0,0 +1,63 @@
+/**
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * Vignette shader
+ * based on PaintEffect postprocess from ro.me
+ * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js
+ */
+
+THREE.VignetteShader = {
+
+	uniforms: {
+
+		"tDiffuse": { type: "t", value: null },
+		"offset":   { type: "f", value: 1.0 },
+		"darkness": { type: "f", value: 1.0 }
+
+	},
+
+	vertexShader: [
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			"vUv = uv;",
+			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+
+		"}"
+
+	].join("\n"),
+
+	fragmentShader: [
+
+		"uniform float offset;",
+		"uniform float darkness;",
+
+		"uniform sampler2D tDiffuse;",
+
+		"varying vec2 vUv;",
+
+		"void main() {",
+
+			// Eskil's vignette
+
+			"vec4 texel = texture2D( tDiffuse, vUv );",
+			"vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );",
+			"gl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );",
+
+			/*
+			// alternative version from glfx.js
+			// this one makes more "dusty" look (as opposed to "burned")
+
+			"vec4 color = texture2D( tDiffuse, vUv );",
+			"float dist = distance( vUv, vec2( 0.5 ) );",
+			"color.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );",
+			"gl_FragColor = color;",
+			*/
+
+		"}"
+
+	].join("\n")
+
+};

+ 1 - 1
examples/misc_camera_fly.html

@@ -35,8 +35,8 @@
 
 		<script src="../build/three.min.js"></script>
 
+		<script src="js/shaders/BlitShader.js"></script>
 		<script src="js/shaders/FilmShader.js"></script>
-		<script src="js/ShaderExtras.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/ShaderPass.js"></script>

+ 4 - 2
examples/webgl_geometry_text.html

@@ -40,8 +40,10 @@
 
 		<script src="../build/three.min.js"></script>
 
+		<script src="js/shaders/BlitShader.js"></script>
+		<script src="js/shaders/ConvolutionShader.js"></script>
 		<script src="js/shaders/FilmShader.js"></script>
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/FXAAShader.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/RenderPass.js"></script>
@@ -338,7 +340,7 @@
 				var effectBloom = new THREE.BloomPass( 0.25 );
 				var effectFilm = new THREE.FilmPass( 0.5, 0.125, 2048, false );
 
-				effectFXAA = new THREE.ShaderPass( THREE.ShaderExtras[ "fxaa" ] );
+				effectFXAA = new THREE.ShaderPass( THREE.FXAAShader );
 
 				var width = window.innerWidth || 2;
 				var height = window.innerHeight || 2;

+ 7 - 5
examples/webgl_lines_colors.html

@@ -46,7 +46,9 @@
 
 		<script src="../build/three.min.js"></script>
 
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/BlitShader.js"></script>
+		<script src="js/shaders/ConvolutionShader.js"></script>
+		<script src="js/shaders/FXAAShader.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/MaskPass.js"></script>
@@ -158,23 +160,23 @@
 
 				var renderModel = new THREE.RenderPass( scene, camera );
 				var effectBloom = new THREE.BloomPass( 1.3 );
-				var effectScreen = new THREE.ShaderPass( THREE.ShaderExtras[ "screen" ] );
+				var effectBlit = new THREE.ShaderPass( THREE.BlitShader );
 
-				effectFXAA = new THREE.ShaderPass( THREE.ShaderExtras[ "fxaa" ] );
+				effectFXAA = new THREE.ShaderPass( THREE.FXAAShader );
 
 				var width = window.innerWidth || 2;
 				var height = window.innerHeight || 2;
 
 				effectFXAA.uniforms[ 'resolution' ].value.set( 1 / width, 1 / height );
 
-				effectScreen.renderToScreen = true;
+				effectBlit.renderToScreen = true;
 
 				composer = new THREE.EffectComposer( renderer );
 
 				composer.addPass( renderModel );
 				composer.addPass( effectFXAA );
 				composer.addPass( effectBloom );
-				composer.addPass( effectScreen );
+				composer.addPass( effectBlit );
 
 				//
 

+ 8 - 6
examples/webgl_marching_cubes.html

@@ -58,10 +58,12 @@
 
 	<script src="js/MarchingCubes.js"></script>
 
-	<script src="js/ShaderExtras.js"></script>
-	<script src="js/ShaderToon.js"></script>
+	<script src="js/shaders/BlitShader.js"></script>
+	<script src="js/shaders/FXAAShader.js"></script>
+	<script src="js/shaders/HorizontalTiltShiftShader.js"></script>
+	<script src="js/shaders/VerticalTiltShiftShader.js"></script>
 
-	<script src="js/ShaderExtras.js"></script>
+	<script src="js/ShaderToon.js"></script>
 
 	<script src="js/postprocessing/EffectComposer.js"></script>
 	<script src="js/postprocessing/RenderPass.js"></script>
@@ -187,10 +189,10 @@
 			renderTargetParameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat, stencilBuffer: false };
 			renderTarget = new THREE.WebGLRenderTarget( SCREEN_WIDTH, SCREEN_HEIGHT, renderTargetParameters );
 
-			effectFXAA = new THREE.ShaderPass( THREE.ShaderExtras[ "fxaa" ] );
+			effectFXAA = new THREE.ShaderPass( THREE.FXAAShader );
 
-			hblur = new THREE.ShaderPass( THREE.ShaderExtras[ "horizontalTiltShift" ] );
-			vblur = new THREE.ShaderPass( THREE.ShaderExtras[ "verticalTiltShift" ] );
+			hblur = new THREE.ShaderPass( THREE.HorizontalTiltShiftShader );
+			vblur = new THREE.ShaderPass( THREE.VerticalTiltShiftShader );
 
 			var bluriness = 8;
 

+ 4 - 4
examples/webgl_materials_bumpmap_skin.html

@@ -45,7 +45,7 @@
 
 		<script src="js/ShaderSkin.js"></script>
 
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/BlitShader.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/RenderPass.js"></script>
@@ -219,16 +219,16 @@
 				// BECKMANN
 
 				var effectBeckmann = new THREE.ShaderPass( THREE.ShaderSkin[ "beckmann" ] );
-				var effectScreen = new THREE.ShaderPass( THREE.ShaderExtras[ "screen" ] );
+				var effectBlit = new THREE.ShaderPass( THREE.BlitShader );
 
-				effectScreen.renderToScreen = true;
+				effectBlit.renderToScreen = true;
 
 				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat, stencilBufer: false };
 				var rtwidth = 512, rtheight = 512;
 
 				composerBeckmann = new THREE.EffectComposer( renderer, new THREE.WebGLRenderTarget( rtwidth, rtheight, pars ) );
 				composerBeckmann.addPass( effectBeckmann );
-				composerBeckmann.addPass( effectScreen );
+				composerBeckmann.addPass( effectBlit );
 
 				// EVENTS
 

+ 17 - 9
examples/webgl_materials_cubemap_dynamic.html

@@ -57,7 +57,15 @@
 		<script src="js/Detector.js"></script>
 		<script src="js/Stats.js"></script>
 
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/BleachBypassShader.js"></script>
+		<script src="js/shaders/BlendShader.js"></script>
+		<script src="js/shaders/BlitShader.js"></script>
+		<script src="js/shaders/ConvolutionShader.js"></script>
+		<script src="js/shaders/FXAAShader.js"></script>
+		<script src="js/shaders/HorizontalTiltShiftShader.js"></script>
+		<script src="js/shaders/VerticalTiltShiftShader.js"></script>
+		<script src="js/shaders/TriangleBlurShader.js"></script>
+		<script src="js/shaders/VignetteShader.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/RenderPass.js"></script>
@@ -403,19 +411,19 @@
 
 				effectSave = new THREE.SavePass( new THREE.WebGLRenderTarget( SCREEN_WIDTH, SCREEN_HEIGHT, renderTargetParameters ) );
 
-				effectBlend = new THREE.ShaderPass( THREE.ShaderExtras[ "blend" ], "tDiffuse1" );
+				effectBlend = new THREE.ShaderPass( THREE.BlendShader, "tDiffuse1" );
 
-				effectFXAA = new THREE.ShaderPass( THREE.ShaderExtras[ "fxaa" ] );
-				var effectVignette = new THREE.ShaderPass( THREE.ShaderExtras[ "vignette" ] );
-				var effectBleach = new THREE.ShaderPass( THREE.ShaderExtras[ "bleachbypass" ] );
+				effectFXAA = new THREE.ShaderPass( THREE.FXAAShader );
+				var effectVignette = new THREE.ShaderPass( THREE.VignetteShader );
+				var effectBleach = new THREE.ShaderPass( THREE.BleachBypassShader );
 				effectBloom = new THREE.BloomPass( 0.75 );
 
 				effectFXAA.uniforms[ 'resolution' ].value.set( 1 / SCREEN_WIDTH, 1 / SCREEN_HEIGHT );
 
 				// tilt shift
 
-				hblur = new THREE.ShaderPass( THREE.ShaderExtras[ "horizontalTiltShift" ] );
-				vblur = new THREE.ShaderPass( THREE.ShaderExtras[ "verticalTiltShift" ] );
+				hblur = new THREE.ShaderPass( THREE.HorizontalTiltShiftShader );
+				vblur = new THREE.ShaderPass( THREE.VerticalTiltShiftShader );
 
 				var bluriness = 7;
 
@@ -611,7 +619,7 @@
 
 				var renderShadow = new THREE.RenderPass( shadowScene, topCamera );
 
-				var blurShader = THREE.ShaderExtras[ "triangleBlur" ];
+				var blurShader = THREE.TriangleBlurShader;
 				var effectBlurX = new THREE.ShaderPass( blurShader, 'texture' );
 				var effectBlurY = new THREE.ShaderPass( blurShader, 'texture' );
 
@@ -931,7 +939,7 @@
 
 				}
 
-				effectBloom.screenUniforms[ "opacity" ].value = THREE.Math.mapLinear( vnorm, 0, 1, 1, 0.75 );
+				effectBloom.blitUniforms[ "opacity" ].value = THREE.Math.mapLinear( vnorm, 0, 1, 1, 0.75 );
 
 				ambientLight.color.setHSV( 0, 0, THREE.Math.mapLinear( vnorm, 0, 1, 0.07, 0.33 ) );
 				groundBasic.color.setHSV( 0.1, 0.45, THREE.Math.mapLinear( vnorm, 0, 1, 0.725, 0.995 ) );

+ 10 - 5
examples/webgl_materials_normalmap2.html

@@ -14,7 +14,9 @@
 				overflow:hidden;
 			}
 
-			a {	color: #ffffff;	}
+			a {
+				color: #ffffff;
+			}
 
 			#info {
 				position: absolute;
@@ -55,7 +57,10 @@
 		<script src="js/Detector.js"></script>
 		<script src="js/Stats.js"></script>
 
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/BlitShader.js"></script>
+		<script src="js/shaders/BleachBypassShader.js"></script>
+		<script src="js/shaders/ColorCorrectionShader.js"></script>
+		<script src="js/shaders/FXAAShader.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/RenderPass.js"></script>
@@ -176,9 +181,9 @@
 
 				var renderModel = new THREE.RenderPass( scene, camera );
 
-				var effectBleach = new THREE.ShaderPass( THREE.ShaderExtras[ "bleachbypass" ] );
-				var effectColor = new THREE.ShaderPass( THREE.ShaderExtras[ "colorCorrection" ] );
-				effectFXAA = new THREE.ShaderPass( THREE.ShaderExtras[ "fxaa" ] );
+				var effectBleach = new THREE.ShaderPass( THREE.BleachBypassShader );
+				var effectColor = new THREE.ShaderPass( THREE.ColorCorrectionShader );
+				effectFXAA = new THREE.ShaderPass( THREE.FXAAShader );
 
 				effectFXAA.uniforms[ 'resolution' ].value.set( 1 / window.innerWidth, 1 / window.innerHeight );
 

+ 7 - 4
examples/webgl_materials_skin.html

@@ -44,9 +44,12 @@
 
 		<script src="../build/three.min.js"></script>
 
-		<script src="js/ShaderExtras.js"></script>
 		<script src="js/ShaderSkin.js"></script>
 
+		<script src="js/shaders/BlitShader.js"></script>
+		<script src="js/shaders/BleachBypassShader.js"></script>
+		<script src="js/shaders/ConvolutionShader.js"></script>
+
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/RenderPass.js"></script>
 		<script src="js/postprocessing/BloomPass.js"></script>
@@ -179,7 +182,7 @@
 
 				THREE.ColorUtils.adjustHSV( renderModelUV.clearColor, 0, -0.5, -0.45 );
 
-				var effectScreen = new THREE.ShaderPass( THREE.ShaderExtras[ "screen" ] );
+				var effectBlit = new THREE.ShaderPass( THREE.BlitShader );
 
 				var effectBloom1 = new THREE.BloomPass( 1, 15, 2, 512 );
 				var effectBloom2 = new THREE.BloomPass( 1, 25, 4, 512 );
@@ -189,7 +192,7 @@
 				effectBloom2.clear = true;
 				effectBloom3.clear = true;
 
-				effectScreen.renderToScreen = true;
+				effectBlit.renderToScreen = true;
 
 				//
 
@@ -233,7 +236,7 @@
 
 				var effectBloom = new THREE.BloomPass( 0.25 );
 
-				var effectBleach = new THREE.ShaderPass( THREE.ShaderExtras[ "bleachbypass" ] );
+				var effectBleach = new THREE.ShaderPass( THREE.BleachBypassShader );
 				effectBleach.uniforms.opacity.value = 0.25;
 
 				effectBleach.renderToScreen = true;

+ 5 - 4
examples/webgl_materials_video.html

@@ -39,7 +39,8 @@
 
 		<script src="../build/three.min.js"></script>
 
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/BlitShader.js"></script>
+		<script src="js/shaders/ConvolutionShader.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/RenderPass.js"></script>
@@ -174,15 +175,15 @@
 
 				var renderModel = new THREE.RenderPass( scene, camera );
 				var effectBloom = new THREE.BloomPass( 1.3 );
-				var effectScreen = new THREE.ShaderPass( THREE.ShaderExtras[ "screen" ] );
+				var effectBlit = new THREE.ShaderPass( THREE.BlitShader );
 
-				effectScreen.renderToScreen = true;
+				effectBlit.renderToScreen = true;
 
 				composer = new THREE.EffectComposer( renderer );
 
 				composer.addPass( renderModel );
 				composer.addPass( effectBloom );
-				composer.addPass( effectScreen );
+				composer.addPass( effectBlit );
 
 				//
 

+ 4 - 2
examples/webgl_particles_dynamic.html

@@ -42,8 +42,10 @@
 
 		<script src="../build/three.min.js"></script>
 
+		<script src="js/shaders/BlitShader.js"></script>
+		<script src="js/shaders/ConvolutionShader.js"></script>
 		<script src="js/shaders/FilmShader.js"></script>
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/FocusShader.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/MaskPass.js"></script>
@@ -162,7 +164,7 @@
 				var effectBloom = new THREE.BloomPass( 0.75 );
 				var effectFilm = new THREE.FilmPass( 0.5, 0.5, 1448, false );
 
-				effectFocus = new THREE.ShaderPass( THREE.ShaderExtras[ "focus" ] );
+				effectFocus = new THREE.ShaderPass( THREE.FocusShader );
 
 				effectFocus.uniforms[ "screenWidth" ].value = window.innerWidth;
 				effectFocus.uniforms[ "screenHeight" ].value = window.innerHeight;

+ 12 - 8
examples/webgl_particles_shapes.html

@@ -23,8 +23,12 @@
 		<script src="js/Tween.js"></script>
 		<script src="js/Sparks.js"></script>
 
+		<script src="js/shaders/BlitShader.js"></script>
 		<script src="js/shaders/FilmShader.js"></script>
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/FocusShader.js"></script>
+		<script src="js/shaders/HorizontalBlurShader.js"></script>
+		<script src="js/shaders/TriangleBlurShader.js"></script>
+		<script src="js/shaders/VerticalBlurShader.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/RenderPass.js"></script>
@@ -509,12 +513,12 @@
 
 				// POST PROCESSING
 
-				var effectFocus = new THREE.ShaderPass( THREE.ShaderExtras[ "focus" ] );
+				var effectFocus = new THREE.ShaderPass( THREE.FocusShader );
 
-				var effectScreen = new THREE.ShaderPass( THREE.ShaderExtras[ "screen" ] );
+				var effectBlit = new THREE.ShaderPass( THREE.BlitShader );
 				effectFilm = new THREE.FilmPass( 0.5, 0.25, 2048, false );
 
-				var shaderBlur = THREE.ShaderExtras[ "triangleBlur" ];
+				var shaderBlur = THREE.TriangleBlurShader;
 				effectBlurX = new THREE.ShaderPass( shaderBlur, 'texture' );
 				effectBlurY = new THREE.ShaderPass( shaderBlur, 'texture' );
 
@@ -522,8 +526,8 @@
 				var blurAmountX = radius / window.innerWidth;
 				var blurAmountY = radius / window.innerHeight;
 
-				hblur = new THREE.ShaderPass( THREE.ShaderExtras[ "horizontalBlur" ] );
-				vblur = new THREE.ShaderPass( THREE.ShaderExtras[ "verticalBlur" ] );
+				hblur = new THREE.ShaderPass( THREE.HorizontalBlurShader );
+				vblur = new THREE.ShaderPass( THREE.VerticalBlurShader);
 
 				hblur.uniforms[ 'h' ].value =  1 / window.innerWidth;
 				vblur.uniforms[ 'v' ].value =  1 / window.innerHeight;
@@ -542,14 +546,14 @@
 				composer.addPass( vblur );
 				//composer.addPass( effectBlurX );
 				//composer.addPass( effectBlurY );
-				//composer.addPass( effectScreen );
+				//composer.addPass( effectBlit );
 				//composer.addPass( effectFocus );
 				//composer.addPass( effectFilm );
 
 				vblur.renderToScreen = true;
 				effectBlurY.renderToScreen = true;
 				effectFocus.renderToScreen = true;
-				effectScreen.renderToScreen = true;
+				effectBlit.renderToScreen = true;
 				effectFilm.renderToScreen = true;
 
 				document.addEventListener( 'mousedown', onDocumentMouseDown, false );

+ 21 - 13
examples/webgl_postprocessing.html

@@ -42,8 +42,16 @@
 
 		<script src="../build/three.min.js"></script>
 
+		<script src="js/shaders/BleachBypassShader.js"></script>
+		<script src="js/shaders/BlitShader.js"></script>
+		<script src="js/shaders/ColorifyShader.js"></script>
+		<script src="js/shaders/ConvolutionShader.js"></script>
+		<script src="js/shaders/DotScreenShader.js"></script>
 		<script src="js/shaders/FilmShader.js"></script>
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/HorizontalBlurShader.js"></script>
+		<script src="js/shaders/SepiaShader.js"></script>
+		<script src="js/shaders/VerticalBlurShader.js"></script>
+		<script src="js/shaders/VignetteShader.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/RenderPass.js"></script>
@@ -152,15 +160,15 @@
 
 				//
 
-				var shaderBleach = THREE.ShaderExtras[ "bleachbypass" ];
-				var shaderSepia = THREE.ShaderExtras[ "sepia" ];
-				var shaderVignette = THREE.ShaderExtras[ "vignette" ];
-				var shaderScreen = THREE.ShaderExtras[ "screen" ];
+				var shaderBleach = THREE.BleachBypassShader;
+				var shaderSepia = THREE.SepiaShader;
+				var shaderVignette = THREE.VignetteShader;
+				var shaderBlit = THREE.BlitShader;
 
 				var effectBleach = new THREE.ShaderPass( shaderBleach );
 				var effectSepia = new THREE.ShaderPass( shaderSepia );
 				var effectVignette = new THREE.ShaderPass( shaderVignette );
-				var effectScreen = new THREE.ShaderPass( shaderScreen );
+				var effectBlit = new THREE.ShaderPass( shaderBlit );
 
 				effectBleach.uniforms[ "opacity" ].value = 0.95;
 
@@ -174,13 +182,13 @@
 				var effectFilmBW = new THREE.FilmPass( 0.35, 0.5, 2048, true );
 				var effectDotScreen = new THREE.DotScreenPass( new THREE.Vector2( 0, 0 ), 0.5, 0.8 );
 
-				var effectHBlur = new THREE.ShaderPass( THREE.ShaderExtras[ "horizontalBlur" ] );
-				var effectVBlur = new THREE.ShaderPass( THREE.ShaderExtras[ "verticalBlur" ] );
-				effectHBlur.uniforms[ 'h' ].value = 2 / ( width/2 );
-				effectVBlur.uniforms[ 'v' ].value = 2 / ( height/2 );
+				var effectHBlur = new THREE.ShaderPass( THREE.HorizontalBlurShader );
+				var effectVBlur = new THREE.ShaderPass( THREE.VerticalBlurShader );
+				effectHBlur.uniforms[ 'h' ].value = 2 / ( width / 2 );
+				effectVBlur.uniforms[ 'v' ].value = 2 / ( height / 2 );
 
-				var effectColorify1 = new THREE.ShaderPass( THREE.ShaderExtras[ "colorify" ] );
-				var effectColorify2 = new THREE.ShaderPass( THREE.ShaderExtras[ "colorify" ] );
+				var effectColorify1 = new THREE.ShaderPass( THREE.ColorifyShader );
+				var effectColorify2 = new THREE.ShaderPass( THREE.ColorifyShader );
 				effectColorify1.uniforms[ 'color' ].value.setRGB( 1, 0.8, 0.8 );
 				effectColorify2.uniforms[ 'color' ].value.setRGB( 1, 0.75, 0.5 );
 
@@ -195,7 +203,7 @@
 				//effectDotScreen.renderToScreen = true;
 				//effectBleach.renderToScreen = true;
 				effectVignette.renderToScreen = true;
-				//effectScreen.renderToScreen = true;
+				//effectBlit.renderToScreen = true;
 
 				//
 

+ 3 - 2
examples/webgl_postprocessing_dof.html

@@ -33,8 +33,9 @@
 	<body>
 		<script src="../build/three.min.js"></script>
 
+		<script src="js/shaders/BokehShader.js"></script>
+
 		<script src="js/Detector.js"></script>
-		<script src="js/ShaderExtras.js"></script>
 		<script src="js/Stats.js"></script>
 
 		<script src='js/DAT.GUI.min.js'></script>
@@ -243,7 +244,7 @@
 				postprocessing.rtTextureDepth = new THREE.WebGLRenderTarget( window.innerWidth, height, pars );
 				postprocessing.rtTextureColor = new THREE.WebGLRenderTarget( window.innerWidth, height, pars );
 
-				var bokeh_shader = THREE.ShaderExtras[ "bokeh" ];
+				var bokeh_shader = THREE.BokehShader;
 
 				postprocessing.bokeh_uniforms = THREE.UniformsUtils.clone( bokeh_shader.uniforms );
 

+ 5 - 4
examples/webgl_ribbons.html

@@ -34,7 +34,8 @@
 
 		<script src="../build/three.min.js"></script>
 
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/BlitShader.js"></script>
+		<script src="js/shaders/ConvolutionShader.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/MaskPass.js"></script>
@@ -197,15 +198,15 @@
 
 				var renderModel = new THREE.RenderPass( scene, camera );
 				var effectBloom = new THREE.BloomPass( 1.0 );
-				var effectScreen = new THREE.ShaderPass( THREE.ShaderExtras[ "screen" ] );
+				var effectBlit = new THREE.ShaderPass( THREE.BlitShader );
 
-				effectScreen.renderToScreen = true;
+				effectBlit.renderToScreen = true;
 
 				composer = new THREE.EffectComposer( renderer );
 
 				composer.addPass( renderModel );
 				composer.addPass( effectBloom );
-				composer.addPass( effectScreen );
+				composer.addPass( effectBlit );
 
 				//
 

+ 6 - 4
examples/webgl_sandbox.html

@@ -36,7 +36,8 @@
 
 		<script src="../build/three.min.js"></script>
 
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/BasicShader.js"></script>
+
 		<script src="js/Stats.js"></script>
 
 		<script>
@@ -71,9 +72,10 @@
 				var light = new THREE.PointLight( 0xffffff );
 				scene.add( light );
 
-				var uniforms = THREE.ShaderExtras[ 'basic' ].uniforms;
-				var vertexShader = THREE.ShaderExtras[ 'basic' ].vertexShader;
-				var fragmentShader = THREE.ShaderExtras[ 'basic' ].fragmentShader;
+				var shader = THREE.BasicShader;
+				var uniforms = shader.uniforms;
+				var vertexShader = shader.vertexShader;
+				var fragmentShader = shader.fragmentShader;
 
 				var texture1 = new THREE.Texture( generateTexture( 0, 0.5, 1 ), new THREE.UVMapping() );
 				var texture2 = new THREE.Texture( generateTexture( 0, 1, 0 ), new THREE.SphericalReflectionMapping() );

+ 2 - 1
examples/webgl_shader_lava.html

@@ -38,8 +38,9 @@
 
 		<script src="../build/three.min.js"></script>
 
+		<script src="js/shaders/BlitShader.js"></script>
+		<script src="js/shaders/ConvolutionShader.js"></script>
 		<script src="js/shaders/FilmShader.js"></script>
-		<script src="js/ShaderExtras.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/ShaderPass.js"></script>

+ 9 - 5
examples/webgl_shading_physical.html

@@ -38,7 +38,11 @@
 
 		<script src="../build/three.min.js"></script>
 
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/BlitShader.js"></script>
+		<script src="js/shaders/FXAAShader.js"></script>
+		<script src="js/shaders/HorizontalTiltShiftShader.js"></script>
+		<script src="js/shaders/VerticalTiltShiftShader.js"></script>
+		<script src="js/shaders/VignetteShader.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/RenderPass.js"></script>
@@ -397,11 +401,11 @@
 				renderTargetParameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat, stencilBuffer: false };
 				renderTarget = new THREE.WebGLRenderTarget( SCREEN_WIDTH, SCREEN_HEIGHT, renderTargetParameters );
 
-				effectFXAA = new THREE.ShaderPass( THREE.ShaderExtras[ "fxaa" ] );
-				var effectVignette = new THREE.ShaderPass( THREE.ShaderExtras[ "vignette" ] );
+				effectFXAA = new THREE.ShaderPass( THREE.FXAAShader );
+				var effectVignette = new THREE.ShaderPass( THREE.VignetteShader );
 
-				hblur = new THREE.ShaderPass( THREE.ShaderExtras[ "horizontalTiltShift" ] );
-				vblur = new THREE.ShaderPass( THREE.ShaderExtras[ "verticalTiltShift" ] );
+				hblur = new THREE.ShaderPass( THREE.HorizontalTiltShiftShader );
+				vblur = new THREE.ShaderPass( THREE.VerticalTiltShiftShader );
 
 				var bluriness = 4;
 

+ 2 - 2
examples/webgl_shadowmap.html

@@ -33,7 +33,7 @@
 
 		<script src="../build/three.min.js"></script>
 
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/UnpackDepthRGBAShader.js"></script>
 
 		<script src="js/Detector.js"></script>
 		<script src="js/Stats.js"></script>
@@ -174,7 +174,7 @@
 				cameraOrtho = new THREE.OrthographicCamera( SCREEN_WIDTH / - 2, SCREEN_WIDTH / 2,  SCREEN_HEIGHT / 2, SCREEN_HEIGHT / - 2, -10, 1000 );
 				cameraOrtho.position.z = 10;
 
-				var shader = THREE.ShaderExtras[ "unpackDepthRGBA" ];
+				var shader = THREE.UnpackDepthRGBAShader;
 				var uniforms = new THREE.UniformsUtils.clone( shader.uniforms );
 
 				hudMaterial = new THREE.ShaderMaterial( { vertexShader: shader.vertexShader, fragmentShader: shader.fragmentShader, uniforms: uniforms } );

+ 2 - 2
examples/webgl_shadowmap_performance.html

@@ -33,7 +33,7 @@
 
 		<script src="../build/three.min.js"></script>
 
-		<script src="js/ShaderExtras.js"></script>
+		<script src="js/shaders/UnpackDepthRGBAShader.js"></script>
 
 		<script src="js/Detector.js"></script>
 		<script src="js/Stats.js"></script>
@@ -174,7 +174,7 @@
 				cameraOrtho = new THREE.OrthographicCamera( SCREEN_WIDTH / - 2, SCREEN_WIDTH / 2,  SCREEN_HEIGHT / 2, SCREEN_HEIGHT / - 2, -10, 1000 );
 				cameraOrtho.position.z = 10;
 
-				var shader = THREE.ShaderExtras[ "unpackDepthRGBA" ];
+				var shader = THREE.UnpackDepthRGBAShader;
 				var uniforms = new THREE.UniformsUtils.clone( shader.uniforms );
 
 				hudMaterial = new THREE.ShaderMaterial( { vertexShader: shader.vertexShader, fragmentShader: shader.fragmentShader, uniforms: uniforms } );

+ 13 - 6
examples/webgl_terrain_dynamic.html

@@ -68,7 +68,14 @@
 		<script src="js/Stats.js"></script>
 
 		<script src="js/ShaderTerrain.js"></script>
-		<script src="js/ShaderExtras.js"></script>
+
+		<script src="js/shaders/BleachBypassShader.js"></script>
+		<script src="js/shaders/BlitShader.js"></script>
+		<script src="js/shaders/ConvolutionShader.js"></script>
+		<script src="js/shaders/HorizontalTiltShiftShader.js"></script>
+		<script src="js/shaders/LuminosityShader.js"></script>
+		<script src="js/shaders/NormalMapShader.js"></script>
+		<script src="js/shaders/VerticalTiltShiftShader.js"></script>
 
 		<script src="js/postprocessing/EffectComposer.js"></script>
 		<script src="js/postprocessing/RenderPass.js"></script>
@@ -319,7 +326,7 @@
 
 				// HEIGHT + NORMAL MAPS
 
-				var normalShader = THREE.ShaderExtras[ 'normalmap' ];
+				var normalShader = THREE.NormalMapShader;
 
 				var rx = 256, ry = 256;
 				var pars = { minFilter: THREE.LinearMipmapLinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat };
@@ -350,7 +357,7 @@
 				var diffuseTexture1 = THREE.ImageUtils.loadTexture( "textures/terrain/grasslight-big.jpg", null, function () {
 
 					loadTextures();
-					applyShader( THREE.ShaderExtras[ 'luminosity' ], diffuseTexture1, specularMap );
+					applyShader( THREE.LuminosityShader, diffuseTexture1, specularMap );
 
 				} );
 
@@ -479,10 +486,10 @@
 				renderTarget = new THREE.WebGLRenderTarget( SCREEN_WIDTH, SCREEN_HEIGHT, renderTargetParameters );
 
 				effectBloom = new THREE.BloomPass( 0.6 );
-				var effectBleach = new THREE.ShaderPass( THREE.ShaderExtras[ "bleachbypass" ] );
+				var effectBleach = new THREE.ShaderPass( THREE.BleachBypassShader );
 
-				hblur = new THREE.ShaderPass( THREE.ShaderExtras[ "horizontalTiltShift" ] );
-				vblur = new THREE.ShaderPass( THREE.ShaderExtras[ "verticalTiltShift" ] );
+				hblur = new THREE.ShaderPass( THREE.HorizontalTiltShiftShader );
+				vblur = new THREE.ShaderPass( THREE.VerticalTiltShiftShader );
 
 				var bluriness = 6;