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.
Files changed (168) hide show
  1. package/index.cjs.js +1 -1
  2. package/index.d.ts +2 -52
  3. package/index.js +53 -52
  4. package/lines/LineMaterial.d.ts +7 -6
  5. package/modifiers/CurveModifier.cjs.js +1 -1
  6. package/modifiers/CurveModifier.d.ts +13 -9
  7. package/modifiers/CurveModifier.js +27 -30
  8. package/objects/Lensflare.cjs.js +1 -1
  9. package/objects/Lensflare.js +11 -3
  10. package/package.json +3 -3
  11. package/postprocessing/AfterimagePass.d.ts +2 -30
  12. package/postprocessing/RenderPixelatedPass.cjs.js +1 -0
  13. package/postprocessing/RenderPixelatedPass.js +213 -0
  14. package/shaders/ACESFilmicToneMappingShader.cjs.js +1 -1
  15. package/shaders/ACESFilmicToneMappingShader.d.ts +9 -0
  16. package/shaders/ACESFilmicToneMappingShader.js +1 -1
  17. package/shaders/AfterimageShader.d.ts +9 -15
  18. package/shaders/BasicShader.cjs.js +1 -1
  19. package/shaders/BasicShader.d.ts +5 -5
  20. package/shaders/BasicShader.js +1 -1
  21. package/shaders/BleachBypassShader.cjs.js +1 -1
  22. package/shaders/BleachBypassShader.d.ts +8 -9
  23. package/shaders/BleachBypassShader.js +1 -1
  24. package/shaders/BlendShader.cjs.js +1 -1
  25. package/shaders/BlendShader.d.ts +13 -7
  26. package/shaders/BlendShader.js +1 -1
  27. package/shaders/BokehShader.cjs.js +1 -1
  28. package/shaders/BokehShader.d.ts +18 -19
  29. package/shaders/BokehShader.js +1 -1
  30. package/shaders/BokehShader2.cjs.js +1 -1
  31. package/shaders/BokehShader2.d.ts +80 -34
  32. package/shaders/BokehShader2.js +2 -2
  33. package/shaders/BrightnessContrastShader.cjs.js +1 -1
  34. package/shaders/BrightnessContrastShader.d.ts +10 -6
  35. package/shaders/BrightnessContrastShader.js +1 -1
  36. package/shaders/ColorCorrectionShader.cjs.js +1 -1
  37. package/shaders/ColorCorrectionShader.d.ts +14 -7
  38. package/shaders/ColorCorrectionShader.js +1 -1
  39. package/shaders/ColorifyShader.cjs.js +1 -1
  40. package/shaders/ColorifyShader.d.ts +8 -5
  41. package/shaders/ColorifyShader.js +1 -1
  42. package/shaders/ConvolutionShader.cjs.js +1 -1
  43. package/shaders/ConvolutionShader.d.ts +15 -16
  44. package/shaders/ConvolutionShader.js +9 -14
  45. package/shaders/CopyShader.d.ts +8 -12
  46. package/shaders/DOFMipMapShader.cjs.js +1 -1
  47. package/shaders/DOFMipMapShader.d.ts +13 -7
  48. package/shaders/DOFMipMapShader.js +1 -1
  49. package/shaders/DepthLimitedBlurShader.cjs.js +1 -1
  50. package/shaders/DepthLimitedBlurShader.d.ts +26 -25
  51. package/shaders/DepthLimitedBlurShader.js +12 -16
  52. package/shaders/DigitalGlitch.cjs.js +1 -1
  53. package/shaders/DigitalGlitch.d.ts +34 -14
  54. package/shaders/DigitalGlitch.js +1 -10
  55. package/shaders/DotScreenShader.cjs.js +1 -1
  56. package/shaders/DotScreenShader.d.ts +17 -8
  57. package/shaders/DotScreenShader.js +1 -1
  58. package/shaders/FXAAShader.cjs.js +1 -1
  59. package/shaders/FXAAShader.d.ts +8 -5
  60. package/shaders/FXAAShader.js +1 -1
  61. package/shaders/FilmShader.cjs.js +1 -1
  62. package/shaders/FilmShader.d.ts +19 -9
  63. package/shaders/FilmShader.js +1 -1
  64. package/shaders/FocusShader.cjs.js +1 -1
  65. package/shaders/FocusShader.d.ts +16 -8
  66. package/shaders/FocusShader.js +1 -1
  67. package/shaders/FreiChenShader.cjs.js +1 -1
  68. package/shaders/FreiChenShader.d.ts +8 -5
  69. package/shaders/FreiChenShader.js +1 -1
  70. package/shaders/FresnelShader.cjs.js +1 -1
  71. package/shaders/FresnelShader.d.ts +21 -0
  72. package/shaders/FresnelShader.js +1 -1
  73. package/shaders/GammaCorrectionShader.d.ts +7 -7
  74. package/shaders/GodRaysShader.cjs.js +1 -1
  75. package/shaders/GodRaysShader.d.ts +38 -20
  76. package/shaders/GodRaysShader.js +4 -4
  77. package/shaders/HalftoneShader.cjs.js +1 -1
  78. package/shaders/HalftoneShader.d.ts +40 -16
  79. package/shaders/HalftoneShader.js +1 -1
  80. package/shaders/HorizontalBlurShader.d.ts +8 -8
  81. package/shaders/HorizontalTiltShiftShader.cjs.js +1 -1
  82. package/shaders/HorizontalTiltShiftShader.d.ts +10 -6
  83. package/shaders/HorizontalTiltShiftShader.js +1 -1
  84. package/shaders/HueSaturationShader.cjs.js +1 -1
  85. package/shaders/HueSaturationShader.d.ts +10 -6
  86. package/shaders/HueSaturationShader.js +1 -1
  87. package/shaders/KaleidoShader.cjs.js +1 -1
  88. package/shaders/KaleidoShader.d.ts +10 -6
  89. package/shaders/KaleidoShader.js +1 -1
  90. package/shaders/LuminosityHighPassShader.cjs.js +1 -1
  91. package/shaders/LuminosityHighPassShader.d.ts +17 -8
  92. package/shaders/LuminosityHighPassShader.js +1 -1
  93. package/shaders/LuminosityShader.cjs.js +1 -1
  94. package/shaders/LuminosityShader.d.ts +4 -4
  95. package/shaders/LuminosityShader.js +1 -1
  96. package/shaders/MirrorShader.cjs.js +1 -1
  97. package/shaders/MirrorShader.d.ts +7 -5
  98. package/shaders/MirrorShader.js +1 -1
  99. package/shaders/NormalMapShader.cjs.js +1 -1
  100. package/shaders/NormalMapShader.d.ts +14 -7
  101. package/shaders/NormalMapShader.js +1 -1
  102. package/shaders/ParallaxShader.cjs.js +1 -1
  103. package/shaders/ParallaxShader.d.ts +28 -0
  104. package/shaders/ParallaxShader.js +1 -1
  105. package/shaders/PixelShader.cjs.js +1 -1
  106. package/shaders/PixelShader.d.ts +10 -6
  107. package/shaders/PixelShader.js +1 -1
  108. package/shaders/RGBShiftShader.cjs.js +1 -1
  109. package/shaders/RGBShiftShader.d.ts +10 -6
  110. package/shaders/RGBShiftShader.js +1 -1
  111. package/shaders/SAOShader.cjs.js +1 -1
  112. package/shaders/SAOShader.d.ts +24 -29
  113. package/shaders/SAOShader.js +1 -5
  114. package/shaders/SMAAShader.cjs.js +1 -1
  115. package/shaders/SMAAShader.d.ts +31 -16
  116. package/shaders/SMAAShader.js +3 -3
  117. package/shaders/SSAOShader.cjs.js +1 -1
  118. package/shaders/SSAOShader.d.ts +58 -25
  119. package/shaders/SSAOShader.js +3 -3
  120. package/shaders/SSRShader.cjs.js +1 -1
  121. package/shaders/SSRShader.d.ts +67 -36
  122. package/shaders/SSRShader.js +3 -3
  123. package/shaders/SepiaShader.cjs.js +1 -1
  124. package/shaders/SepiaShader.d.ts +7 -5
  125. package/shaders/SepiaShader.js +1 -1
  126. package/shaders/SobelOperatorShader.cjs.js +1 -1
  127. package/shaders/SobelOperatorShader.d.ts +8 -5
  128. package/shaders/SobelOperatorShader.js +1 -1
  129. package/shaders/SubsurfaceScatteringShader.cjs.js +1 -1
  130. package/shaders/SubsurfaceScatteringShader.d.ts +2 -34
  131. package/shaders/SubsurfaceScatteringShader.js +3 -3
  132. package/shaders/TechnicolorShader.cjs.js +1 -1
  133. package/shaders/TechnicolorShader.d.ts +4 -4
  134. package/shaders/TechnicolorShader.js +1 -1
  135. package/shaders/ToneMapShader.cjs.js +1 -1
  136. package/shaders/ToneMapShader.d.ts +19 -9
  137. package/shaders/ToneMapShader.js +1 -1
  138. package/shaders/ToonShader.cjs.js +1 -1
  139. package/shaders/ToonShader.d.ts +80 -34
  140. package/shaders/ToonShader.js +4 -4
  141. package/shaders/TriangleBlurShader.cjs.js +1 -1
  142. package/shaders/TriangleBlurShader.d.ts +8 -5
  143. package/shaders/TriangleBlurShader.js +1 -1
  144. package/shaders/UnpackDepthRGBAShader.cjs.js +1 -1
  145. package/shaders/UnpackDepthRGBAShader.d.ts +7 -5
  146. package/shaders/UnpackDepthRGBAShader.js +1 -1
  147. package/shaders/VerticalBlurShader.cjs.js +1 -1
  148. package/shaders/VerticalBlurShader.d.ts +8 -8
  149. package/shaders/VerticalBlurShader.js +1 -1
  150. package/shaders/VerticalTiltShiftShader.cjs.js +1 -1
  151. package/shaders/VerticalTiltShiftShader.d.ts +10 -6
  152. package/shaders/VerticalTiltShiftShader.js +1 -1
  153. package/shaders/VignetteShader.cjs.js +1 -1
  154. package/shaders/VignetteShader.d.ts +10 -6
  155. package/shaders/VignetteShader.js +1 -1
  156. package/shaders/VolumeShader.cjs.js +1 -1
  157. package/shaders/VolumeShader.d.ts +20 -9
  158. package/shaders/VolumeShader.js +1 -1
  159. package/shaders/WaterRefractionShader.cjs.js +1 -1
  160. package/shaders/WaterRefractionShader.d.ts +16 -8
  161. package/shaders/WaterRefractionShader.js +1 -1
  162. package/shaders/index.cjs.js +1 -0
  163. package/shaders/index.d.ts +53 -0
  164. package/shaders/index.js +53 -0
  165. package/shaders/types.cjs.js +1 -0
  166. package/shaders/types.d.ts +14 -0
  167. package/shaders/types.js +1 -0
  168. package/types/shared.d.ts +0 -20
