@react-three/postprocessing 2.18.0 → 3.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +81 -81
  3. package/dist/index.d.ts +1 -38
  4. package/dist/index.js +554 -88
  5. package/dist/index.js.map +1 -1
  6. package/package.json +69 -96
  7. package/src/EffectComposer.test.tsx +126 -0
  8. package/src/EffectComposer.tsx +202 -0
  9. package/src/Selection.tsx +46 -0
  10. package/src/effects/ASCII.tsx +135 -0
  11. package/src/effects/Autofocus.tsx +153 -0
  12. package/src/effects/Bloom.tsx +6 -0
  13. package/src/effects/BrightnessContrast.tsx +4 -0
  14. package/src/effects/ChromaticAberration.tsx +5 -0
  15. package/src/effects/ColorAverage.tsx +15 -0
  16. package/src/effects/ColorDepth.tsx +4 -0
  17. package/src/effects/Depth.tsx +4 -0
  18. package/src/effects/DepthOfField.tsx +89 -0
  19. package/src/effects/DotScreen.tsx +4 -0
  20. package/src/effects/FXAA.tsx +4 -0
  21. package/src/effects/Glitch.tsx +40 -0
  22. package/src/effects/GodRays.tsx +16 -0
  23. package/src/effects/Grid.tsx +21 -0
  24. package/src/effects/HueSaturation.tsx +4 -0
  25. package/src/effects/LUT.tsx +26 -0
  26. package/src/effects/LensFlare.tsx +611 -0
  27. package/src/effects/N8AO.tsx +81 -0
  28. package/src/effects/Noise.tsx +4 -0
  29. package/src/effects/Outline.tsx +117 -0
  30. package/src/effects/Pixelation.tsx +15 -0
  31. package/{dist/effects/Ramp.js → src/effects/Ramp.tsx} +150 -156
  32. package/src/effects/SMAA.tsx +4 -0
  33. package/src/effects/SSAO.tsx +41 -0
  34. package/src/effects/ScanlineEffect.tsx +7 -0
  35. package/src/effects/SelectiveBloom.tsx +126 -0
  36. package/src/effects/Sepia.tsx +4 -0
  37. package/src/effects/ShockWave.tsx +4 -0
  38. package/src/effects/Texture.tsx +23 -0
  39. package/src/effects/TiltShift.tsx +4 -0
  40. package/{dist/effects/TiltShift2.js → src/effects/TiltShift2.tsx} +90 -98
  41. package/src/effects/ToneMapping.tsx +6 -0
  42. package/src/effects/Vignette.tsx +4 -0
  43. package/{dist/effects/Water.js → src/effects/Water.tsx} +35 -38
  44. package/src/index.ts +40 -0
  45. package/src/util.tsx +55 -0
  46. package/dist/EffectComposer.cjs +0 -137
  47. package/dist/EffectComposer.cjs.map +0 -1
  48. package/dist/EffectComposer.d.ts +0 -27
  49. package/dist/EffectComposer.js +0 -137
  50. package/dist/EffectComposer.js.map +0 -1
  51. package/dist/EffectComposer.test.d.ts +0 -4
  52. package/dist/Selection.cjs +0 -36
  53. package/dist/Selection.cjs.map +0 -1
  54. package/dist/Selection.d.ts +0 -16
  55. package/dist/Selection.js +0 -36
  56. package/dist/Selection.js.map +0 -1
  57. package/dist/compat.cjs +0 -77
  58. package/dist/compat.cjs.map +0 -1
  59. package/dist/compat.js +0 -60
  60. package/dist/compat.js.map +0 -1
  61. package/dist/effects/ASCII.cjs +0 -113
  62. package/dist/effects/ASCII.cjs.map +0 -1
  63. package/dist/effects/ASCII.d.ts +0 -17
  64. package/dist/effects/ASCII.js +0 -113
  65. package/dist/effects/ASCII.js.map +0 -1
  66. package/dist/effects/Autofocus.cjs +0 -126
  67. package/dist/effects/Autofocus.cjs.map +0 -1
  68. package/dist/effects/Autofocus.d.ts +0 -22
  69. package/dist/effects/Autofocus.js +0 -109
  70. package/dist/effects/Autofocus.js.map +0 -1
  71. package/dist/effects/Bloom.cjs +0 -9
  72. package/dist/effects/Bloom.cjs.map +0 -1
  73. package/dist/effects/Bloom.d.ts +0 -6
  74. package/dist/effects/Bloom.js +0 -9
  75. package/dist/effects/Bloom.js.map +0 -1
  76. package/dist/effects/BrightnessContrast.cjs +0 -7
  77. package/dist/effects/BrightnessContrast.cjs.map +0 -1
  78. package/dist/effects/BrightnessContrast.d.ts +0 -10
  79. package/dist/effects/BrightnessContrast.js +0 -7
  80. package/dist/effects/BrightnessContrast.js.map +0 -1
  81. package/dist/effects/ChromaticAberration.cjs +0 -7
  82. package/dist/effects/ChromaticAberration.cjs.map +0 -1
  83. package/dist/effects/ChromaticAberration.d.ts +0 -13
  84. package/dist/effects/ChromaticAberration.js +0 -7
  85. package/dist/effects/ChromaticAberration.js.map +0 -1
  86. package/dist/effects/ColorAverage.cjs +0 -11
  87. package/dist/effects/ColorAverage.cjs.map +0 -1
  88. package/dist/effects/ColorAverage.d.ts +0 -8
  89. package/dist/effects/ColorAverage.js +0 -11
  90. package/dist/effects/ColorAverage.js.map +0 -1
  91. package/dist/effects/ColorDepth.cjs +0 -7
  92. package/dist/effects/ColorDepth.cjs.map +0 -1
  93. package/dist/effects/ColorDepth.d.ts +0 -9
  94. package/dist/effects/ColorDepth.js +0 -7
  95. package/dist/effects/ColorDepth.js.map +0 -1
  96. package/dist/effects/Depth.cjs +0 -7
  97. package/dist/effects/Depth.cjs.map +0 -1
  98. package/dist/effects/Depth.d.ts +0 -9
  99. package/dist/effects/Depth.js +0 -7
  100. package/dist/effects/Depth.js.map +0 -1
  101. package/dist/effects/DepthOfField.cjs +0 -74
  102. package/dist/effects/DepthOfField.cjs.map +0 -1
  103. package/dist/effects/DepthOfField.d.ts +0 -25
  104. package/dist/effects/DepthOfField.js +0 -74
  105. package/dist/effects/DepthOfField.js.map +0 -1
  106. package/dist/effects/DotScreen.cjs +0 -7
  107. package/dist/effects/DotScreen.cjs.map +0 -1
  108. package/dist/effects/DotScreen.d.ts +0 -10
  109. package/dist/effects/DotScreen.js +0 -7
  110. package/dist/effects/DotScreen.js.map +0 -1
  111. package/dist/effects/FXAA.cjs +0 -7
  112. package/dist/effects/FXAA.cjs.map +0 -1
  113. package/dist/effects/FXAA.d.ts +0 -8
  114. package/dist/effects/FXAA.js +0 -7
  115. package/dist/effects/FXAA.js.map +0 -1
  116. package/dist/effects/Glitch.cjs +0 -31
  117. package/dist/effects/Glitch.cjs.map +0 -1
  118. package/dist/effects/Glitch.d.ts +0 -30
  119. package/dist/effects/Glitch.js +0 -31
  120. package/dist/effects/Glitch.js.map +0 -1
  121. package/dist/effects/GodRays.cjs +0 -15
  122. package/dist/effects/GodRays.cjs.map +0 -1
  123. package/dist/effects/GodRays.d.ts +0 -21
  124. package/dist/effects/GodRays.js +0 -15
  125. package/dist/effects/GodRays.js.map +0 -1
  126. package/dist/effects/Grid.cjs +0 -18
  127. package/dist/effects/Grid.cjs.map +0 -1
  128. package/dist/effects/Grid.d.ts +0 -12
  129. package/dist/effects/Grid.js +0 -18
  130. package/dist/effects/Grid.js.map +0 -1
  131. package/dist/effects/HueSaturation.cjs +0 -7
  132. package/dist/effects/HueSaturation.cjs.map +0 -1
  133. package/dist/effects/HueSaturation.d.ts +0 -10
  134. package/dist/effects/HueSaturation.js +0 -7
  135. package/dist/effects/HueSaturation.js.map +0 -1
  136. package/dist/effects/LUT.cjs +0 -20
  137. package/dist/effects/LUT.cjs.map +0 -1
  138. package/dist/effects/LUT.d.ts +0 -9
  139. package/dist/effects/LUT.js +0 -20
  140. package/dist/effects/LUT.js.map +0 -1
  141. package/dist/effects/LensFlare.cjs +0 -189
  142. package/dist/effects/LensFlare.cjs.map +0 -1
  143. package/dist/effects/LensFlare.d.ts +0 -52
  144. package/dist/effects/LensFlare.js +0 -172
  145. package/dist/effects/LensFlare.js.map +0 -1
  146. package/dist/effects/N8AO/BlueNoise.cjs +0 -4
  147. package/dist/effects/N8AO/BlueNoise.cjs.map +0 -1
  148. package/dist/effects/N8AO/BlueNoise.js +0 -5
  149. package/dist/effects/N8AO/BlueNoise.js.map +0 -1
  150. package/dist/effects/N8AO/DepthDownSample.cjs +0 -183
  151. package/dist/effects/N8AO/DepthDownSample.cjs.map +0 -1
  152. package/dist/effects/N8AO/DepthDownSample.js +0 -166
  153. package/dist/effects/N8AO/DepthDownSample.js.map +0 -1
  154. package/dist/effects/N8AO/EffectCompositer.cjs +0 -278
  155. package/dist/effects/N8AO/EffectCompositer.cjs.map +0 -1
  156. package/dist/effects/N8AO/EffectCompositer.js +0 -261
  157. package/dist/effects/N8AO/EffectCompositer.js.map +0 -1
  158. package/dist/effects/N8AO/EffectShader.cjs +0 -236
  159. package/dist/effects/N8AO/EffectShader.cjs.map +0 -1
  160. package/dist/effects/N8AO/EffectShader.js +0 -219
  161. package/dist/effects/N8AO/EffectShader.js.map +0 -1
  162. package/dist/effects/N8AO/FullScreenTriangle.cjs +0 -59
  163. package/dist/effects/N8AO/FullScreenTriangle.cjs.map +0 -1
  164. package/dist/effects/N8AO/FullScreenTriangle.js +0 -42
  165. package/dist/effects/N8AO/FullScreenTriangle.js.map +0 -1
  166. package/dist/effects/N8AO/N8AOPostPass.cjs +0 -502
  167. package/dist/effects/N8AO/N8AOPostPass.cjs.map +0 -1
  168. package/dist/effects/N8AO/N8AOPostPass.js +0 -485
  169. package/dist/effects/N8AO/N8AOPostPass.js.map +0 -1
  170. package/dist/effects/N8AO/PoissionBlur.cjs +0 -186
  171. package/dist/effects/N8AO/PoissionBlur.cjs.map +0 -1
  172. package/dist/effects/N8AO/PoissionBlur.js +0 -169
  173. package/dist/effects/N8AO/PoissionBlur.js.map +0 -1
  174. package/dist/effects/N8AO/index.cjs +0 -60
  175. package/dist/effects/N8AO/index.cjs.map +0 -1
  176. package/dist/effects/N8AO/index.d.ts +0 -18
  177. package/dist/effects/N8AO/index.js +0 -60
  178. package/dist/effects/N8AO/index.js.map +0 -1
  179. package/dist/effects/Noise.cjs +0 -7
  180. package/dist/effects/Noise.cjs.map +0 -1
  181. package/dist/effects/Noise.d.ts +0 -9
  182. package/dist/effects/Noise.js +0 -7
  183. package/dist/effects/Noise.js.map +0 -1
  184. package/dist/effects/Outline.cjs +0 -100
  185. package/dist/effects/Outline.cjs.map +0 -1
  186. package/dist/effects/Outline.d.ts +0 -30
  187. package/dist/effects/Outline.js +0 -100
  188. package/dist/effects/Outline.js.map +0 -1
  189. package/dist/effects/Pixelation.cjs +0 -11
  190. package/dist/effects/Pixelation.cjs.map +0 -1
  191. package/dist/effects/Pixelation.d.ts +0 -6
  192. package/dist/effects/Pixelation.js +0 -11
  193. package/dist/effects/Pixelation.js.map +0 -1
  194. package/dist/effects/Ramp.cjs +0 -156
  195. package/dist/effects/Ramp.cjs.map +0 -1
  196. package/dist/effects/Ramp.d.ts +0 -88
  197. package/dist/effects/Ramp.js.map +0 -1
  198. package/dist/effects/SMAA.cjs +0 -7
  199. package/dist/effects/SMAA.cjs.map +0 -1
  200. package/dist/effects/SMAA.d.ts +0 -10
  201. package/dist/effects/SMAA.js +0 -7
  202. package/dist/effects/SMAA.js.map +0 -1
  203. package/dist/effects/SSAO.cjs +0 -37
  204. package/dist/effects/SSAO.cjs.map +0 -1
  205. package/dist/effects/SSAO.d.ts +0 -30
  206. package/dist/effects/SSAO.js +0 -37
  207. package/dist/effects/SSAO.js.map +0 -1
  208. package/dist/effects/SSR/index.cjs +0 -33
  209. package/dist/effects/SSR/index.cjs.map +0 -1
  210. package/dist/effects/SSR/index.d.ts +0 -55
  211. package/dist/effects/SSR/index.js +0 -33
  212. package/dist/effects/SSR/index.js.map +0 -1
  213. package/dist/effects/SSR/screen-space-reflections.cjs +0 -1699
  214. package/dist/effects/SSR/screen-space-reflections.cjs.map +0 -1
  215. package/dist/effects/SSR/screen-space-reflections.js +0 -1699
  216. package/dist/effects/SSR/screen-space-reflections.js.map +0 -1
  217. package/dist/effects/ScanlineEffect.cjs +0 -7
  218. package/dist/effects/ScanlineEffect.cjs.map +0 -1
  219. package/dist/effects/ScanlineEffect.d.ts +0 -9
  220. package/dist/effects/ScanlineEffect.js +0 -7
  221. package/dist/effects/ScanlineEffect.js.map +0 -1
  222. package/dist/effects/SelectiveBloom.cjs +0 -94
  223. package/dist/effects/SelectiveBloom.cjs.map +0 -1
  224. package/dist/effects/SelectiveBloom.d.ts +0 -20
  225. package/dist/effects/SelectiveBloom.js +0 -94
  226. package/dist/effects/SelectiveBloom.js.map +0 -1
  227. package/dist/effects/Sepia.cjs +0 -7
  228. package/dist/effects/Sepia.cjs.map +0 -1
  229. package/dist/effects/Sepia.d.ts +0 -9
  230. package/dist/effects/Sepia.js +0 -7
  231. package/dist/effects/Sepia.js.map +0 -1
  232. package/dist/effects/ShockWave.cjs +0 -7
  233. package/dist/effects/ShockWave.cjs.map +0 -1
  234. package/dist/effects/ShockWave.d.ts +0 -6
  235. package/dist/effects/ShockWave.js +0 -7
  236. package/dist/effects/ShockWave.js.map +0 -1
  237. package/dist/effects/Texture.cjs +0 -21
  238. package/dist/effects/Texture.cjs.map +0 -1
  239. package/dist/effects/Texture.d.ts +0 -11
  240. package/dist/effects/Texture.js +0 -21
  241. package/dist/effects/Texture.js.map +0 -1
  242. package/dist/effects/TiltShift.cjs +0 -7
  243. package/dist/effects/TiltShift.cjs.map +0 -1
  244. package/dist/effects/TiltShift.d.ts +0 -17
  245. package/dist/effects/TiltShift.js +0 -7
  246. package/dist/effects/TiltShift.js.map +0 -1
  247. package/dist/effects/TiltShift2.cjs +0 -98
  248. package/dist/effects/TiltShift2.cjs.map +0 -1
  249. package/dist/effects/TiltShift2.d.ts +0 -30
  250. package/dist/effects/TiltShift2.js.map +0 -1
  251. package/dist/effects/ToneMapping.cjs +0 -7
  252. package/dist/effects/ToneMapping.cjs.map +0 -1
  253. package/dist/effects/ToneMapping.d.ts +0 -19
  254. package/dist/effects/ToneMapping.js +0 -7
  255. package/dist/effects/ToneMapping.js.map +0 -1
  256. package/dist/effects/Vignette.cjs +0 -7
  257. package/dist/effects/Vignette.cjs.map +0 -1
  258. package/dist/effects/Vignette.d.ts +0 -12
  259. package/dist/effects/Vignette.js +0 -7
  260. package/dist/effects/Vignette.js.map +0 -1
  261. package/dist/effects/Water.cjs +0 -38
  262. package/dist/effects/Water.cjs.map +0 -1
  263. package/dist/effects/Water.d.ts +0 -15
  264. package/dist/effects/Water.js.map +0 -1
  265. package/dist/index.cjs +0 -89
  266. package/dist/index.cjs.map +0 -1
  267. package/dist/util.cjs +0 -69
  268. package/dist/util.cjs.map +0 -1
  269. package/dist/util.d.ts +0 -13
  270. package/dist/util.js +0 -52
  271. package/dist/util.js.map +0 -1
