Browse Source

Refactored KERNEL_SIZE define out of convolution shader lib.

This is ugly, but allows to use different kernel sizes, making it useful not just for Gaussian blur (which is slow with large kernel).
alteredq 15 years ago
parent
commit
bc88bdb67b
3 changed files with 4 additions and 4 deletions
  1. 0 0
      build/ThreeExtras.js
  2. 2 2
      examples/postprocessing.html
  3. 2 2
      src/extras/ShaderUtils.js

File diff suppressed because it is too large
+ 0 - 0
build/ThreeExtras.js


+ 2 - 2
examples/postprocessing.html

@@ -187,8 +187,8 @@
                 materialConvolution = new THREE.MeshShaderMaterial( {
                 materialConvolution = new THREE.MeshShaderMaterial( {
 
 
                     uniforms: convolution_uniforms,
                     uniforms: convolution_uniforms,
-                    vertex_shader: convolution_shader.vertex_shader,
-                    fragment_shader: convolution_shader.fragment_shader
+                    vertex_shader:   "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertex_shader,
+                    fragment_shader: "#define KERNEL_SIZE 25\n"   + convolution_shader.fragment_shader
 
 
                 } );
                 } );
 
 

+ 2 - 2
src/extras/ShaderUtils.js

@@ -341,7 +341,7 @@ var ShaderUtils = {
 		"varying vec2 vUv;",
 		"varying vec2 vUv;",
 		
 		
 		"uniform vec2 uImageIncrement;",
 		"uniform vec2 uImageIncrement;",
-		"#define KERNEL_SIZE 25.0",
+		//"#define KERNEL_SIZE 25.0",
 		
 		
 		"void main(void) {",
 		"void main(void) {",
 		
 		
@@ -359,7 +359,7 @@ var ShaderUtils = {
 		"uniform sampler2D tDiffuse;",
 		"uniform sampler2D tDiffuse;",
 		"uniform vec2 uImageIncrement;",
 		"uniform vec2 uImageIncrement;",
 		
 		
-		"#define KERNEL_SIZE 25",
+		//"#define KERNEL_SIZE 25",
 		"uniform float cKernel[KERNEL_SIZE];",
 		"uniform float cKernel[KERNEL_SIZE];",
 		
 		
 		"void main(void) {",
 		"void main(void) {",

Some files were not shown because too many files changed in this diff