@@ -0,0 +1,213 @@
1
+ import { Vector2, MeshNormalMaterial, ShaderMaterial, Vector4, WebGLRenderTarget, DepthTexture, NearestFilter, RGBAFormat, RGBFormat } from 'three';
2
+ import { Pass, FullScreenQuad } from './Pass.js';
3
+
4
+ class RenderPixelatedPass extends Pass {
5
+ constructor(resolution, pixelSize, scene, camera, options = {}) {
6
+ var _options$normalEdgeSt, _options$depthEdgeStr;
7
+
8
+ super();
9
+ this.pixelSize = pixelSize;
10
+ this.resolution = new Vector2();
11
+ this.renderResolution = new Vector2();
12
+ this.setSize(resolution.x, resolution.y);
13
+ this.fsQuad = new FullScreenQuad(this.material());
14
+ this.scene = scene;
15
+ this.camera = camera;
16
+ this.normalEdgeStrength = (_options$normalEdgeSt = options.normalEdgeStrength) != null ? _options$normalEdgeSt : 0.3;
17
+ this.depthEdgeStrength = (_options$depthEdgeStr = options.depthEdgeStrength) != null ? _options$depthEdgeStr : 0.4;
18
+ this.rgbRenderTarget = pixelRenderTarget(this.renderResolution, RGBAFormat, true);
19
+ this.normalRenderTarget = pixelRenderTarget(this.renderResolution, RGBFormat, false);
20
+ this.normalMaterial = new MeshNormalMaterial();
21
+ }
22
+
23
+ dispose() {
24
+ this.rgbRenderTarget.dispose();
25
+ this.normalRenderTarget.dispose();
26
+ this.fsQuad.dispose();
27
+ }
28
+
29
+ setSize(width, height) {
30
+ var _this$rgbRenderTarget, _this$normalRenderTar, _this$fsQuad;
31
+
32
+ this.resolution.set(width, height);
33
+ this.renderResolution.set(width / this.pixelSize | 0, height / this.pixelSize | 0);
34
+ const {
35
+ x,
36
+ y
37
+ } = this.renderResolution;
38
+ (_this$rgbRenderTarget = this.rgbRenderTarget) === null || _this$rgbRenderTarget === void 0 ? void 0 : _this$rgbRenderTarget.setSize(x, y);
39
+ (_this$normalRenderTar = this.normalRenderTarget) === null || _this$normalRenderTar === void 0 ? void 0 : _this$normalRenderTar.setSize(x, y);
40
+ (_this$fsQuad = this.fsQuad) === null || _this$fsQuad === void 0 ? void 0 : _this$fsQuad.material.uniforms.resolution.value.set(x, y, 1 / x, 1 / y);
41
+ }
42
+
43
+ setPixelSize(pixelSize) {
44
+ this.pixelSize = pixelSize;
45
+ this.setSize(this.resolution.x, this.resolution.y);
46
+ }
47
+
48
+ render(renderer, writeBuffer) {
49
+ const uniforms = this.fsQuad.material.uniforms;
50
+ uniforms.normalEdgeStrength.value = this.normalEdgeStrength;
51
+ uniforms.depthEdgeStrength.value = this.depthEdgeStrength;
52
+ renderer.setRenderTarget(this.rgbRenderTarget);
53
+ renderer.render(this.scene, this.camera);
54
+ const overrideMaterial_old = this.scene.overrideMaterial;
55
+ renderer.setRenderTarget(this.normalRenderTarget);
56
+ this.scene.overrideMaterial = this.normalMaterial;
57
+ renderer.render(this.scene, this.camera);
58
+ this.scene.overrideMaterial = overrideMaterial_old;
59
+ uniforms.tDiffuse.value = this.rgbRenderTarget.texture;
60
+ uniforms.tDepth.value = this.rgbRenderTarget.depthTexture;
61
+ uniforms.tNormal.value = this.normalRenderTarget.texture;
62
+
63
+ if (this.renderToScreen) {
64
+ renderer.setRenderTarget(null);
65
+ } else {
66
+ renderer.setRenderTarget(writeBuffer);
67
+ if (this.clear) renderer.clear();
68
+ }
69
+
70
+ this.fsQuad.render(renderer);
71
+ }
72
+
73
+ material() {
74
+ return new ShaderMaterial({
75
+ uniforms: {
76
+ tDiffuse: {
77
+ value: null
78
+ },
79
+ tDepth: {
80
+ value: null
81
+ },
82
+ tNormal: {
83
+ value: null
84
+ },
85
+ resolution: {
86
+ value: new Vector4(this.renderResolution.x, this.renderResolution.y, 1 / this.renderResolution.x, 1 / this.renderResolution.y)
87
+ },
88
+ normalEdgeStrength: {
89
+ value: 0
90
+ },
91
+ depthEdgeStrength: {
92
+ value: 0
93
+ }
94
+ },
95
+ vertexShader: `
96
+ varying vec2 vUv;
97
+
98
+ void main() {
99
+
100
+ vUv = uv;
101
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
102
+
103
+ }
104
+ `,
105
+ fragmentShader: `
106
+ uniform sampler2D tDiffuse;
107
+ uniform sampler2D tDepth;
108
+ uniform sampler2D tNormal;
109
+ uniform vec4 resolution;
110
+ uniform float normalEdgeStrength;
111
+ uniform float depthEdgeStrength;
112
+ varying vec2 vUv;
113
+
114
+ float getDepth(int x, int y) {
115
+
116
+ return texture2D( tDepth, vUv + vec2(x, y) * resolution.zw ).r;
117
+
118
+ }
119
+
120
+ vec3 getNormal(int x, int y) {
121
+
122
+ return texture2D( tNormal, vUv + vec2(x, y) * resolution.zw ).rgb * 2.0 - 1.0;
123
+
124
+ }
125
+
126
+ float depthEdgeIndicator(float depth, vec3 normal) {
127
+
128
+ float diff = 0.0;
129
+ diff += clamp(getDepth(1, 0) - depth, 0.0, 1.0);
130
+ diff += clamp(getDepth(-1, 0) - depth, 0.0, 1.0);
131
+ diff += clamp(getDepth(0, 1) - depth, 0.0, 1.0);
132
+ diff += clamp(getDepth(0, -1) - depth, 0.0, 1.0);
133
+ return floor(smoothstep(0.01, 0.02, diff) * 2.) / 2.;
134
+
135
+ }
136
+
137
+ float neighborNormalEdgeIndicator(int x, int y, float depth, vec3 normal) {
138
+
139
+ float depthDiff = getDepth(x, y) - depth;
140
+ vec3 neighborNormal = getNormal(x, y);
141
+
142
+ // Edge pixels should yield to faces who's normals are closer to the bias normal.
143
+ vec3 normalEdgeBias = vec3(1., 1., 1.); // This should probably be a parameter.
144
+ float normalDiff = dot(normal - neighborNormal, normalEdgeBias);
145
+ float normalIndicator = clamp(smoothstep(-.01, .01, normalDiff), 0.0, 1.0);
146
+
147
+ // Only the shallower pixel should detect the normal edge.
148
+ float depthIndicator = clamp(sign(depthDiff * .25 + .0025), 0.0, 1.0);
149
+
150
+ return (1.0 - dot(normal, neighborNormal)) * depthIndicator * normalIndicator;
151
+
152
+ }
153
+
154
+ float normalEdgeIndicator(float depth, vec3 normal) {
155
+
156
+ float indicator = 0.0;
157
+
158
+ indicator += neighborNormalEdgeIndicator(0, -1, depth, normal);
159
+ indicator += neighborNormalEdgeIndicator(0, 1, depth, normal);
160
+ indicator += neighborNormalEdgeIndicator(-1, 0, depth, normal);
161
+ indicator += neighborNormalEdgeIndicator(1, 0, depth, normal);
162
+
163
+ return step(0.1, indicator);
164
+
165
+ }
166
+
167
+ void main() {
168
+
169
+ vec4 texel = texture2D( tDiffuse, vUv );
170
+
171
+ float depth = 0.0;
172
+ vec3 normal = vec3(0.0);
173
+
174
+ if (depthEdgeStrength > 0.0 || normalEdgeStrength > 0.0) {
175
+
176
+ depth = getDepth(0, 0);
177
+ normal = getNormal(0, 0);
178
+
179
+ }
180
+
181
+ float dei = 0.0;
182
+ if (depthEdgeStrength > 0.0)
183
+ dei = depthEdgeIndicator(depth, normal);
184
+
185
+ float nei = 0.0;
186
+ if (normalEdgeStrength > 0.0)
187
+ nei = normalEdgeIndicator(depth, normal);
188
+
189
+ float Strength = dei > 0.0 ? (1.0 - depthEdgeStrength * dei) : (1.0 + normalEdgeStrength * nei);
190
+
191
+ gl_FragColor = texel * Strength;
192
+
193
+ }
194
+ `
195
+ });
196
+ }
197
+
198
+ }
199
+
200
+ function pixelRenderTarget(resolution, pixelFormat, useDepthTexture) {
201
+ const renderTarget = new WebGLRenderTarget(resolution.x, resolution.y, !useDepthTexture ? undefined : {
202
+ depthTexture: new DepthTexture(resolution.x, resolution.y),
203
+ depthBuffer: true
204
+ });
205
+ renderTarget.texture.format = pixelFormat;
206
+ renderTarget.texture.minFilter = NearestFilter;
207
+ renderTarget.texture.magFilter = NearestFilter;
208
+ renderTarget.texture.generateMipmaps = false;
209
+ renderTarget.stencilBuffer = false;
210
+ return renderTarget;
211
+ }
212
+
213
+ export { RenderPixelatedPass };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t={uniforms:{tDiffuse:{value:null},exposure:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define saturate(a) clamp( a, 0.0, 1.0 )","uniform sampler2D tDiffuse;","uniform float exposure;","varying vec2 vUv;","vec3 RRTAndODTFit( vec3 v ) {","\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;","\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;","\treturn a / b;","}","vec3 ACESFilmicToneMapping( vec3 color ) {","\tconst mat3 ACESInputMat = mat3(","\t\tvec3( 0.59719, 0.07600, 0.02840 ),","\t\tvec3( 0.35458, 0.90834, 0.13383 ),","\t\tvec3( 0.04823, 0.01566, 0.83777 )","\t);","\tconst mat3 ACESOutputMat = mat3(","\t\tvec3( 1.60475, -0.10208, -0.00327 ),","\t\tvec3( -0.53108, 1.10813, -0.07276 ),","\t\tvec3( -0.07367, -0.00605, 1.07602 )","\t);","\tcolor = ACESInputMat * color;","\tcolor = RRTAndODTFit( color );","\tcolor = ACESOutputMat * color;","\treturn saturate( color );","}","void main() {","\tvec4 tex = texture2D( tDiffuse, vUv );","\ttex.rgb *= exposure / 0.6;","\tgl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );","}"].join("\n")};exports.ACESFilmicToneMappingShader=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={uniforms:{tDiffuse:{value:null},exposure:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define saturate(a) clamp( a, 0.0, 1.0 )","uniform sampler2D tDiffuse;","uniform float exposure;","varying vec2 vUv;","vec3 RRTAndODTFit( vec3 v ) {","\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;","\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;","\treturn a / b;","}","vec3 ACESFilmicToneMapping( vec3 color ) {","\tconst mat3 ACESInputMat = mat3(","\t\tvec3( 0.59719, 0.07600, 0.02840 ),","\t\tvec3( 0.35458, 0.90834, 0.13383 ),","\t\tvec3( 0.04823, 0.01566, 0.83777 )","\t);","\tconst mat3 ACESOutputMat = mat3(","\t\tvec3( 1.60475, -0.10208, -0.00327 ),","\t\tvec3( -0.53108, 1.10813, -0.07276 ),","\t\tvec3( -0.07367, -0.00605, 1.07602 )","\t);","\tcolor = ACESInputMat * color;","\tcolor = RRTAndODTFit( color );","\tcolor = ACESOutputMat * color;","\treturn saturate( color );","}","void main() {","\tvec4 tex = texture2D( tDiffuse, vUv );","\ttex.rgb *= exposure / 0.6;","\tgl_FragColor = vec4( ACESFilmicToneMapping( tex.rgb ), tex.a );","}"].join("\n")};exports.ACESFilmicToneMappingShader=t;
@@ -0,0 +1,9 @@
1
+ import type { IUniform, Texture } from 'three';
2
+ import type { IShader } from './types';
3
+ export declare type ACESFilmicToneMappingShaderUniforms = {
4
+ exposure: IUniform<number>;
5
+ tDiffuse: IUniform<Texture | null>;
6
+ };
7
+ export interface IACESFilmicToneMappingShader extends IShader<ACESFilmicToneMappingShaderUniforms> {
8
+ }
9
+ export declare const ACESFilmicToneMappingShader: IACESFilmicToneMappingShader;
@@ -5,7 +5,7 @@
5
5
  * this implementation of ACES is modified to accommodate a brighter viewing environment.