@@ -1,98 +1,90 @@
1
- import { Uniform } from "three";
2
- import { Effect, EffectAttribute, BlendFunction } from "postprocessing";
3
- import { wrapEffect } from "../util.js";
4
- const TiltShiftShader = {
5
- fragmentShader: `
6
-
7
- // original shader by Evan Wallace
8
-
9
- #define MAX_ITERATIONS 100
10
-
11
- uniform float blur;
12
- uniform float taper;
13
- uniform vec2 start;
14
- uniform vec2 end;
15
- uniform vec2 direction;
16
- uniform int samples;
17
-
18
- float random(vec3 scale, float seed) {
19
- /* use the fragment position for a different seed per-pixel */
20
- return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
21
- }
22
-
23
- void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
24
- vec4 color = vec4(0.0);
25
- float total = 0.0;
26
- vec2 startPixel = vec2(start.x * resolution.x, start.y * resolution.y);
27
- vec2 endPixel = vec2(end.x * resolution.x, end.y * resolution.y);
28
- float f_samples = float(samples);
29
- float half_samples = f_samples / 2.0;
30
-
31
- // use screen diagonal to normalize blur radii
32
- float maxScreenDistance = distance(vec2(0.0), resolution); // diagonal distance
33
- float gradientRadius = taper * (maxScreenDistance);
34
- float blurRadius = blur * (maxScreenDistance / 16.0);
35
-
36
- /* randomize the lookup values to hide the fixed number of samples */
37
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
38
- vec2 normal = normalize(vec2(startPixel.y - endPixel.y, endPixel.x - startPixel.x));
39
- float radius = smoothstep(0.0, 1.0, abs(dot(uv * resolution - startPixel, normal)) / gradientRadius) * blurRadius;
40
-
41
- #pragma unroll_loop_start
42
- for (int i = 0; i <= MAX_ITERATIONS; i++) {
43
- if (i >= samples) { break; } // return early if over sample count
44
- float f_i = float(i);
45
- float s_i = -half_samples + f_i;
46
- float percent = (s_i + offset - 0.5) / half_samples;
47
- float weight = 1.0 - abs(percent);
48
- vec4 sample_i = texture2D(inputBuffer, uv + normalize(direction) / resolution * percent * radius);
49
- /* switch to pre-multiplied alpha to correctly blur transparent images */
50
- sample_i.rgb *= sample_i.a;
51
- color += sample_i * weight;
52
- total += weight;
53
- }
54
- #pragma unroll_loop_end
55
-
56
- outputColor = color / total;
57
-
58
- /* switch back from pre-multiplied alpha */
59
- outputColor.rgb /= outputColor.a + 0.00001;
60
- }
61
- `
62
- };
63
- class TiltShiftEffect extends Effect {
64
- constructor({
65
- blendFunction = BlendFunction.NORMAL,
66
- blur = 0.15,
67
- // [0, 1], can go beyond 1 for extra
68
- taper = 0.5,
69
- // [0, 1], can go beyond 1 for extra
70
- start = [0.5, 0],
71
- // [0,1] percentage x,y of screenspace
72
- end = [0.5, 1],
73
- // [0,1] percentage x,y of screenspace
74
- samples = 10,
75
- // number of blur samples
76
- direction = [1, 1]
77
- // direction of blur
78
- } = {}) {
79
- super("TiltShiftEffect", TiltShiftShader.fragmentShader, {
80
- blendFunction,
81
- attributes: EffectAttribute.CONVOLUTION,
82
- uniforms: /* @__PURE__ */ new Map([
83
- ["blur", new Uniform(blur)],
84
- ["taper", new Uniform(taper)],
85
- ["start", new Uniform(start)],
86
- ["end", new Uniform(end)],
87
- ["samples", new Uniform(samples)],
88
- ["direction", new Uniform(direction)]
89
- ])
90
- });
91
- }
92
- }
93
- const TiltShift2 = wrapEffect(TiltShiftEffect, { blendFunction: BlendFunction.NORMAL });
94
- export {
95
- TiltShift2,
96
- TiltShiftEffect
97
- };
98
- //# sourceMappingURL=TiltShift2.js.map
1
+ import { Uniform } from 'three'
2
+ import { BlendFunction, Effect, EffectAttribute } from 'postprocessing'
3
+ import { wrapEffect } from '../util.tsx'
4
+
5
+ const TiltShiftShader = {
6
+ fragmentShader: `
7
+
8
+ // original shader by Evan Wallace
9
+
10
+ #define MAX_ITERATIONS 100
11
+
12
+ uniform float blur;
13
+ uniform float taper;
14
+ uniform vec2 start;
15
+ uniform vec2 end;
16
+ uniform vec2 direction;
17
+ uniform int samples;
18
+
19
+ float random(vec3 scale, float seed) {
20
+ /* use the fragment position for a different seed per-pixel */
21
+ return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
22
+ }
23
+
24
+ void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
25
+ vec4 color = vec4(0.0);
26
+ float total = 0.0;
27
+ vec2 startPixel = vec2(start.x * resolution.x, start.y * resolution.y);
28
+ vec2 endPixel = vec2(end.x * resolution.x, end.y * resolution.y);
29
+ float f_samples = float(samples);
30
+ float half_samples = f_samples / 2.0;
31
+
32
+ // use screen diagonal to normalize blur radii
33
+ float maxScreenDistance = distance(vec2(0.0), resolution); // diagonal distance
34
+ float gradientRadius = taper * (maxScreenDistance);
35
+ float blurRadius = blur * (maxScreenDistance / 16.0);
36
+
37
+ /* randomize the lookup values to hide the fixed number of samples */
38
+ float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
39
+ vec2 normal = normalize(vec2(startPixel.y - endPixel.y, endPixel.x - startPixel.x));
40
+ float radius = smoothstep(0.0, 1.0, abs(dot(uv * resolution - startPixel, normal)) / gradientRadius) * blurRadius;
41
+
42
+ #pragma unroll_loop_start
43
+ for (int i = 0; i <= MAX_ITERATIONS; i++) {
44
+ if (i >= samples) { break; } // return early if over sample count
45
+ float f_i = float(i);
46
+ float s_i = -half_samples + f_i;
47
+ float percent = (s_i + offset - 0.5) / half_samples;
48
+ float weight = 1.0 - abs(percent);
49
+ vec4 sample_i = texture2D(inputBuffer, uv + normalize(direction) / resolution * percent * radius);
50
+ /* switch to pre-multiplied alpha to correctly blur transparent images */
51
+ sample_i.rgb *= sample_i.a;
52
+ color += sample_i * weight;
53
+ total += weight;
54
+ }
55
+ #pragma unroll_loop_end
56
+
57
+ outputColor = color / total;
58
+
59
+ /* switch back from pre-multiplied alpha */
60
+ outputColor.rgb /= outputColor.a + 0.00001;
61
+ }
62
+ `,
63
+ }
64
+
65
+ export class TiltShiftEffect extends Effect {
66
+ constructor({
67
+ blendFunction = BlendFunction.NORMAL,
68
+ blur = 0.15, // [0, 1], can go beyond 1 for extra
69
+ taper = 0.5, // [0, 1], can go beyond 1 for extra
70
+ start = [0.5, 0.0], // [0,1] percentage x,y of screenspace
71
+ end = [0.5, 1.0], // [0,1] percentage x,y of screenspace
72
+ samples = 10.0, // number of blur samples
73
+ direction = [1, 1], // direction of blur
74
+ } = {}) {
75
+ super('TiltShiftEffect', TiltShiftShader.fragmentShader, {
76
+ blendFunction,
77
+ attributes: EffectAttribute.CONVOLUTION,
78
+ uniforms: new Map<string, Uniform<number | number[]>>([
79
+ ['blur', new Uniform(blur)],
80
+ ['taper', new Uniform(taper)],
81
+ ['start', new Uniform(start)],
82
+ ['end', new Uniform(end)],
83
+ ['samples', new Uniform(samples)],
84
+ ['direction', new Uniform(direction)],
85
+ ]),
86
+ })
87
+ }
88
+ }
89
+
90
+ export const TiltShift2 = /* @__PURE__ */ wrapEffect(TiltShiftEffect, { blendFunction: BlendFunction.NORMAL })
@@ -0,0 +1,6 @@
1
+ import { ToneMappingEffect } from 'postprocessing'
2
+ import { type EffectProps, wrapEffect } from '../util.tsx'
3
+
4
+ export type ToneMappingProps = EffectProps<typeof ToneMappingEffect>
5
+
6
+ export const ToneMapping = /* @__PURE__ */ wrapEffect(ToneMappingEffect)
@@ -0,0 +1,4 @@
1
+ import { VignetteEffect } from 'postprocessing'
2
+ import { wrapEffect } from '../util.tsx'
3
+
4
+ export const Vignette = /* @__PURE__ */ wrapEffect(VignetteEffect)
@@ -1,38 +1,35 @@
1
- import { Uniform } from "three";
2
- import { Effect, EffectAttribute, BlendFunction } from "postprocessing";
3
- import { wrapEffect } from "../util.js";
4
- const WaterShader = {
5
- fragmentShader: (
6
- /* glsl */
7
- `
8
- uniform float factor;
9
-
10
- void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
11
- vec2 vUv = uv;
12
- float frequency = 6.0 * factor;
13
- float amplitude = 0.015 * factor;
14
- float x = vUv.y * frequency + time * 0.7;
15
- float y = vUv.x * frequency + time * 0.3;
16
- vUv.x += cos(x + y) * amplitude * cos(y);
17
- vUv.y += sin(x - y) * amplitude * cos(y);
18
- vec4 rgba = texture(inputBuffer, vUv);
19
- outputColor = rgba;
20
- }
21
- `
22
- )
23
- };
24
- class WaterEffectImpl extends Effect {
25
- constructor({ blendFunction = BlendFunction.NORMAL, factor = 0 } = {}) {
26
- super("WaterEffect", WaterShader.fragmentShader, {
27
- blendFunction,
28
- attributes: EffectAttribute.CONVOLUTION,
29
- uniforms: /* @__PURE__ */ new Map([["factor", new Uniform(factor)]])
30
- });
31
- }
32
- }
33
- const WaterEffect = wrapEffect(WaterEffectImpl, { blendFunction: BlendFunction.NORMAL });
34
- export {
35
- WaterEffect,
36
- WaterEffectImpl
37
- };
38
- //# sourceMappingURL=Water.js.map
1
+ import { Uniform } from 'three'
2
+ import { BlendFunction, Effect, EffectAttribute } from 'postprocessing'
3
+ import { wrapEffect } from '../util.tsx'
4
+
5
+ const WaterShader = {
6
+ fragmentShader: /* glsl */ `
7
+ uniform float factor;
8
+
9
+ void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
10
+ vec2 vUv = uv;
11
+ float frequency = 6.0 * factor;
12
+ float amplitude = 0.015 * factor;
13
+ float x = vUv.y * frequency + time * 0.7;
14
+ float y = vUv.x * frequency + time * 0.3;
15
+ vUv.x += cos(x + y) * amplitude * cos(y);
16
+ vUv.y += sin(x - y) * amplitude * cos(y);
17
+ vec4 rgba = texture(inputBuffer, vUv);
18
+ outputColor = rgba;
19
+ }
20
+ `,
21
+ }
22
+
23
+ export class WaterEffectImpl extends Effect {
24
+ constructor({ blendFunction = BlendFunction.NORMAL, factor = 0 } = {}) {
25
+ super('WaterEffect', WaterShader.fragmentShader, {
26
+ blendFunction,
27
+ attributes: EffectAttribute.CONVOLUTION,
28
+ uniforms: new Map<string, Uniform<number | number[]>>([['factor', new Uniform(factor)]]),
29
+ })
30
+ }
31
+ }
32
+
33
+ export const WaterEffect = /* @__PURE__ */ wrapEffect(WaterEffectImpl, {
34
+ blendFunction: BlendFunction.NORMAL,
35
+ })
package/src/index.ts ADDED
@@ -0,0 +1,40 @@
1
+ export * from './Selection.tsx'
2
+ export * from './EffectComposer.tsx'
3
+ export * from './util.tsx'
4
+
5
+ export * from './effects/Autofocus.tsx'
6
+ export * from './effects/LensFlare.tsx'
7
+ export * from './effects/Bloom.tsx'
8
+ export * from './effects/BrightnessContrast.tsx'
9
+ export * from './effects/ChromaticAberration.tsx'
10
+ export * from './effects/ColorAverage.tsx'
11
+ export * from './effects/ColorDepth.tsx'
12
+ export * from './effects/Depth.tsx'
13
+ export * from './effects/DepthOfField.tsx'
14
+ export * from './effects/DotScreen.tsx'
15
+ export * from './effects/Glitch.tsx'
16
+ export * from './effects/GodRays.tsx'
17
+ export * from './effects/Grid.tsx'
18
+ export * from './effects/HueSaturation.tsx'
19
+ export * from './effects/Noise.tsx'
20
+ export * from './effects/Outline.tsx'
21
+ export * from './effects/Pixelation.tsx'
22
+ export * from './effects/ScanlineEffect.tsx'
23
+ export * from './effects/SelectiveBloom.tsx'
24
+ export * from './effects/Sepia.tsx'
25
+ export * from './effects/SSAO.tsx'
26
+ export * from './effects/SMAA.tsx'
27
+ export * from './effects/FXAA.tsx'
28
+ export * from './effects/Ramp.tsx'
29
+ export * from './effects/Texture.tsx'
30
+ export * from './effects/ToneMapping.tsx'
31
+ export * from './effects/Vignette.tsx'
32
+ export * from './effects/ShockWave.tsx'
33
+ export * from './effects/LUT.tsx'
34
+ export * from './effects/TiltShift.tsx'
35
+ export * from './effects/TiltShift2.tsx'
36
+ export * from './effects/ASCII.tsx'
37
+ export * from './effects/Water.tsx'
38
+
39
+ // These are not effect passes
40
+ export * from './effects/N8AO.tsx'
package/src/util.tsx ADDED
@@ -0,0 +1,55 @@
1
+ import React, { RefObject } from 'react'
2
+ import { Vector2 } from 'three'
3
+ import * as THREE from 'three'
4
+ import { type ReactThreeFiber, type ThreeElement, extend, useThree } from '@react-three/fiber'
5
+ import type { Effect, Pass, BlendFunction } from 'postprocessing'
6
+
7
+ export const resolveRef = <T,>(ref: T | React.RefObject<T>) =>
8
+ typeof ref === 'object' && ref != null && 'current' in ref ? ref.current : ref
9
+
10
+ export type EffectConstructor = new (...args: any[]) => Effect | Pass
11
+
12
+ export type EffectProps<T extends EffectConstructor> = ThreeElement<T> &
13
+ ConstructorParameters<T>[0] & {
14
+ blendFunction?: BlendFunction
15
+ opacity?: number
16
+ }
17
+
18
+ let i = 0
19
+ const components = new WeakMap<EffectConstructor, React.ExoticComponent<any> | string>()
20
+
21
+ export const wrapEffect = <T extends EffectConstructor>(effect: T, defaults?: EffectProps<T>) =>
22
+ /* @__PURE__ */ function Effect({ blendFunction = defaults?.blendFunction, opacity = defaults?.opacity, ...props }) {
23
+ let Component = components.get(effect)
24
+ if (!Component) {
25
+ const key = `@react-three/postprocessing/${effect.name}-${i++}`
26
+ extend({ [key]: effect })
27
+ components.set(effect, (Component = key))
28
+ }
29
+
30
+ const camera = useThree((state) => state.camera)
31
+ const args = React.useMemo(
32
+ () => [...(defaults?.args ?? []), ...(props.args ?? [{ ...defaults, ...props }])],
33
+ // eslint-disable-next-line react-hooks/exhaustive-deps
34
+ [JSON.stringify(props)]
35
+ )
36
+
37
+ return (
38
+ <Component
39
+ camera={camera}
40
+ blendMode-blendFunction={blendFunction}
41
+ blendMode-opacity-value={opacity}
42
+ {...props}
43
+ args={args}
44
+ />
45
+ )
46
+ }
47
+
48
+ export const useVector2 = (props: Record<string, unknown>, key: string): THREE.Vector2 => {
49
+ const value = props[key] as ReactThreeFiber.Vector2 | undefined
50
+ return React.useMemo(() => {
51
+ if (typeof value === 'number') return new THREE.Vector2(value, value)
52
+ else if (value) return new THREE.Vector2(...(value as THREE.Vector2Tuple))
53
+ else return new THREE.Vector2()
54
+ }, [value])
55
+ }
@@ -1,137 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const THREE = require("three");
5
- const React = require("react");
6
- const fiber = require("@react-three/fiber");
7
- const postprocessing = require("postprocessing");
8
- const threeStdlib = require("three-stdlib");
9
- const EffectComposerContext = React.createContext(null);
10
- const isConvolution = (effect) => (effect.getAttributes() & postprocessing.EffectAttribute.CONVOLUTION) === postprocessing.EffectAttribute.CONVOLUTION;
11
- const EffectComposer = React.memo(
12
- React.forwardRef(
13
- ({
14
- children,
15
- camera: _camera,
16
- scene: _scene,
17
- resolutionScale,
18
- enabled = true,
19
- renderPriority = 1,
20
- autoClear = true,
21
- depthBuffer,
22
- enableNormalPass,
23
- stencilBuffer,
24
- multisampling = 8,
25
- frameBufferType = THREE.HalfFloatType
26
- }, ref) => {
27
- const { gl, scene: defaultScene, camera: defaultCamera, size } = fiber.useThree();
28
- const scene = _scene || defaultScene;
29
- const camera = _camera || defaultCamera;
30
- const [composer, normalPass, downSamplingPass] = React.useMemo(() => {
31
- const webGL2Available = threeStdlib.isWebGL2Available();
32
- const effectComposer = new postprocessing.EffectComposer(gl, {
33
- depthBuffer,
34
- stencilBuffer,
35
- multisampling: multisampling > 0 && webGL2Available ? multisampling : 0,
36
- frameBufferType
37
- });
38
- effectComposer.addPass(new postprocessing.RenderPass(scene, camera));
39
- let downSamplingPass2 = null;
40
- let normalPass2 = null;
41
- if (enableNormalPass) {
42
- normalPass2 = new postprocessing.NormalPass(scene, camera);
43
- normalPass2.enabled = false;
44
- effectComposer.addPass(normalPass2);
45
- if (resolutionScale !== void 0 && webGL2Available) {
46
- downSamplingPass2 = new postprocessing.DepthDownsamplingPass({ normalBuffer: normalPass2.texture, resolutionScale });
47
- downSamplingPass2.enabled = false;
48
- effectComposer.addPass(downSamplingPass2);
49
- }
50
- }
51
- return [effectComposer, normalPass2, downSamplingPass2];
52
- }, [
53
- camera,
54
- gl,
55
- depthBuffer,
56
- stencilBuffer,
57
- multisampling,
58
- frameBufferType,
59
- scene,
60
- enableNormalPass,
61
- resolutionScale
62
- ]);
63
- React.useEffect(() => composer == null ? void 0 : composer.setSize(size.width, size.height), [composer, size]);
64
- fiber.useFrame(
65
- (_, delta) => {
66
- if (enabled) {
67
- const currentAutoClear = gl.autoClear;
68
- gl.autoClear = autoClear;
69
- if (stencilBuffer && !autoClear)
70
- gl.clearStencil();
71
- composer.render(delta);
72
- gl.autoClear = currentAutoClear;
73
- }
74
- },
75
- enabled ? renderPriority : 0
76
- );
77
- const group = React.useRef(null);
78
- React.useLayoutEffect(() => {
79
- var _a;
80
- const passes = [];
81
- const groupInstance = (_a = group.current) == null ? void 0 : _a.__r3f;
82
- if (groupInstance && composer) {
83
- const children2 = groupInstance.objects;
84
- for (let i = 0; i < children2.length; i++) {
85
- const child = children2[i];
86
- if (child instanceof postprocessing.Effect) {
87
- const effects = [child];
88
- if (!isConvolution(child)) {
89
- let next = null;
90
- while ((next = children2[i + 1]) instanceof postprocessing.Effect) {
91
- if (isConvolution(next))
92
- break;
93
- effects.push(next);
94
- i++;
95
- }
96
- }
97
- const pass = new postprocessing.EffectPass(camera, ...effects);
98
- passes.push(pass);
99
- } else if (child instanceof postprocessing.Pass) {
100
- passes.push(child);
101
- }
102
- }
103
- for (const pass of passes)
104
- composer == null ? void 0 : composer.addPass(pass);
105
- if (normalPass)
106
- normalPass.enabled = true;
107
- if (downSamplingPass)
108
- downSamplingPass.enabled = true;
109
- }
110
- return () => {
111
- for (const pass of passes)
112
- composer == null ? void 0 : composer.removePass(pass);
113
- if (normalPass)
114
- normalPass.enabled = false;
115
- if (downSamplingPass)
116
- downSamplingPass.enabled = false;
117
- };
118
- }, [composer, children, camera, normalPass, downSamplingPass]);
119
- React.useEffect(() => {
120
- const currentTonemapping = gl.toneMapping;
121
- gl.toneMapping = THREE.NoToneMapping;
122
- return () => {
123
- gl.toneMapping = currentTonemapping;
124
- };
125
- }, [gl]);
126
- const state = React.useMemo(
127
- () => ({ composer, normalPass, downSamplingPass, resolutionScale, camera, scene }),
128
- [composer, normalPass, downSamplingPass, resolutionScale, camera, scene]
129
- );
130
- React.useImperativeHandle(ref, () => composer, [composer]);
131
- return /* @__PURE__ */ jsxRuntime.jsx(EffectComposerContext.Provider, { value: state, children: /* @__PURE__ */ jsxRuntime.jsx("group", { ref: group, children }) });
132
- }
133
- )
134
- );
135
- exports.EffectComposer = EffectComposer;
136
- exports.EffectComposerContext = EffectComposerContext;
137
- //# sourceMappingURL=EffectComposer.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EffectComposer.cjs","sources":["../src/EffectComposer.tsx"],"sourcesContent":["import type { TextureDataType } from 'three'\nimport { HalfFloatType, NoToneMapping } from 'three'\nimport React, {\n forwardRef,\n useMemo,\n useEffect,\n useLayoutEffect,\n createContext,\n useRef,\n useImperativeHandle,\n} from 'react'\nimport { useThree, useFrame } from '@react-three/fiber'\nimport {\n EffectComposer as EffectComposerImpl,\n RenderPass,\n EffectPass,\n NormalPass,\n // @ts-ignore\n DepthDownsamplingPass,\n Effect,\n Pass,\n EffectAttribute,\n} from 'postprocessing'\nimport { isWebGL2Available } from 'three-stdlib'\n\nexport const EffectComposerContext = createContext<{\n composer: EffectComposerImpl\n normalPass: NormalPass | null\n downSamplingPass: DepthDownsamplingPass | null\n camera: THREE.Camera\n scene: THREE.Scene\n resolutionScale?: number\n}>(null!)\n\nexport type EffectComposerProps = {\n enabled?: boolean\n children: JSX.Element | JSX.Element[]\n depthBuffer?: boolean\n /** Only used for SSGI currently, leave it disabled for everything else unless it's needed */\n enableNormalPass?: boolean\n stencilBuffer?: boolean\n autoClear?: boolean\n resolutionScale?: number\n multisampling?: number\n frameBufferType?: TextureDataType\n renderPriority?: number\n camera?: THREE.Camera\n scene?: THREE.Scene\n}\n\nconst isConvolution = (effect: Effect): boolean =>\n (effect.getAttributes() & EffectAttribute.CONVOLUTION) === EffectAttribute.CONVOLUTION\n\nexport const EffectComposer = React.memo(\n forwardRef<EffectComposerImpl, EffectComposerProps>(\n (\n {\n children,\n camera: _camera,\n scene: _scene,\n resolutionScale,\n enabled = true,\n renderPriority = 1,\n autoClear = true,\n depthBuffer,\n enableNormalPass,\n stencilBuffer,\n multisampling = 8,\n frameBufferType = HalfFloatType,\n },\n ref\n ) => {\n const { gl, scene: defaultScene, camera: defaultCamera, size } = useThree()\n const scene = _scene || defaultScene\n const camera = _camera || defaultCamera\n\n const [composer, normalPass, downSamplingPass] = useMemo(() => {\n const webGL2Available = isWebGL2Available()\n // Initialize composer\n const effectComposer = new EffectComposerImpl(gl, {\n depthBuffer,\n stencilBuffer,\n multisampling: multisampling > 0 && webGL2Available ? multisampling : 0,\n frameBufferType,\n })\n\n // Add render pass\n effectComposer.addPass(new RenderPass(scene, camera))\n\n // Create normal pass\n let downSamplingPass = null\n let normalPass = null\n if (enableNormalPass) {\n normalPass = new NormalPass(scene, camera)\n normalPass.enabled = false\n effectComposer.addPass(normalPass)\n if (resolutionScale !== undefined && webGL2Available) {\n downSamplingPass = new DepthDownsamplingPass({ normalBuffer: normalPass.texture, resolutionScale })\n downSamplingPass.enabled = false\n effectComposer.addPass(downSamplingPass)\n }\n }\n\n return [effectComposer, normalPass, downSamplingPass]\n }, [\n camera,\n gl,\n depthBuffer,\n stencilBuffer,\n multisampling,\n frameBufferType,\n scene,\n enableNormalPass,\n resolutionScale,\n ])\n\n useEffect(() => composer?.setSize(size.width, size.height), [composer, size])\n useFrame(\n (_, delta) => {\n if (enabled) {\n const currentAutoClear = gl.autoClear\n gl.autoClear = autoClear\n if (stencilBuffer && !autoClear) gl.clearStencil()\n composer.render(delta)\n gl.autoClear = currentAutoClear\n }\n },\n enabled ? renderPriority : 0\n )\n\n const group = useRef(null)\n useLayoutEffect(() => {\n const passes: Pass[] = []\n\n // TODO: rewrite all of this with R3F v9\n const groupInstance = (group.current as any)?.__r3f as { objects: unknown[] }\n\n if (groupInstance && composer) {\n const children = groupInstance.objects\n\n for (let i = 0; i < children.length; i++) {\n const child = children[i]\n\n if (child instanceof Effect) {\n const effects: Effect[] = [child]\n\n if (!isConvolution(child)) {\n let next: unknown = null\n while ((next = children[i + 1]) instanceof Effect) {\n if (isConvolution(next)) break\n effects.push(next)\n i++\n }\n }\n\n const pass = new EffectPass(camera, ...effects)\n passes.push(pass)\n } else if (child instanceof Pass) {\n passes.push(child)\n }\n }\n\n for (const pass of passes) composer?.addPass(pass)\n\n if (normalPass) normalPass.enabled = true\n if (downSamplingPass) downSamplingPass.enabled = true\n }\n\n return () => {\n for (const pass of passes) composer?.removePass(pass)\n if (normalPass) normalPass.enabled = false\n if (downSamplingPass) downSamplingPass.enabled = false\n }\n }, [composer, children, camera, normalPass, downSamplingPass])\n\n // Disable tone mapping because threejs disallows tonemapping on render targets\n useEffect(() => {\n const currentTonemapping = gl.toneMapping\n gl.toneMapping = NoToneMapping\n return () => {\n gl.toneMapping = currentTonemapping\n }\n }, [gl])\n\n // Memoize state, otherwise it would trigger all consumers on every render\n const state = useMemo(\n () => ({ composer, normalPass, downSamplingPass, resolutionScale, camera, scene }),\n [composer, normalPass, downSamplingPass, resolutionScale, camera, scene]\n )\n\n // Expose the composer\n useImperativeHandle(ref, () => composer, [composer])\n\n return (\n <EffectComposerContext.Provider value={state}>\n <group ref={group}>{children}</group>\n </EffectComposerContext.Provider>\n )\n }\n )\n)\n"],"names":["createContext","EffectAttribute","forwardRef","HalfFloatType","useThree","useMemo","isWebGL2Available","EffectComposerImpl","RenderPass","downSamplingPass","normalPass","NormalPass","DepthDownsamplingPass","useEffect","useFrame","useRef","useLayoutEffect","children","Effect","EffectPass","Pass","NoToneMapping","useImperativeHandle","jsx"],"mappings":"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"}
@@ -1,27 +0,0 @@
1
- import type { TextureDataType } from 'three';
2
- import React from 'react';
3
- import { EffectComposer as EffectComposerImpl, NormalPass, DepthDownsamplingPass } from 'postprocessing';
4
- export declare const EffectComposerContext: React.Context<{
5
- composer: EffectComposerImpl;
6
- normalPass: NormalPass | null;
7
- downSamplingPass: DepthDownsamplingPass | null;
8
- camera: THREE.Camera;
9
- scene: THREE.Scene;
10
- resolutionScale?: number | undefined;
11
- }>;
12
- export type EffectComposerProps = {
13
- enabled?: boolean;
14
- children: JSX.Element | JSX.Element[];
15
- depthBuffer?: boolean;
16
- /** Only used for SSGI currently, leave it disabled for everything else unless it's needed */
17
- enableNormalPass?: boolean;
18
- stencilBuffer?: boolean;
19
- autoClear?: boolean;
20
- resolutionScale?: number;
21
- multisampling?: number;
22
- frameBufferType?: TextureDataType;
23
- renderPriority?: number;
24
- camera?: THREE.Camera;
25
- scene?: THREE.Scene;
26
- };
27
- export declare const EffectComposer: React.MemoExoticComponent<React.ForwardRefExoticComponent<EffectComposerProps & React.RefAttributes<EffectComposerImpl>>>;