three-stdlib 2.8.10 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.cjs.js +1 -1
- package/index.d.ts +2 -52
- package/index.js +53 -52
- package/lines/LineMaterial.d.ts +7 -6
- package/modifiers/CurveModifier.cjs.js +1 -1
- package/modifiers/CurveModifier.d.ts +13 -9
- package/modifiers/CurveModifier.js +27 -30
- package/objects/Lensflare.cjs.js +1 -1
- package/objects/Lensflare.js +11 -3
- package/package.json +3 -3
- package/postprocessing/AfterimagePass.d.ts +2 -30
- package/postprocessing/RenderPixelatedPass.cjs.js +1 -0
- package/postprocessing/RenderPixelatedPass.js +213 -0
- package/shaders/ACESFilmicToneMappingShader.cjs.js +1 -1
- package/shaders/ACESFilmicToneMappingShader.d.ts +9 -0
- package/shaders/ACESFilmicToneMappingShader.js +1 -1
- package/shaders/AfterimageShader.d.ts +9 -15
- package/shaders/BasicShader.cjs.js +1 -1
- package/shaders/BasicShader.d.ts +5 -5
- package/shaders/BasicShader.js +1 -1
- package/shaders/BleachBypassShader.cjs.js +1 -1
- package/shaders/BleachBypassShader.d.ts +8 -9
- package/shaders/BleachBypassShader.js +1 -1
- package/shaders/BlendShader.cjs.js +1 -1
- package/shaders/BlendShader.d.ts +13 -7
- package/shaders/BlendShader.js +1 -1
- package/shaders/BokehShader.cjs.js +1 -1
- package/shaders/BokehShader.d.ts +18 -19
- package/shaders/BokehShader.js +1 -1
- package/shaders/BokehShader2.cjs.js +1 -1
- package/shaders/BokehShader2.d.ts +80 -34
- package/shaders/BokehShader2.js +2 -2
- package/shaders/BrightnessContrastShader.cjs.js +1 -1
- package/shaders/BrightnessContrastShader.d.ts +10 -6
- package/shaders/BrightnessContrastShader.js +1 -1
- package/shaders/ColorCorrectionShader.cjs.js +1 -1
- package/shaders/ColorCorrectionShader.d.ts +14 -7
- package/shaders/ColorCorrectionShader.js +1 -1
- package/shaders/ColorifyShader.cjs.js +1 -1
- package/shaders/ColorifyShader.d.ts +8 -5
- package/shaders/ColorifyShader.js +1 -1
- package/shaders/ConvolutionShader.cjs.js +1 -1
- package/shaders/ConvolutionShader.d.ts +15 -16
- package/shaders/ConvolutionShader.js +9 -14
- package/shaders/CopyShader.d.ts +8 -12
- package/shaders/DOFMipMapShader.cjs.js +1 -1
- package/shaders/DOFMipMapShader.d.ts +13 -7
- package/shaders/DOFMipMapShader.js +1 -1
- package/shaders/DepthLimitedBlurShader.cjs.js +1 -1
- package/shaders/DepthLimitedBlurShader.d.ts +26 -25
- package/shaders/DepthLimitedBlurShader.js +12 -16
- package/shaders/DigitalGlitch.cjs.js +1 -1
- package/shaders/DigitalGlitch.d.ts +34 -14
- package/shaders/DigitalGlitch.js +1 -10
- package/shaders/DotScreenShader.cjs.js +1 -1
- package/shaders/DotScreenShader.d.ts +17 -8
- package/shaders/DotScreenShader.js +1 -1
- package/shaders/FXAAShader.cjs.js +1 -1
- package/shaders/FXAAShader.d.ts +8 -5
- package/shaders/FXAAShader.js +1 -1
- package/shaders/FilmShader.cjs.js +1 -1
- package/shaders/FilmShader.d.ts +19 -9
- package/shaders/FilmShader.js +1 -1
- package/shaders/FocusShader.cjs.js +1 -1
- package/shaders/FocusShader.d.ts +16 -8
- package/shaders/FocusShader.js +1 -1
- package/shaders/FreiChenShader.cjs.js +1 -1
- package/shaders/FreiChenShader.d.ts +8 -5
- package/shaders/FreiChenShader.js +1 -1
- package/shaders/FresnelShader.cjs.js +1 -1
- package/shaders/FresnelShader.d.ts +21 -0
- package/shaders/FresnelShader.js +1 -1
- package/shaders/GammaCorrectionShader.d.ts +7 -7
- package/shaders/GodRaysShader.cjs.js +1 -1
- package/shaders/GodRaysShader.d.ts +38 -20
- package/shaders/GodRaysShader.js +4 -4
- package/shaders/HalftoneShader.cjs.js +1 -1
- package/shaders/HalftoneShader.d.ts +40 -16
- package/shaders/HalftoneShader.js +1 -1
- package/shaders/HorizontalBlurShader.d.ts +8 -8
- package/shaders/HorizontalTiltShiftShader.cjs.js +1 -1
- package/shaders/HorizontalTiltShiftShader.d.ts +10 -6
- package/shaders/HorizontalTiltShiftShader.js +1 -1
- package/shaders/HueSaturationShader.cjs.js +1 -1
- package/shaders/HueSaturationShader.d.ts +10 -6
- package/shaders/HueSaturationShader.js +1 -1
- package/shaders/KaleidoShader.cjs.js +1 -1
- package/shaders/KaleidoShader.d.ts +10 -6
- package/shaders/KaleidoShader.js +1 -1
- package/shaders/LuminosityHighPassShader.cjs.js +1 -1
- package/shaders/LuminosityHighPassShader.d.ts +17 -8
- package/shaders/LuminosityHighPassShader.js +1 -1
- package/shaders/LuminosityShader.cjs.js +1 -1
- package/shaders/LuminosityShader.d.ts +4 -4
- package/shaders/LuminosityShader.js +1 -1
- package/shaders/MirrorShader.cjs.js +1 -1
- package/shaders/MirrorShader.d.ts +7 -5
- package/shaders/MirrorShader.js +1 -1
- package/shaders/NormalMapShader.cjs.js +1 -1
- package/shaders/NormalMapShader.d.ts +14 -7
- package/shaders/NormalMapShader.js +1 -1
- package/shaders/ParallaxShader.cjs.js +1 -1
- package/shaders/ParallaxShader.d.ts +28 -0
- package/shaders/ParallaxShader.js +1 -1
- package/shaders/PixelShader.cjs.js +1 -1
- package/shaders/PixelShader.d.ts +10 -6
- package/shaders/PixelShader.js +1 -1
- package/shaders/RGBShiftShader.cjs.js +1 -1
- package/shaders/RGBShiftShader.d.ts +10 -6
- package/shaders/RGBShiftShader.js +1 -1
- package/shaders/SAOShader.cjs.js +1 -1
- package/shaders/SAOShader.d.ts +24 -29
- package/shaders/SAOShader.js +1 -5
- package/shaders/SMAAShader.cjs.js +1 -1
- package/shaders/SMAAShader.d.ts +31 -16
- package/shaders/SMAAShader.js +3 -3
- package/shaders/SSAOShader.cjs.js +1 -1
- package/shaders/SSAOShader.d.ts +58 -25
- package/shaders/SSAOShader.js +3 -3
- package/shaders/SSRShader.cjs.js +1 -1
- package/shaders/SSRShader.d.ts +67 -36
- package/shaders/SSRShader.js +3 -3
- package/shaders/SepiaShader.cjs.js +1 -1
- package/shaders/SepiaShader.d.ts +7 -5
- package/shaders/SepiaShader.js +1 -1
- package/shaders/SobelOperatorShader.cjs.js +1 -1
- package/shaders/SobelOperatorShader.d.ts +8 -5
- package/shaders/SobelOperatorShader.js +1 -1
- package/shaders/SubsurfaceScatteringShader.cjs.js +1 -1
- package/shaders/SubsurfaceScatteringShader.d.ts +2 -34
- package/shaders/SubsurfaceScatteringShader.js +3 -3
- package/shaders/TechnicolorShader.cjs.js +1 -1
- package/shaders/TechnicolorShader.d.ts +4 -4
- package/shaders/TechnicolorShader.js +1 -1
- package/shaders/ToneMapShader.cjs.js +1 -1
- package/shaders/ToneMapShader.d.ts +19 -9
- package/shaders/ToneMapShader.js +1 -1
- package/shaders/ToonShader.cjs.js +1 -1
- package/shaders/ToonShader.d.ts +80 -34
- package/shaders/ToonShader.js +4 -4
- package/shaders/TriangleBlurShader.cjs.js +1 -1
- package/shaders/TriangleBlurShader.d.ts +8 -5
- package/shaders/TriangleBlurShader.js +1 -1
- package/shaders/UnpackDepthRGBAShader.cjs.js +1 -1
- package/shaders/UnpackDepthRGBAShader.d.ts +7 -5
- package/shaders/UnpackDepthRGBAShader.js +1 -1
- package/shaders/VerticalBlurShader.cjs.js +1 -1
- package/shaders/VerticalBlurShader.d.ts +8 -8
- package/shaders/VerticalBlurShader.js +1 -1
- package/shaders/VerticalTiltShiftShader.cjs.js +1 -1
- package/shaders/VerticalTiltShiftShader.d.ts +10 -6
- package/shaders/VerticalTiltShiftShader.js +1 -1
- package/shaders/VignetteShader.cjs.js +1 -1
- package/shaders/VignetteShader.d.ts +10 -6
- package/shaders/VignetteShader.js +1 -1
- package/shaders/VolumeShader.cjs.js +1 -1
- package/shaders/VolumeShader.d.ts +20 -9
- package/shaders/VolumeShader.js +1 -1
- package/shaders/WaterRefractionShader.cjs.js +1 -1
- package/shaders/WaterRefractionShader.d.ts +16 -8
- package/shaders/WaterRefractionShader.js +1 -1
- package/shaders/index.cjs.js +1 -0
- package/shaders/index.d.ts +53 -0
- package/shaders/index.js +53 -0
- package/shaders/types.cjs.js +1 -0
- package/shaders/types.d.ts +14 -0
- package/shaders/types.js +1 -0
- package/types/shared.d.ts +0 -20
package/shaders/BokehShader2.js
CHANGED
@@ -8,7 +8,7 @@ import { Vector2 } from 'three';
|
|
8
8
|
* Requires #define RINGS and SAMPLES integers
|
9
9
|
*/
|
10
10
|
|
11
|
-
|
11
|
+
const BokehShader2 = {
|
12
12
|
uniforms: {
|
13
13
|
textureWidth: {
|
14
14
|
value: 1.0
|
@@ -83,7 +83,7 @@ var BokehShader2 = {
|
|
83
83
|
vertexShader: ['varying vec2 vUv;', 'void main() {', ' vUv = uv;', ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\n'),
|
84
84
|
fragmentShader: ['#include <common>', 'varying vec2 vUv;', 'uniform sampler2D tColor;', 'uniform sampler2D tDepth;', 'uniform float textureWidth;', 'uniform float textureHeight;', 'uniform float focalDepth; //focal distance value in meters, but you may use autofocus option below', 'uniform float focalLength; //focal length in mm', 'uniform float fstop; //f-stop value', 'uniform bool showFocus; //show debug focus point and focal range (red = focal point, green = focal range)', '/*', 'make sure that these two values are the same for your camera, otherwise distances will be wrong.', '*/', 'uniform float znear; // camera clipping start', 'uniform float zfar; // camera clipping end', '//------------------------------------------', '//user variables', 'const int samples = SAMPLES; //samples on the first ring', 'const int rings = RINGS; //ring count', 'const int maxringsamples = rings * samples;', 'uniform bool manualdof; // manual dof calculation', 'float ndofstart = 1.0; // near dof blur start', 'float ndofdist = 2.0; // near dof blur falloff distance', 'float fdofstart = 1.0; // far dof blur start', 'float fdofdist = 3.0; // far dof blur falloff distance', 'float CoC = 0.03; //circle of confusion size in mm (35mm film = 0.03mm)', 'uniform bool vignetting; // use optical lens vignetting', 'float vignout = 1.3; // vignetting outer border', 'float vignin = 0.0; // vignetting inner border', 'float vignfade = 22.0; // f-stops till vignete fades', 'uniform bool shaderFocus;', '// disable if you use external focalDepth value', 'uniform vec2 focusCoords;', '// autofocus point on screen (0.0,0.0 - left lower corner, 1.0,1.0 - upper right)', '// if center of screen use vec2(0.5, 0.5);', 'uniform float maxblur;', '//clamp value of max blur (0.0 = no blur, 1.0 default)', 'uniform float threshold; // highlight threshold;', 'uniform float gain; // highlight gain;', 'uniform float bias; // bokeh edge bias', 'uniform float fringe; // bokeh chromatic aberration / fringing', 'uniform bool noise; //use noise instead of pattern for sample dithering', 'uniform float dithering;', 'uniform bool depthblur; // blur the depth buffer', 'float dbsize = 1.25; // depth blur size', '/*', 'next part is experimental', 'not looking good with small sample and ring count', 'looks okay starting from samples = 4, rings = 4', '*/', 'uniform bool pentagon; //use pentagon as bokeh shape?', 'float feather = 0.4; //pentagon shape feather', '//------------------------------------------', 'float penta(vec2 coords) {', ' //pentagonal shape', ' float scale = float(rings) - 1.3;', ' vec4 HS0 = vec4( 1.0, 0.0, 0.0, 1.0);', ' vec4 HS1 = vec4( 0.309016994, 0.951056516, 0.0, 1.0);', ' vec4 HS2 = vec4(-0.809016994, 0.587785252, 0.0, 1.0);', ' vec4 HS3 = vec4(-0.809016994,-0.587785252, 0.0, 1.0);', ' vec4 HS4 = vec4( 0.309016994,-0.951056516, 0.0, 1.0);', ' vec4 HS5 = vec4( 0.0 ,0.0 , 1.0, 1.0);', ' vec4 one = vec4( 1.0 );', ' vec4 P = vec4((coords),vec2(scale, scale));', ' vec4 dist = vec4(0.0);', ' float inorout = -4.0;', ' dist.x = dot( P, HS0 );', ' dist.y = dot( P, HS1 );', ' dist.z = dot( P, HS2 );', ' dist.w = dot( P, HS3 );', ' dist = smoothstep( -feather, feather, dist );', ' inorout += dot( dist, one );', ' dist.x = dot( P, HS4 );', ' dist.y = HS5.w - abs( P.z );', ' dist = smoothstep( -feather, feather, dist );', ' inorout += dist.x;', ' return clamp( inorout, 0.0, 1.0 );', '}', 'float bdepth(vec2 coords) {', ' // Depth buffer blur', ' float d = 0.0;', ' float kernel[9];', ' vec2 offset[9];', ' vec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;', ' offset[0] = vec2(-wh.x,-wh.y);', ' offset[1] = vec2( 0.0, -wh.y);', ' offset[2] = vec2( wh.x -wh.y);', ' offset[3] = vec2(-wh.x, 0.0);', ' offset[4] = vec2( 0.0, 0.0);', ' offset[5] = vec2( wh.x, 0.0);', ' offset[6] = vec2(-wh.x, wh.y);', ' offset[7] = vec2( 0.0, wh.y);', ' offset[8] = vec2( wh.x, wh.y);', ' kernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0;', ' kernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0;', ' kernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0;', ' for( int i=0; i<9; i++ ) {', ' float tmp = texture2D(tDepth, coords + offset[i]).r;', ' d += tmp * kernel[i];', ' }', ' return d;', '}', 'vec3 color(vec2 coords,float blur) {', ' //processing the sample', ' vec3 col = vec3(0.0);', ' vec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);', ' col.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;', ' col.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;', ' col.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;', ' vec3 lumcoeff = vec3(0.299,0.587,0.114);', ' float lum = dot(col.rgb, lumcoeff);', ' float thresh = max((lum-threshold)*gain, 0.0);', ' return col+mix(vec3(0.0),col,thresh*blur);', '}', 'vec3 debugFocus(vec3 col, float blur, float depth) {', ' float edge = 0.002*depth; //distance based edge smoothing', ' float m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);', ' float e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);', ' col = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);', ' col = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);', ' return col;', '}', 'float linearize(float depth) {', ' return -zfar * znear / (depth * (zfar - znear) - zfar);', '}', 'float vignette() {', ' float dist = distance(vUv.xy, vec2(0.5,0.5));', ' dist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);', ' return clamp(dist,0.0,1.0);', '}', 'float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {', ' float rings2 = float(rings);', ' float step = PI*2.0 / float(ringsamples);', ' float pw = cos(j*step)*i;', ' float ph = sin(j*step)*i;', ' float p = 1.0;', ' if (pentagon) {', ' p = penta(vec2(pw,ph));', ' }', ' col += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;', ' return 1.0 * mix(1.0, i /rings2, bias) * p;', '}', 'void main() {', ' //scene depth calculation', ' float depth = linearize(texture2D(tDepth,vUv.xy).x);', ' // Blur depth?', ' if ( depthblur ) {', ' depth = linearize(bdepth(vUv.xy));', ' }', ' //focal plane calculation', ' float fDepth = focalDepth;', ' if (shaderFocus) {', ' fDepth = linearize(texture2D(tDepth,focusCoords).x);', ' }', ' // dof blur factor calculation', ' float blur = 0.0;', ' if (manualdof) {', ' float a = depth-fDepth; // Focal plane', ' float b = (a-fdofstart)/fdofdist; // Far DoF', ' float c = (-a-ndofstart)/ndofdist; // Near Dof', ' blur = (a>0.0) ? b : c;', ' } else {', ' float f = focalLength; // focal length in mm', ' float d = fDepth*1000.0; // focal plane in mm', ' float o = depth*1000.0; // depth in mm', ' float a = (o*f)/(o-f);', ' float b = (d*f)/(d-f);', ' float c = (d-f)/(d*fstop*CoC);', ' blur = abs(a-b)*c;', ' }', ' blur = clamp(blur,0.0,1.0);', ' // calculation of pattern for dithering', ' vec2 noise = vec2(rand(vUv.xy), rand( vUv.xy + vec2( 0.4, 0.6 ) ) )*dithering*blur;', ' // getting blur x and y step factor', ' float w = (1.0/textureWidth)*blur*maxblur+noise.x;', ' float h = (1.0/textureHeight)*blur*maxblur+noise.y;', ' // calculation of final color', ' vec3 col = vec3(0.0);', ' if(blur < 0.05) {', ' //some optimization thingy', ' col = texture2D(tColor, vUv.xy).rgb;', ' } else {', ' col = texture2D(tColor, vUv.xy).rgb;', ' float s = 1.0;', ' int ringsamples;', ' for (int i = 1; i <= rings; i++) {', ' /*unboxstart*/', ' ringsamples = i * samples;', ' for (int j = 0 ; j < maxringsamples ; j++) {', ' if (j >= ringsamples) break;', ' s += gather(float(i), float(j), ringsamples, col, w, h, blur);', ' }', ' /*unboxend*/', ' }', ' col /= s; //divide by sample count', ' }', ' if (showFocus) {', ' col = debugFocus(col, blur, depth);', ' }', ' if (vignetting) {', ' col *= vignette();', ' }', ' gl_FragColor.rgb = col;', ' gl_FragColor.a = 1.0;', '} '].join('\n')
|
85
85
|
};
|
86
|
-
|
86
|
+
const BokehDepthShader = {
|
87
87
|
uniforms: {
|
88
88
|
mNear: {
|
89
89
|
value: 1.0
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const r={uniforms:{tDiffuse:{value:null},brightness:{value:0},contrast:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float brightness;","uniform float contrast;","varying vec2 vUv;","void main() {","\tgl_FragColor = texture2D( tDiffuse, vUv );","\tgl_FragColor.rgb += brightness;","\tif (contrast > 0.0) {","\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;","\t} else {","\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;","\t}","}"].join("\n")};exports.BrightnessContrastShader=r;
|
@@ -1,10 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
export const BrightnessContrastShader: {
|
1
|
+
export declare const BrightnessContrastShader: {
|
4
2
|
uniforms: {
|
5
|
-
tDiffuse:
|
6
|
-
|
7
|
-
|
3
|
+
tDiffuse: {
|
4
|
+
value: null;
|
5
|
+
};
|
6
|
+
brightness: {
|
7
|
+
value: number;
|
8
|
+
};
|
9
|
+
contrast: {
|
10
|
+
value: number;
|
11
|
+
};
|
8
12
|
};
|
9
13
|
vertexShader: string;
|
10
14
|
fragmentShader: string;
|
@@ -4,7 +4,7 @@
|
|
4
4
|
* brightness: -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white)
|
5
5
|
* contrast: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
|
6
6
|
*/
|
7
|
-
|
7
|
+
const BrightnessContrastShader = {
|
8
8
|
uniforms: {
|
9
9
|
tDiffuse: {
|
10
10
|
value: null
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three")
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");const r={uniforms:{tDiffuse:{value:null},powRGB:{value:new e.Vector3(2,2,2)},mulRGB:{value:new e.Vector3(1,1,1)},addRGB:{value:new e.Vector3(0,0,0)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec3 powRGB;","uniform vec3 mulRGB;","uniform vec3 addRGB;","varying vec2 vUv;","void main() {","\tgl_FragColor = texture2D( tDiffuse, vUv );","\tgl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB );","}"].join("\n")};exports.ColorCorrectionShader=r;
|
@@ -1,11 +1,18 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
export const ColorCorrectionShader: {
|
1
|
+
import { Vector3 } from 'three';
|
2
|
+
export declare const ColorCorrectionShader: {
|
4
3
|
uniforms: {
|
5
|
-
tDiffuse:
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
tDiffuse: {
|
5
|
+
value: null;
|
6
|
+
};
|
7
|
+
powRGB: {
|
8
|
+
value: Vector3;
|
9
|
+
};
|
10
|
+
mulRGB: {
|
11
|
+
value: Vector3;
|
12
|
+
};
|
13
|
+
addRGB: {
|
14
|
+
value: Vector3;
|
15
|
+
};
|
9
16
|
};
|
10
17
|
vertexShader: string;
|
11
18
|
fragmentShader: string;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={uniforms:{tDiffuse:{value:null},color:{value:new(require("three").Color)(16777215)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform vec3 color;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tvec3 luma = vec3( 0.299, 0.587, 0.114 );","\tfloat v = dot( texel.xyz, luma );","\tgl_FragColor = vec4( v * color, texel.w );","}"].join("\n")};exports.ColorifyShader=e;
|
@@ -1,9 +1,12 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
export const ColorifyShader: {
|
1
|
+
import { Color } from 'three';
|
2
|
+
export declare const ColorifyShader: {
|
4
3
|
uniforms: {
|
5
|
-
tDiffuse:
|
6
|
-
|
4
|
+
tDiffuse: {
|
5
|
+
value: null;
|
6
|
+
};
|
7
|
+
color: {
|
8
|
+
value: Color;
|
9
|
+
};
|
7
10
|
};
|
8
11
|
vertexShader: string;
|
9
12
|
fragmentShader: string;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={defines:{KERNEL_SIZE_FLOAT:"25.0",KERNEL_SIZE_INT:"25"},uniforms:{tDiffuse:{value:null},uImageIncrement:{value:new(require("three").Vector2)(.001953125,0)},cKernel:{value:[]}},vertexShader:["uniform vec2 uImageIncrement;","varying vec2 vUv;","void main() {","\tvUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;","\tgl_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() {","\tvec2 imageCoord = vUv;","\tvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );","\tfor( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {","\t\tsum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];","\t\timageCoord += uImageIncrement;","\t}","\tgl_FragColor = sum;","}"].join("\n"),buildKernel:function(e){function t(e,t){return Math.exp(-e*e/(2*t*t))}const r=Math.min(2*Math.ceil(3*e)+1,25),n=.5*(r-1),i=new Array(r);let o=0;for(let u=0;u<r;++u)i[u]=t(u-n,e),o+=i[u];for(let e=0;e<r;++e)i[e]/=o;return i}};exports.ConvolutionShader=e;
|
@@ -1,17 +1,16 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
};
|
8
|
-
uniforms: {
|
9
|
-
tDiffuse: Uniform;
|
10
|
-
uImageIncrement: Uniform;
|
11
|
-
cKernel: Uniform;
|
12
|
-
};
|
13
|
-
vertexShader: string;
|
14
|
-
fragmentShader: string;
|
15
|
-
|
16
|
-
buildKernel(sigma: number): number[];
|
1
|
+
import { Vector2 } from 'three';
|
2
|
+
import type { IUniform, Texture } from 'three';
|
3
|
+
import type { IShader } from './types';
|
4
|
+
export declare type ConvolutionShaderDefines = {
|
5
|
+
KERNEL_SIZE_FLOAT: string;
|
6
|
+
KERNEL_SIZE_INT: string;
|
17
7
|
};
|
8
|
+
export declare type ConvolutionShaderUniforms = {
|
9
|
+
cKernel: IUniform<number[]>;
|
10
|
+
tDiffuse: IUniform<Texture | null>;
|
11
|
+
uImageIncrement: IUniform<Vector2>;
|
12
|
+
};
|
13
|
+
export interface IConvolutionShader extends IShader<ConvolutionShaderUniforms, ConvolutionShaderDefines> {
|
14
|
+
buildKernel: (sigma: number) => number[];
|
15
|
+
}
|
16
|
+
export declare const ConvolutionShader: IConvolutionShader;
|
@@ -6,7 +6,7 @@ import { Vector2 } from 'three';
|
|
6
6
|
* http://o3d.googlecode.com/svn/trunk/samples/convolution.html
|
7
7
|
*/
|
8
8
|
|
9
|
-
|
9
|
+
const ConvolutionShader = {
|
10
10
|
defines: {
|
11
11
|
KERNEL_SIZE_FLOAT: '25.0',
|
12
12
|
KERNEL_SIZE_INT: '25'
|
@@ -30,24 +30,19 @@ var ConvolutionShader = {
|
|
30
30
|
return Math.exp(-(x * x) / (2.0 * sigma * sigma));
|
31
31
|
}
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
halfWidth = (kernelSize - 1) * 0.5;
|
41
|
-
values = new Array(kernelSize);
|
42
|
-
sum = 0.0;
|
43
|
-
|
44
|
-
for (i = 0; i < kernelSize; ++i) {
|
33
|
+
const kMaxKernelSize = 25;
|
34
|
+
const kernelSize = Math.min(2 * Math.ceil(sigma * 3.0) + 1, kMaxKernelSize);
|
35
|
+
const halfWidth = (kernelSize - 1) * 0.5;
|
36
|
+
const values = new Array(kernelSize);
|
37
|
+
let sum = 0.0;
|
38
|
+
|
39
|
+
for (let i = 0; i < kernelSize; ++i) {
|
45
40
|
values[i] = gauss(i - halfWidth, sigma);
|
46
41
|
sum += values[i];
|
47
42
|
} // normalize the kernel
|
48
43
|
|
49
44
|
|
50
|
-
for (i = 0; i < kernelSize; ++i) values[i] /= sum;
|
45
|
+
for (let i = 0; i < kernelSize; ++i) values[i] /= sum;
|
51
46
|
|
52
47
|
return values;
|
53
48
|
}
|
package/shaders/CopyShader.d.ts
CHANGED
@@ -1,13 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
opacity: {
|
7
|
-
value: number;
|
8
|
-
};
|
9
|
-
};
|
10
|
-
vertexShader: string;
|
11
|
-
fragmentShader: string;
|
1
|
+
import type { IUniform, Texture } from 'three';
|
2
|
+
import type { IShader } from './types';
|
3
|
+
export declare type CopyShaderUniforms = {
|
4
|
+
opacity: IUniform<number>;
|
5
|
+
tDiffuse: IUniform<Texture | null>;
|
12
6
|
};
|
13
|
-
export
|
7
|
+
export interface ICopyShader extends IShader<CopyShaderUniforms> {
|
8
|
+
}
|
9
|
+
export declare const CopyShader: ICopyShader;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const o={uniforms:{tColor:{value:null},tDepth:{value:null},focus:{value:1},maxblur:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_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() {","\tvec4 depth = texture2D( tDepth, vUv );","\tfloat factor = depth.x - focus;","\tvec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );","\tgl_FragColor = col;","\tgl_FragColor.a = 1.0;","}"].join("\n")};exports.DOFMipMapShader=o;
|
@@ -1,11 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
export const DOFMipMapShader: {
|
1
|
+
export declare const DOFMipMapShader: {
|
4
2
|
uniforms: {
|
5
|
-
tColor:
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
tColor: {
|
4
|
+
value: null;
|
5
|
+
};
|
6
|
+
tDepth: {
|
7
|
+
value: null;
|
8
|
+
};
|
9
|
+
focus: {
|
10
|
+
value: number;
|
11
|
+
};
|
12
|
+
maxblur: {
|
13
|
+
value: number;
|
14
|
+
};
|
9
15
|
};
|
10
16
|
vertexShader: string;
|
11
17
|
fragmentShader: string;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three")
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");const t={defines:{KERNEL_RADIUS:4,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDiffuse:{value:null},size:{value:new e.Vector2(512,512)},sampleUvOffsets:{value:[new e.Vector2(0,0)]},sampleWeights:{value:[1]},tDepth:{value:null},cameraNear:{value:10},cameraFar:{value:1e3},depthCutoff:{value:10}},vertexShader:["#include <common>","uniform vec2 size;","varying vec2 vUv;","varying vec2 vInvSize;","void main() {","\tvUv = uv;","\tvInvSize = 1.0 / size;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","#include <packing>","uniform sampler2D tDiffuse;","uniform sampler2D tDepth;","uniform float cameraNear;","uniform float cameraFar;","uniform float depthCutoff;","uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];","uniform float sampleWeights[ KERNEL_RADIUS + 1 ];","varying vec2 vUv;","varying vec2 vInvSize;","float getDepth( const in vec2 screenPosition ) {","\t#if DEPTH_PACKING == 1","\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );","\t#else","\treturn texture2D( tDepth, screenPosition ).x;","\t#endif","}","float getViewZ( const in float depth ) {","\t#if PERSPECTIVE_CAMERA == 1","\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );","\t#else","\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );","\t#endif","}","void main() {","\tfloat depth = getDepth( vUv );","\tif( depth >= ( 1.0 - EPSILON ) ) {","\t\tdiscard;","\t}","\tfloat centerViewZ = -getViewZ( depth );","\tbool rBreak = false, lBreak = false;","\tfloat weightSum = sampleWeights[0];","\tvec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;","\tfor( int i = 1; i <= KERNEL_RADIUS; i ++ ) {","\t\tfloat sampleWeight = sampleWeights[i];","\t\tvec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;","\t\tvec2 sampleUv = vUv + sampleUvOffset;","\t\tfloat viewZ = -getViewZ( getDepth( sampleUv ) );","\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;","\t\tif( ! rBreak ) {","\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;","\t\t\tweightSum += sampleWeight;","\t\t}","\t\tsampleUv = vUv - sampleUvOffset;","\t\tviewZ = -getViewZ( getDepth( sampleUv ) );","\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;","\t\tif( ! lBreak ) {","\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;","\t\t\tweightSum += sampleWeight;","\t\t}","\t}","\tgl_FragColor = diffuseSum / weightSum;","}"].join("\n")},a={createSampleWeights:(e,t)=>{const a=(e,t)=>Math.exp(-e*e/(t*t*2))/(Math.sqrt(2*Math.PI)*t),i=[];for(let r=0;r<=e;r++)i.push(a(r,t));return i},createSampleOffsets:(e,t)=>{const a=[];for(let i=0;i<=e;i++)a.push(t.clone().multiplyScalar(i));return a},configure:(e,t,i,r)=>{e.defines.KERNEL_RADIUS=t,e.uniforms.sampleUvOffsets.value=a.createSampleOffsets(t,r),e.uniforms.sampleWeights.value=a.createSampleWeights(t,i),e.needsUpdate=!0}};exports.BlurShaderUtils=a,exports.DepthLimitedBlurShader=t;
|
@@ -1,27 +1,28 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
};
|
9
|
-
uniforms: {
|
10
|
-
tDiffuse: Uniform;
|
11
|
-
size: Uniform;
|
12
|
-
sampleUvOffsets: Uniform;
|
13
|
-
sampleWeights: Uniform;
|
14
|
-
tDepth: Uniform;
|
15
|
-
cameraNear: Uniform;
|
16
|
-
cameraFar: Uniform;
|
17
|
-
depthCutoff: Uniform;
|
18
|
-
};
|
19
|
-
vertexShader: string;
|
20
|
-
fragmentShader: string;
|
1
|
+
import { Vector2 } from 'three';
|
2
|
+
import type { IUniform, Texture } from 'three';
|
3
|
+
import type { IShader } from './types';
|
4
|
+
export declare type DepthLimitedBlurShaderDefines = {
|
5
|
+
DEPTH_PACKING: number;
|
6
|
+
KERNEL_RADIUS: number;
|
7
|
+
PERSPECTIVE_CAMERA: number;
|
21
8
|
};
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
9
|
+
export declare type DepthLimitedBlurShaderUniforms = {
|
10
|
+
cameraFar: IUniform<number>;
|
11
|
+
cameraNear: IUniform<number>;
|
12
|
+
depthCutoff: IUniform<number>;
|
13
|
+
sampleUvOffsets: IUniform<Vector2[]>;
|
14
|
+
sampleWeights: IUniform<number[]>;
|
15
|
+
size: IUniform<Vector2>;
|
16
|
+
tDepth: IUniform<Texture | null>;
|
17
|
+
tDiffuse: IUniform<Texture | null>;
|
18
|
+
};
|
19
|
+
export interface IDepthLimitedBlurShader extends IShader<DepthLimitedBlurShaderUniforms, DepthLimitedBlurShaderDefines> {
|
20
|
+
defines: DepthLimitedBlurShaderDefines;
|
21
|
+
needsUpdate?: boolean;
|
22
|
+
}
|
23
|
+
export declare const DepthLimitedBlurShader: IDepthLimitedBlurShader;
|
24
|
+
export declare const BlurShaderUtils: {
|
25
|
+
createSampleWeights: (kernelRadius: number, stdDev: number) => number[];
|
26
|
+
createSampleOffsets: (kernelRadius: number, uvIncrement: Vector2) => Vector2[];
|
27
|
+
configure: (shader: IDepthLimitedBlurShader, kernelRadius: number, stdDev: number, uvIncrement: Vector2) => void;
|
27
28
|
};
|
@@ -1,10 +1,6 @@
|
|
1
1
|
import { Vector2 } from 'three';
|
2
2
|
|
3
|
-
|
4
|
-
* TODO
|
5
|
-
*/
|
6
|
-
|
7
|
-
var DepthLimitedBlurShader = {
|
3
|
+
const DepthLimitedBlurShader = {
|
8
4
|
defines: {
|
9
5
|
KERNEL_RADIUS: 4,
|
10
6
|
DEPTH_PACKING: 1,
|
@@ -39,13 +35,13 @@ var DepthLimitedBlurShader = {
|
|
39
35
|
vertexShader: ['#include <common>', 'uniform vec2 size;', 'varying vec2 vUv;', 'varying vec2 vInvSize;', 'void main() {', ' vUv = uv;', ' vInvSize = 1.0 / size;', ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\n'),
|
40
36
|
fragmentShader: ['#include <common>', '#include <packing>', 'uniform sampler2D tDiffuse;', 'uniform sampler2D tDepth;', 'uniform float cameraNear;', 'uniform float cameraFar;', 'uniform float depthCutoff;', 'uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];', 'uniform float sampleWeights[ KERNEL_RADIUS + 1 ];', 'varying vec2 vUv;', 'varying vec2 vInvSize;', 'float getDepth( const in vec2 screenPosition ) {', ' #if DEPTH_PACKING == 1', ' return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );', ' #else', ' return texture2D( tDepth, screenPosition ).x;', ' #endif', '}', 'float getViewZ( const in float depth ) {', ' #if PERSPECTIVE_CAMERA == 1', ' return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );', ' #else', ' return orthographicDepthToViewZ( depth, cameraNear, cameraFar );', ' #endif', '}', 'void main() {', ' float depth = getDepth( vUv );', ' if( depth >= ( 1.0 - EPSILON ) ) {', ' discard;', ' }', ' float centerViewZ = -getViewZ( depth );', ' bool rBreak = false, lBreak = false;', ' float weightSum = sampleWeights[0];', ' vec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;', ' for( int i = 1; i <= KERNEL_RADIUS; i ++ ) {', ' float sampleWeight = sampleWeights[i];', ' vec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;', ' vec2 sampleUv = vUv + sampleUvOffset;', ' float viewZ = -getViewZ( getDepth( sampleUv ) );', ' if( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;', ' if( ! rBreak ) {', ' diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;', ' weightSum += sampleWeight;', ' }', ' sampleUv = vUv - sampleUvOffset;', ' viewZ = -getViewZ( getDepth( sampleUv ) );', ' if( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;', ' if( ! lBreak ) {', ' diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;', ' weightSum += sampleWeight;', ' }', ' }', ' gl_FragColor = diffuseSum / weightSum;', '}'].join('\n')
|
41
37
|
};
|
42
|
-
|
43
|
-
createSampleWeights:
|
44
|
-
|
38
|
+
const BlurShaderUtils = {
|
39
|
+
createSampleWeights: (kernelRadius, stdDev) => {
|
40
|
+
const gaussian = (x, stdDev) => {
|
45
41
|
return Math.exp(-(x * x) / (2.0 * (stdDev * stdDev))) / (Math.sqrt(2.0 * Math.PI) * stdDev);
|
46
42
|
};
|
47
43
|
|
48
|
-
|
44
|
+
const weights = [];
|
49
45
|
|
50
46
|
for (let i = 0; i <= kernelRadius; i++) {
|
51
47
|
weights.push(gaussian(i, stdDev));
|
@@ -53,8 +49,8 @@ var BlurShaderUtils = {
|
|
53
49
|
|
54
50
|
return weights;
|
55
51
|
},
|
56
|
-
createSampleOffsets:
|
57
|
-
|
52
|
+
createSampleOffsets: (kernelRadius, uvIncrement) => {
|
53
|
+
const offsets = [];
|
58
54
|
|
59
55
|
for (let i = 0; i <= kernelRadius; i++) {
|
60
56
|
offsets.push(uvIncrement.clone().multiplyScalar(i));
|
@@ -62,11 +58,11 @@ var BlurShaderUtils = {
|
|
62
58
|
|
63
59
|
return offsets;
|
64
60
|
},
|
65
|
-
configure:
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
61
|
+
configure: (shader, kernelRadius, stdDev, uvIncrement) => {
|
62
|
+
shader.defines['KERNEL_RADIUS'] = kernelRadius;
|
63
|
+
shader.uniforms['sampleUvOffsets'].value = BlurShaderUtils.createSampleOffsets(kernelRadius, uvIncrement);
|
64
|
+
shader.uniforms['sampleWeights'].value = BlurShaderUtils.createSampleWeights(kernelRadius, stdDev);
|
65
|
+
shader.needsUpdate = true;
|
70
66
|
}
|
71
67
|
};
|
72
68
|
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={uniforms:{tDiffuse:{value:null},tDisp:{value:null},byp:{value:0},amount:{value:.08},angle:{value:.02},seed:{value:.02},seed_x:{value:.02},seed_y:{value:.02},distortion_x:{value:.5},distortion_y:{value:.6},col_s:{value:.05}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform int byp;","uniform sampler2D tDiffuse;","uniform sampler2D tDisp;","uniform float amount;","uniform float angle;","uniform float seed;","uniform float seed_x;","uniform float seed_y;","uniform float distortion_x;","uniform float distortion_y;","uniform float col_s;","varying vec2 vUv;","float rand(vec2 co){","\treturn fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);","}","void main() {","\tif(byp<1) {","\t\tvec2 p = vUv;","\t\tfloat xs = floor(gl_FragCoord.x / 0.5);","\t\tfloat ys = floor(gl_FragCoord.y / 0.5);","\t\tvec4 normal = texture2D (tDisp, p*seed*seed);","\t\tif(p.y<distortion_x+col_s && p.y>distortion_x-col_s*seed) {","\t\t\tif(seed_x>0.){","\t\t\t\tp.y = 1. - (p.y + distortion_y);","\t\t\t}","\t\t\telse {","\t\t\t\tp.y = distortion_y;","\t\t\t}","\t\t}","\t\tif(p.x<distortion_y+col_s && p.x>distortion_y-col_s*seed) {","\t\t\tif(seed_y>0.){","\t\t\t\tp.x=distortion_x;","\t\t\t}","\t\t\telse {","\t\t\t\tp.x = 1. - (p.x + distortion_x);","\t\t\t}","\t\t}","\t\tp.x+=normal.x*seed_x*(seed/5.);","\t\tp.y+=normal.y*seed_y*(seed/5.);","\t\tvec2 offset = amount * vec2( cos(angle), sin(angle));","\t\tvec4 cr = texture2D(tDiffuse, p + offset);","\t\tvec4 cga = texture2D(tDiffuse, p);","\t\tvec4 cb = texture2D(tDiffuse, p - offset);","\t\tgl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);","\t\tvec4 snow = 200.*amount*vec4(rand(vec2(xs * seed,ys * seed*50.))*0.2);","\t\tgl_FragColor = gl_FragColor+ snow;","\t}","\telse {","\t\tgl_FragColor=texture2D (tDiffuse, vUv);","\t}","}"].join("\n")};exports.DigitalGlitch=t;
|
@@ -1,18 +1,38 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
export const DigitalGlitch: {
|
1
|
+
export declare const DigitalGlitch: {
|
4
2
|
uniforms: {
|
5
|
-
tDiffuse:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
3
|
+
tDiffuse: {
|
4
|
+
value: null;
|
5
|
+
};
|
6
|
+
tDisp: {
|
7
|
+
value: null;
|
8
|
+
};
|
9
|
+
byp: {
|
10
|
+
value: number;
|
11
|
+
};
|
12
|
+
amount: {
|
13
|
+
value: number;
|
14
|
+
};
|
15
|
+
angle: {
|
16
|
+
value: number;
|
17
|
+
};
|
18
|
+
seed: {
|
19
|
+
value: number;
|
20
|
+
};
|
21
|
+
seed_x: {
|
22
|
+
value: number;
|
23
|
+
};
|
24
|
+
seed_y: {
|
25
|
+
value: number;
|
26
|
+
};
|
27
|
+
distortion_x: {
|
28
|
+
value: number;
|
29
|
+
};
|
30
|
+
distortion_y: {
|
31
|
+
value: number;
|
32
|
+
};
|
33
|
+
col_s: {
|
34
|
+
value: number;
|
35
|
+
};
|
16
36
|
};
|
17
37
|
vertexShader: string;
|
18
38
|
fragmentShader: string;
|
package/shaders/DigitalGlitch.js
CHANGED
@@ -1,13 +1,4 @@
|
|
1
|
-
|
2
|
-
* RGB Shift Shader
|
3
|
-
* Shifts red and blue channels from center in opposite directions
|
4
|
-
* Ported from http://kriss.cx/tom/2009/05/rgb-shift/
|
5
|
-
* by Tom Butterworth / http://kriss.cx/tom/
|
6
|
-
*
|
7
|
-
* amount: shift distance (1 is width of input)
|
8
|
-
* angle: shift angle in radians
|
9
|
-
*/
|
10
|
-
var DigitalGlitch = {
|
1
|
+
const DigitalGlitch = {
|
11
2
|
uniforms: {
|
12
3
|
tDiffuse: {
|
13
4
|
value: null
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three")
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");const t={uniforms:{tDiffuse:{value:null},tSize:{value:new e.Vector2(256,256)},center:{value:new e.Vector2(.5,.5)},angle:{value:1.57},scale:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_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() {","\tfloat s = sin( angle ), c = cos( angle );","\tvec2 tex = vUv * tSize - center;","\tvec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;","\treturn ( sin( point.x ) * sin( point.y ) ) * 4.0;","}","void main() {","\tvec4 color = texture2D( tDiffuse, vUv );","\tfloat average = ( color.r + color.g + color.b ) / 3.0;","\tgl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );","}"].join("\n")};exports.DotScreenShader=t;
|
@@ -1,12 +1,21 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
export const DotScreenShader: {
|
1
|
+
import { Vector2 } from 'three';
|
2
|
+
export declare const DotScreenShader: {
|
4
3
|
uniforms: {
|
5
|
-
tDiffuse:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
tDiffuse: {
|
5
|
+
value: null;
|
6
|
+
};
|
7
|
+
tSize: {
|
8
|
+
value: Vector2;
|
9
|
+
};
|
10
|
+
center: {
|
11
|
+
value: Vector2;
|
12
|
+
};
|
13
|
+
angle: {
|
14
|
+
value: number;
|
15
|
+
};
|
16
|
+
scale: {
|
17
|
+
value: number;
|
18
|
+
};
|
10
19
|
};
|
11
20
|
vertexShader: string;
|
12
21
|
fragmentShader: string;
|