6
6
  * the scale factor of 1/0.6 is subjective. see discussion in #19621.
7
7
  */
8
- var ACESFilmicToneMappingShader = {
8
+ const ACESFilmicToneMappingShader = {
9
9
  uniforms: {
10
10
  tDiffuse: {
11
11
  value: null
@@ -1,16 +1,10 @@
1
- declare const AfterimageShader: {
2
- uniforms: {
3
- damp: {
4
- value: number;
5
- };
6
- tOld: {
7
- value: null;
8
- };
9
- tNew: {
10
- value: null;
11
- };
12
- };
13
- vertexShader: string;
14
- fragmentShader: string;
1
+ import type { IUniform, Texture } from 'three';
2
+ import type { IShader } from './types';
3
+ export declare type AfterimageShaderUniforms = {
4
+ damp: IUniform<number>;
5
+ tNew: IUniform<Texture | null>;
6
+ tOld: IUniform<Texture | null>;
15
7
  };
16
- export { AfterimageShader };
8
+ export interface IAfterimageShader extends IShader<AfterimageShaderUniforms> {
9
+ }
10
+ export declare const AfterimageShader: IAfterimageShader;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={uniforms:{},vertexShader:["void main() {","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["void main() {","\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );","}"].join("\n")};exports.BasicShader=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={uniforms:{},vertexShader:["void main() {","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["void main() {","\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );","}"].join("\n")};exports.BasicShader=e;
@@ -1,5 +1,5 @@
1
- export const BasicShader: {
2
- uniforms: {};
3
- vertexShader: string;
4
- fragmentShader: string;
5
- };
1
+ import type { IShader } from './types';
2
+ export declare type BasicShaderUniforms = {};
3
+ export interface IBasicShader extends IShader<BasicShaderUniforms> {
4
+ }
5
+ export declare const BasicShader: IBasicShader;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Simple test shader
3
3
  */
4
- var BasicShader = {
4
+ const BasicShader = {
5
5
  uniforms: {},
6
6
  vertexShader: ['void main() {', ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\n'),
7
7
  fragmentShader: ['void main() {', ' gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );', '}'].join('\n')
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 base = texture2D( tDiffuse, vUv );","\tvec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );","\tfloat lum = dot( lumCoeff, base.rgb );","\tvec3 blend = vec3( lum );","\tfloat L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );","\tvec3 result1 = 2.0 * base.rgb * blend;","\tvec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );","\tvec3 newColor = mix( result1, result2, L );","\tfloat A2 = opacity * base.a;","\tvec3 mixRGB = A2 * newColor.rgb;","\tmixRGB += ( ( 1.0 - A2 ) * base.rgb );","\tgl_FragColor = vec4( mixRGB, base.a );","}"].join("\n")};exports.BleachBypassShader=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","\tvec4 base = texture2D( tDiffuse, vUv );","\tvec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );","\tfloat lum = dot( lumCoeff, base.rgb );","\tvec3 blend = vec3( lum );","\tfloat L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );","\tvec3 result1 = 2.0 * base.rgb * blend;","\tvec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );","\tvec3 newColor = mix( result1, result2, L );","\tfloat A2 = opacity * base.a;","\tvec3 mixRGB = A2 * newColor.rgb;","\tmixRGB += ( ( 1.0 - A2 ) * base.rgb );","\tgl_FragColor = vec4( mixRGB, base.a );","}"].join("\n")};exports.BleachBypassShader=e;
@@ -1,10 +1,9 @@
1
- import { Uniform } from 'three';
2
-
3
- export const BleachBypassShader: {
4
- uniforms: {
5
- tDiffuse: Uniform;
6
- opacity: Uniform;
7
- };
8
- vertexShader: string;
9
- fragmentShader: string;
1
+ import type { IUniform, Texture } from 'three';
2
+ import type { IShader } from './types';
3
+ export declare type BleachBypassShaderUniforms = {
4
+ opacity: IUniform<number>;
5
+ tDiffuse: IUniform<Texture | null>;
10
6
  };
7
+ export interface IBleachBypassShader extends IShader<BleachBypassShaderUniforms> {
8
+ }
9
+ export declare const BleachBypassShader: IBleachBypassShader;
@@ -3,7 +3,7 @@
3
3
  * - based on Nvidia example
4
4
  * http://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html#post_bleach_bypass
5
5
  */
6
- var BleachBypassShader = {
6
+ const BleachBypassShader = {
7
7
  uniforms: {
8
8
  tDiffuse: {
9
9
  value: null
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e={uniforms:{tDiffuse1:{value:null},tDiffuse2:{value:null},mixRatio:{value:.5},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_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() {","\tvec4 texel1 = texture2D( tDiffuse1, vUv );","\tvec4 texel2 = texture2D( tDiffuse2, vUv );","\tgl_FragColor = opacity * mix( texel1, texel2, mixRatio );","}"].join("\n")};exports.BlendShader=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={uniforms:{tDiffuse1:{value:null},tDiffuse2:{value:null},mixRatio:{value:.5},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_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() {","\tvec4 texel1 = texture2D( tDiffuse1, vUv );","\tvec4 texel2 = texture2D( tDiffuse2, vUv );","\tgl_FragColor = opacity * mix( texel1, texel2, mixRatio );","}"].join("\n")};exports.BlendShader=e;
@@ -1,11 +1,17 @@
1
- import { Uniform } from 'three';
2
-
3
- export const BlendShader: {
1
+ export declare const BlendShader: {
4
2
  uniforms: {
5
- tDiffuse1: Uniform;
6
- tDiffuse2: Uniform;
7
- mixRatio: Uniform;
8
- opacity: Uniform;
3
+ tDiffuse1: {
4
+ value: null;
5
+ };
6
+ tDiffuse2: {
7
+ value: null;
8
+ };
9
+ mixRatio: {
10
+ value: number;
11
+ };
12
+ opacity: {
13
+ value: number;
14
+ };
9
15
  };
10
16
  vertexShader: string;
11
17
  fragmentShader: string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Blend two textures
3
3
  */
4
- var BlendShader = {
4
+ const BlendShader = {
5
5
  uniforms: {
6
6
  tDiffuse1: {
7
7
  value: null
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t={defines:{DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tColor:{value:null},tDepth:{value:null},focus:{value:1},aspect:{value:1},aperture:{value:.025},maxblur:{value:.01},nearClip:{value:1},farClip:{value:1e3}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","varying vec2 vUv;","uniform sampler2D tColor;","uniform sampler2D tDepth;","uniform float maxblur;","uniform float aperture;","uniform float nearClip;","uniform float farClip;","uniform float focus;","uniform float aspect;","#include <packing>","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, nearClip, farClip );","\t#else","\treturn orthographicDepthToViewZ( depth, nearClip, farClip );","\t#endif","}","void main() {","\tvec2 aspectcorrect = vec2( 1.0, aspect );","\tfloat viewZ = getViewZ( getDepth( vUv ) );","\tfloat factor = ( focus + viewZ );","\tvec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );","\tvec2 dofblur9 = dofblur * 0.9;","\tvec2 dofblur7 = dofblur * 0.7;","\tvec2 dofblur4 = dofblur * 0.4;","\tvec4 col = vec4( 0.0 );","\tcol += texture2D( tColor, vUv.xy );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );","\tgl_FragColor = col / 41.0;","\tgl_FragColor.a = 1.0;","}"].join("\n")};exports.BokehShader=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={defines:{DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tColor:{value:null},tDepth:{value:null},focus:{value:1},aspect:{value:1},aperture:{value:.025},maxblur:{value:.01},nearClip:{value:1},farClip:{value:1e3}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","varying vec2 vUv;","uniform sampler2D tColor;","uniform sampler2D tDepth;","uniform float maxblur;","uniform float aperture;","uniform float nearClip;","uniform float farClip;","uniform float focus;","uniform float aspect;","#include <packing>","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, nearClip, farClip );","\t#else","\treturn orthographicDepthToViewZ( depth, nearClip, farClip );","\t#endif","}","void main() {","\tvec2 aspectcorrect = vec2( 1.0, aspect );","\tfloat viewZ = getViewZ( getDepth( vUv ) );","\tfloat factor = ( focus + viewZ );","\tvec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );","\tvec2 dofblur9 = dofblur * 0.9;","\tvec2 dofblur7 = dofblur * 0.7;","\tvec2 dofblur4 = dofblur * 0.4;","\tvec4 col = vec4( 0.0 );","\tcol += texture2D( tColor, vUv.xy );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, 0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, 0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, -0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.15, 0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.37, 0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.15, -0.37 ) * aspectcorrect ) * dofblur9 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.40, 0.0 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur7 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, 0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.4, 0.0 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.29, -0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, -0.4 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, 0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.4, 0.0 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );","\tcol += texture2D( tColor, vUv.xy + ( vec2( 0.0, 0.4 ) * aspectcorrect ) * dofblur4 );","\tgl_FragColor = col / 41.0;","\tgl_FragColor.a = 1.0;","}"].join("\n")};exports.BokehShader=t;
@@ -1,20 +1,19 @@
1
- import { Uniform } from 'three';
2
-
3
- export const BokehShader: {
4
- defines: {
5
- DEPTH_PACKING: number;
6
- PERSPECTIVE_CAMERA: number;
7
- };
8
- uniforms: {
9
- tColor: Uniform;
10
- tDepth: Uniform;
11
- focus: Uniform;
12
- aspect: Uniform;
13
- aperture: Uniform;
14
- maxblur: Uniform;
15
- nearClip: Uniform;
16
- farClip: Uniform;
17
- };
18
- vertexShader: string;
19
- fragmentShader: string;
1
+ import type { IUniform, Texture } from 'three';
2
+ import type { IShader } from './types';
3
+ export declare type BokehShaderDefines = {
4
+ DEPTH_PACKING: number;
5
+ PERSPECTIVE_CAMERA: number;
20
6
  };
7
+ export declare type BokehShaderUniforms = {
8
+ aperture: IUniform<number>;
9
+ aspect: IUniform<number>;
10
+ farClip: IUniform<number>;
11
+ focus: IUniform<number>;
12
+ maxblur: IUniform<number>;
13
+ nearClip: IUniform<number>;
14
+ tColor: IUniform<Texture | null>;
15
+ tDepth: IUniform<Texture | null>;
16
+ };
17
+ export interface IBokehShader extends IShader<BokehShaderUniforms, BokehShaderDefines> {
18
+ }
19
+ export declare const BokehShader: IBokehShader;
@@ -3,7 +3,7 @@
3
3
  * ported from GLSL shader by Martins Upitis
4
4
  * http://artmartinsh.blogspot.com/2010/02/glsl-lens-blur-filter-with-bokeh.html
5
5
  */
6
- var BokehShader = {
6
+ const BokehShader = {
7
7
  defines: {
8
8
  DEPTH_PACKING: 1,
9
9
  PERSPECTIVE_CAMERA: 1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t={uniforms:{textureWidth:{value:1},textureHeight:{value:1},focalDepth:{value:1},focalLength:{value:24},fstop:{value:.9},tColor:{value:null},tDepth:{value:null},maxblur:{value:1},showFocus:{value:0},manualdof:{value:0},vignetting:{value:0},depthblur:{value:0},threshold:{value:.5},gain:{value:2},bias:{value:.5},fringe:{value:.7},znear:{value:.1},zfar:{value:100},noise:{value:1},dithering:{value:1e-4},pentagon:{value:0},shaderFocus:{value:1},focusCoords:{value:new(require("three").Vector2)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),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) {","\t//pentagonal shape","\tfloat scale = float(rings) - 1.3;","\tvec4 HS0 = vec4( 1.0, 0.0, 0.0, 1.0);","\tvec4 HS1 = vec4( 0.309016994, 0.951056516, 0.0, 1.0);","\tvec4 HS2 = vec4(-0.809016994, 0.587785252, 0.0, 1.0);","\tvec4 HS3 = vec4(-0.809016994,-0.587785252, 0.0, 1.0);","\tvec4 HS4 = vec4( 0.309016994,-0.951056516, 0.0, 1.0);","\tvec4 HS5 = vec4( 0.0 ,0.0 , 1.0, 1.0);","\tvec4 one = vec4( 1.0 );","\tvec4 P = vec4((coords),vec2(scale, scale));","\tvec4 dist = vec4(0.0);","\tfloat inorout = -4.0;","\tdist.x = dot( P, HS0 );","\tdist.y = dot( P, HS1 );","\tdist.z = dot( P, HS2 );","\tdist.w = dot( P, HS3 );","\tdist = smoothstep( -feather, feather, dist );","\tinorout += dot( dist, one );","\tdist.x = dot( P, HS4 );","\tdist.y = HS5.w - abs( P.z );","\tdist = smoothstep( -feather, feather, dist );","\tinorout += dist.x;","\treturn clamp( inorout, 0.0, 1.0 );","}","float bdepth(vec2 coords) {","\t// Depth buffer blur","\tfloat d = 0.0;","\tfloat kernel[9];","\tvec2 offset[9];","\tvec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;","\toffset[0] = vec2(-wh.x,-wh.y);","\toffset[1] = vec2( 0.0, -wh.y);","\toffset[2] = vec2( wh.x -wh.y);","\toffset[3] = vec2(-wh.x, 0.0);","\toffset[4] = vec2( 0.0, 0.0);","\toffset[5] = vec2( wh.x, 0.0);","\toffset[6] = vec2(-wh.x, wh.y);","\toffset[7] = vec2( 0.0, wh.y);","\toffset[8] = vec2( wh.x, wh.y);","\tkernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0;","\tkernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0;","\tkernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0;","\tfor( int i=0; i<9; i++ ) {","\t\tfloat tmp = texture2D(tDepth, coords + offset[i]).r;","\t\td += tmp * kernel[i];","\t}","\treturn d;","}","vec3 color(vec2 coords,float blur) {","\t//processing the sample","\tvec3 col = vec3(0.0);","\tvec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);","\tcol.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;","\tcol.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;","\tcol.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;","\tvec3 lumcoeff = vec3(0.299,0.587,0.114);","\tfloat lum = dot(col.rgb, lumcoeff);","\tfloat thresh = max((lum-threshold)*gain, 0.0);","\treturn col+mix(vec3(0.0),col,thresh*blur);","}","vec3 debugFocus(vec3 col, float blur, float depth) {","\tfloat edge = 0.002*depth; //distance based edge smoothing","\tfloat m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);","\tfloat e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);","\tcol = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);","\tcol = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);","\treturn col;","}","float linearize(float depth) {","\treturn -zfar * znear / (depth * (zfar - znear) - zfar);","}","float vignette() {","\tfloat dist = distance(vUv.xy, vec2(0.5,0.5));","\tdist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);","\treturn clamp(dist,0.0,1.0);","}","float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {","\tfloat rings2 = float(rings);","\tfloat step = PI*2.0 / float(ringsamples);","\tfloat pw = cos(j*step)*i;","\tfloat ph = sin(j*step)*i;","\tfloat p = 1.0;","\tif (pentagon) {","\t\tp = penta(vec2(pw,ph));","\t}","\tcol += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;","\treturn 1.0 * mix(1.0, i /rings2, bias) * p;","}","void main() {","\t//scene depth calculation","\tfloat depth = linearize(texture2D(tDepth,vUv.xy).x);","\t// Blur depth?","\tif ( depthblur ) {","\t\tdepth = linearize(bdepth(vUv.xy));","\t}","\t//focal plane calculation","\tfloat fDepth = focalDepth;","\tif (shaderFocus) {","\t\tfDepth = linearize(texture2D(tDepth,focusCoords).x);","\t}","\t// dof blur factor calculation","\tfloat blur = 0.0;","\tif (manualdof) {","\t\tfloat a = depth-fDepth; // Focal plane","\t\tfloat b = (a-fdofstart)/fdofdist; // Far DoF","\t\tfloat c = (-a-ndofstart)/ndofdist; // Near Dof","\t\tblur = (a>0.0) ? b : c;","\t} else {","\t\tfloat f = focalLength; // focal length in mm","\t\tfloat d = fDepth*1000.0; // focal plane in mm","\t\tfloat o = depth*1000.0; // depth in mm","\t\tfloat a = (o*f)/(o-f);","\t\tfloat b = (d*f)/(d-f);","\t\tfloat c = (d-f)/(d*fstop*CoC);","\t\tblur = abs(a-b)*c;","\t}","\tblur = clamp(blur,0.0,1.0);","\t// calculation of pattern for dithering","\tvec2 noise = vec2(rand(vUv.xy), rand( vUv.xy + vec2( 0.4, 0.6 ) ) )*dithering*blur;","\t// getting blur x and y step factor","\tfloat w = (1.0/textureWidth)*blur*maxblur+noise.x;","\tfloat h = (1.0/textureHeight)*blur*maxblur+noise.y;","\t// calculation of final color","\tvec3 col = vec3(0.0);","\tif(blur < 0.05) {","\t\t//some optimization thingy","\t\tcol = texture2D(tColor, vUv.xy).rgb;","\t} else {","\t\tcol = texture2D(tColor, vUv.xy).rgb;","\t\tfloat s = 1.0;","\t\tint ringsamples;","\t\tfor (int i = 1; i <= rings; i++) {","\t\t\t/*unboxstart*/","\t\t\tringsamples = i * samples;","\t\t\tfor (int j = 0 ; j < maxringsamples ; j++) {","\t\t\t\tif (j >= ringsamples) break;","\t\t\t\ts += gather(float(i), float(j), ringsamples, col, w, h, blur);","\t\t\t}","\t\t\t/*unboxend*/","\t\t}","\t\tcol /= s; //divide by sample count","\t}","\tif (showFocus) {","\t\tcol = debugFocus(col, blur, depth);","\t}","\tif (vignetting) {","\t\tcol *= vignette();","\t}","\tgl_FragColor.rgb = col;","\tgl_FragColor.a = 1.0;","} "].join("\n")},e={uniforms:{mNear:{value:1},mFar:{value:1e3}},vertexShader:["varying float vViewZDepth;","void main() {","\t#include <begin_vertex>","\t#include <project_vertex>","\tvViewZDepth = - mvPosition.z;","}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","varying float vViewZDepth;","void main() {","\tfloat color = 1.0 - smoothstep( mNear, mFar, vViewZDepth );","\tgl_FragColor = vec4( vec3( color ), 1.0 );","} "].join("\n")};exports.BokehDepthShader=e,exports.BokehShader2=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t={uniforms:{textureWidth:{value:1},textureHeight:{value:1},focalDepth:{value:1},focalLength:{value:24},fstop:{value:.9},tColor:{value:null},tDepth:{value:null},maxblur:{value:1},showFocus:{value:0},manualdof:{value:0},vignetting:{value:0},depthblur:{value:0},threshold:{value:.5},gain:{value:2},bias:{value:.5},fringe:{value:.7},znear:{value:.1},zfar:{value:100},noise:{value:1},dithering:{value:1e-4},pentagon:{value:0},shaderFocus:{value:1},focusCoords:{value:new(require("three").Vector2)}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),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) {","\t//pentagonal shape","\tfloat scale = float(rings) - 1.3;","\tvec4 HS0 = vec4( 1.0, 0.0, 0.0, 1.0);","\tvec4 HS1 = vec4( 0.309016994, 0.951056516, 0.0, 1.0);","\tvec4 HS2 = vec4(-0.809016994, 0.587785252, 0.0, 1.0);","\tvec4 HS3 = vec4(-0.809016994,-0.587785252, 0.0, 1.0);","\tvec4 HS4 = vec4( 0.309016994,-0.951056516, 0.0, 1.0);","\tvec4 HS5 = vec4( 0.0 ,0.0 , 1.0, 1.0);","\tvec4 one = vec4( 1.0 );","\tvec4 P = vec4((coords),vec2(scale, scale));","\tvec4 dist = vec4(0.0);","\tfloat inorout = -4.0;","\tdist.x = dot( P, HS0 );","\tdist.y = dot( P, HS1 );","\tdist.z = dot( P, HS2 );","\tdist.w = dot( P, HS3 );","\tdist = smoothstep( -feather, feather, dist );","\tinorout += dot( dist, one );","\tdist.x = dot( P, HS4 );","\tdist.y = HS5.w - abs( P.z );","\tdist = smoothstep( -feather, feather, dist );","\tinorout += dist.x;","\treturn clamp( inorout, 0.0, 1.0 );","}","float bdepth(vec2 coords) {","\t// Depth buffer blur","\tfloat d = 0.0;","\tfloat kernel[9];","\tvec2 offset[9];","\tvec2 wh = vec2(1.0/textureWidth,1.0/textureHeight) * dbsize;","\toffset[0] = vec2(-wh.x,-wh.y);","\toffset[1] = vec2( 0.0, -wh.y);","\toffset[2] = vec2( wh.x -wh.y);","\toffset[3] = vec2(-wh.x, 0.0);","\toffset[4] = vec2( 0.0, 0.0);","\toffset[5] = vec2( wh.x, 0.0);","\toffset[6] = vec2(-wh.x, wh.y);","\toffset[7] = vec2( 0.0, wh.y);","\toffset[8] = vec2( wh.x, wh.y);","\tkernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0;","\tkernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0;","\tkernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0;","\tfor( int i=0; i<9; i++ ) {","\t\tfloat tmp = texture2D(tDepth, coords + offset[i]).r;","\t\td += tmp * kernel[i];","\t}","\treturn d;","}","vec3 color(vec2 coords,float blur) {","\t//processing the sample","\tvec3 col = vec3(0.0);","\tvec2 texel = vec2(1.0/textureWidth,1.0/textureHeight);","\tcol.r = texture2D(tColor,coords + vec2(0.0,1.0)*texel*fringe*blur).r;","\tcol.g = texture2D(tColor,coords + vec2(-0.866,-0.5)*texel*fringe*blur).g;","\tcol.b = texture2D(tColor,coords + vec2(0.866,-0.5)*texel*fringe*blur).b;","\tvec3 lumcoeff = vec3(0.299,0.587,0.114);","\tfloat lum = dot(col.rgb, lumcoeff);","\tfloat thresh = max((lum-threshold)*gain, 0.0);","\treturn col+mix(vec3(0.0),col,thresh*blur);","}","vec3 debugFocus(vec3 col, float blur, float depth) {","\tfloat edge = 0.002*depth; //distance based edge smoothing","\tfloat m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);","\tfloat e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);","\tcol = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);","\tcol = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);","\treturn col;","}","float linearize(float depth) {","\treturn -zfar * znear / (depth * (zfar - znear) - zfar);","}","float vignette() {","\tfloat dist = distance(vUv.xy, vec2(0.5,0.5));","\tdist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);","\treturn clamp(dist,0.0,1.0);","}","float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {","\tfloat rings2 = float(rings);","\tfloat step = PI*2.0 / float(ringsamples);","\tfloat pw = cos(j*step)*i;","\tfloat ph = sin(j*step)*i;","\tfloat p = 1.0;","\tif (pentagon) {","\t\tp = penta(vec2(pw,ph));","\t}","\tcol += color(vUv.xy + vec2(pw*w,ph*h), blur) * mix(1.0, i/rings2, bias) * p;","\treturn 1.0 * mix(1.0, i /rings2, bias) * p;","}","void main() {","\t//scene depth calculation","\tfloat depth = linearize(texture2D(tDepth,vUv.xy).x);","\t// Blur depth?","\tif ( depthblur ) {","\t\tdepth = linearize(bdepth(vUv.xy));","\t}","\t//focal plane calculation","\tfloat fDepth = focalDepth;","\tif (shaderFocus) {","\t\tfDepth = linearize(texture2D(tDepth,focusCoords).x);","\t}","\t// dof blur factor calculation","\tfloat blur = 0.0;","\tif (manualdof) {","\t\tfloat a = depth-fDepth; // Focal plane","\t\tfloat b = (a-fdofstart)/fdofdist; // Far DoF","\t\tfloat c = (-a-ndofstart)/ndofdist; // Near Dof","\t\tblur = (a>0.0) ? b : c;","\t} else {","\t\tfloat f = focalLength; // focal length in mm","\t\tfloat d = fDepth*1000.0; // focal plane in mm","\t\tfloat o = depth*1000.0; // depth in mm","\t\tfloat a = (o*f)/(o-f);","\t\tfloat b = (d*f)/(d-f);","\t\tfloat c = (d-f)/(d*fstop*CoC);","\t\tblur = abs(a-b)*c;","\t}","\tblur = clamp(blur,0.0,1.0);","\t// calculation of pattern for dithering","\tvec2 noise = vec2(rand(vUv.xy), rand( vUv.xy + vec2( 0.4, 0.6 ) ) )*dithering*blur;","\t// getting blur x and y step factor","\tfloat w = (1.0/textureWidth)*blur*maxblur+noise.x;","\tfloat h = (1.0/textureHeight)*blur*maxblur+noise.y;","\t// calculation of final color","\tvec3 col = vec3(0.0);","\tif(blur < 0.05) {","\t\t//some optimization thingy","\t\tcol = texture2D(tColor, vUv.xy).rgb;","\t} else {","\t\tcol = texture2D(tColor, vUv.xy).rgb;","\t\tfloat s = 1.0;","\t\tint ringsamples;","\t\tfor (int i = 1; i <= rings; i++) {","\t\t\t/*unboxstart*/","\t\t\tringsamples = i * samples;","\t\t\tfor (int j = 0 ; j < maxringsamples ; j++) {","\t\t\t\tif (j >= ringsamples) break;","\t\t\t\ts += gather(float(i), float(j), ringsamples, col, w, h, blur);","\t\t\t}","\t\t\t/*unboxend*/","\t\t}","\t\tcol /= s; //divide by sample count","\t}","\tif (showFocus) {","\t\tcol = debugFocus(col, blur, depth);","\t}","\tif (vignetting) {","\t\tcol *= vignette();","\t}","\tgl_FragColor.rgb = col;","\tgl_FragColor.a = 1.0;","} "].join("\n")},e={uniforms:{mNear:{value:1},mFar:{value:1e3}},vertexShader:["varying float vViewZDepth;","void main() {","\t#include <begin_vertex>","\t#include <project_vertex>","\tvViewZDepth = - mvPosition.z;","}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","varying float vViewZDepth;","void main() {","\tfloat color = 1.0 - smoothstep( mNear, mFar, vViewZDepth );","\tgl_FragColor = vec4( vec3( color ), 1.0 );","} "].join("\n")};exports.BokehDepthShader=e,exports.BokehShader2=t;
@@ -1,41 +1,87 @@
1
- import { Uniform } from 'three';
2
-
3
- export interface BokehShaderUniforms {
4
- textureWidth: Uniform;
5
- textureHeight: Uniform;
6
- focalDepth: Uniform;
7
- focalLength: Uniform;
8
- fstop: Uniform;
9
- tColor: Uniform;
10
- tDepth: Uniform;
11
- maxblur: Uniform;
12
- showFocus: Uniform;
13
- manualdof: Uniform;
14
- vignetting: Uniform;
15
- depthblur: Uniform;
16
- threshold: Uniform;
17
- gain: Uniform;
18
- bias: Uniform;
19
- fringe: Uniform;
20
- znear: Uniform;
21
- zfar: Uniform;
22
- noise: Uniform;
23
- dithering: Uniform;
24
- pentagon: Uniform;
25
- shaderFocus: Uniform;
26
- focusCoords: Uniform;
27
- }
28
-
29
- export const BokehShader: {
30
- uniforms: BokehShaderUniforms;
1
+ import { Vector2 } from 'three';
2
+ export declare const BokehShader2: {
3
+ uniforms: {
4
+ textureWidth: {
5
+ value: number;
6
+ };
7
+ textureHeight: {
8
+ value: number;
9
+ };
10
+ focalDepth: {
11
+ value: number;
12
+ };
13
+ focalLength: {
14
+ value: number;
15
+ };
16
+ fstop: {
17
+ value: number;
18
+ };
19
+ tColor: {
20
+ value: null;
21
+ };
22
+ tDepth: {
23
+ value: null;
24
+ };
25
+ maxblur: {
26
+ value: number;
27
+ };
28
+ showFocus: {
29
+ value: number;
30
+ };
31
+ manualdof: {
32
+ value: number;
33
+ };
34
+ vignetting: {
35
+ value: number;
36
+ };
37
+ depthblur: {
38
+ value: number;
39
+ };
40
+ threshold: {
41
+ value: number;
42
+ };
43
+ gain: {
44
+ value: number;
45
+ };
46
+ bias: {
47
+ value: number;
48
+ };
49
+ fringe: {
50
+ value: number;
51
+ };
52
+ znear: {
53
+ value: number;
54
+ };
55
+ zfar: {
56
+ value: number;
57
+ };
58
+ noise: {
59
+ value: number;
60
+ };
61
+ dithering: {
62
+ value: number;
63
+ };
64
+ pentagon: {
65
+ value: number;
66
+ };
67
+ shaderFocus: {
68
+ value: number;
69
+ };
70
+ focusCoords: {
71
+ value: Vector2;
72
+ };
73
+ };
31
74
  vertexShader: string;
32
75
  fragmentShader: string;
33
76
  };
34
-
35
- export const BokehDepthShader: {
77
+ export declare const BokehDepthShader: {
36
78
  uniforms: {
37
- mNear: Uniform;
38
- mFar: Uniform;
79
+ mNear: {
80
+ value: number;
81
+ };
82
+ mFar: {
83
+ value: number;
84
+ };
39
85
  };
40
86
  vertexShader: string;
41
87
  fragmentShader: string;