@react-three/postprocessing 2.19.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 (270) 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/{dist/effects/LensFlare.js → src/effects/LensFlare.tsx} +611 -556
  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 -573
  142. package/dist/effects/LensFlare.cjs.map +0 -1
  143. package/dist/effects/LensFlare.d.ts +0 -55
  144. package/dist/effects/LensFlare.js.map +0 -1
  145. package/dist/effects/N8AO/BlueNoise.cjs +0 -4
  146. package/dist/effects/N8AO/BlueNoise.cjs.map +0 -1
  147. package/dist/effects/N8AO/BlueNoise.js +0 -5
  148. package/dist/effects/N8AO/BlueNoise.js.map +0 -1
  149. package/dist/effects/N8AO/DepthDownSample.cjs +0 -183
  150. package/dist/effects/N8AO/DepthDownSample.cjs.map +0 -1
  151. package/dist/effects/N8AO/DepthDownSample.js +0 -166
  152. package/dist/effects/N8AO/DepthDownSample.js.map +0 -1
  153. package/dist/effects/N8AO/EffectCompositer.cjs +0 -278
  154. package/dist/effects/N8AO/EffectCompositer.cjs.map +0 -1
  155. package/dist/effects/N8AO/EffectCompositer.js +0 -261
  156. package/dist/effects/N8AO/EffectCompositer.js.map +0 -1
  157. package/dist/effects/N8AO/EffectShader.cjs +0 -236
  158. package/dist/effects/N8AO/EffectShader.cjs.map +0 -1
  159. package/dist/effects/N8AO/EffectShader.js +0 -219
  160. package/dist/effects/N8AO/EffectShader.js.map +0 -1
  161. package/dist/effects/N8AO/FullScreenTriangle.cjs +0 -59
  162. package/dist/effects/N8AO/FullScreenTriangle.cjs.map +0 -1
  163. package/dist/effects/N8AO/FullScreenTriangle.js +0 -42
  164. package/dist/effects/N8AO/FullScreenTriangle.js.map +0 -1
  165. package/dist/effects/N8AO/N8AOPostPass.cjs +0 -502
  166. package/dist/effects/N8AO/N8AOPostPass.cjs.map +0 -1
  167. package/dist/effects/N8AO/N8AOPostPass.js +0 -485
  168. package/dist/effects/N8AO/N8AOPostPass.js.map +0 -1
  169. package/dist/effects/N8AO/PoissionBlur.cjs +0 -186
  170. package/dist/effects/N8AO/PoissionBlur.cjs.map +0 -1
  171. package/dist/effects/N8AO/PoissionBlur.js +0 -169
  172. package/dist/effects/N8AO/PoissionBlur.js.map +0 -1
  173. package/dist/effects/N8AO/index.cjs +0 -60
  174. package/dist/effects/N8AO/index.cjs.map +0 -1
  175. package/dist/effects/N8AO/index.d.ts +0 -18
  176. package/dist/effects/N8AO/index.js +0 -60
  177. package/dist/effects/N8AO/index.js.map +0 -1
  178. package/dist/effects/Noise.cjs +0 -7
  179. package/dist/effects/Noise.cjs.map +0 -1
  180. package/dist/effects/Noise.d.ts +0 -9
  181. package/dist/effects/Noise.js +0 -7
  182. package/dist/effects/Noise.js.map +0 -1
  183. package/dist/effects/Outline.cjs +0 -100
  184. package/dist/effects/Outline.cjs.map +0 -1
  185. package/dist/effects/Outline.d.ts +0 -30
  186. package/dist/effects/Outline.js +0 -100
  187. package/dist/effects/Outline.js.map +0 -1
  188. package/dist/effects/Pixelation.cjs +0 -11
  189. package/dist/effects/Pixelation.cjs.map +0 -1
  190. package/dist/effects/Pixelation.d.ts +0 -6
  191. package/dist/effects/Pixelation.js +0 -11
  192. package/dist/effects/Pixelation.js.map +0 -1
  193. package/dist/effects/Ramp.cjs +0 -156
  194. package/dist/effects/Ramp.cjs.map +0 -1
  195. package/dist/effects/Ramp.d.ts +0 -88
  196. package/dist/effects/Ramp.js.map +0 -1
  197. package/dist/effects/SMAA.cjs +0 -7
  198. package/dist/effects/SMAA.cjs.map +0 -1
  199. package/dist/effects/SMAA.d.ts +0 -10
  200. package/dist/effects/SMAA.js +0 -7
  201. package/dist/effects/SMAA.js.map +0 -1
  202. package/dist/effects/SSAO.cjs +0 -37
  203. package/dist/effects/SSAO.cjs.map +0 -1
  204. package/dist/effects/SSAO.d.ts +0 -30
  205. package/dist/effects/SSAO.js +0 -37
  206. package/dist/effects/SSAO.js.map +0 -1
  207. package/dist/effects/SSR/index.cjs +0 -33
  208. package/dist/effects/SSR/index.cjs.map +0 -1
  209. package/dist/effects/SSR/index.d.ts +0 -55
  210. package/dist/effects/SSR/index.js +0 -33
  211. package/dist/effects/SSR/index.js.map +0 -1
  212. package/dist/effects/SSR/screen-space-reflections.cjs +0 -1699
  213. package/dist/effects/SSR/screen-space-reflections.cjs.map +0 -1
  214. package/dist/effects/SSR/screen-space-reflections.js +0 -1699
  215. package/dist/effects/SSR/screen-space-reflections.js.map +0 -1
  216. package/dist/effects/ScanlineEffect.cjs +0 -7
  217. package/dist/effects/ScanlineEffect.cjs.map +0 -1
  218. package/dist/effects/ScanlineEffect.d.ts +0 -9
  219. package/dist/effects/ScanlineEffect.js +0 -7
  220. package/dist/effects/ScanlineEffect.js.map +0 -1
  221. package/dist/effects/SelectiveBloom.cjs +0 -94
  222. package/dist/effects/SelectiveBloom.cjs.map +0 -1
  223. package/dist/effects/SelectiveBloom.d.ts +0 -20
  224. package/dist/effects/SelectiveBloom.js +0 -94
  225. package/dist/effects/SelectiveBloom.js.map +0 -1
  226. package/dist/effects/Sepia.cjs +0 -7
  227. package/dist/effects/Sepia.cjs.map +0 -1
  228. package/dist/effects/Sepia.d.ts +0 -9
  229. package/dist/effects/Sepia.js +0 -7
  230. package/dist/effects/Sepia.js.map +0 -1
  231. package/dist/effects/ShockWave.cjs +0 -7
  232. package/dist/effects/ShockWave.cjs.map +0 -1
  233. package/dist/effects/ShockWave.d.ts +0 -6
  234. package/dist/effects/ShockWave.js +0 -7
  235. package/dist/effects/ShockWave.js.map +0 -1
  236. package/dist/effects/Texture.cjs +0 -21
  237. package/dist/effects/Texture.cjs.map +0 -1
  238. package/dist/effects/Texture.d.ts +0 -11
  239. package/dist/effects/Texture.js +0 -21
  240. package/dist/effects/Texture.js.map +0 -1
  241. package/dist/effects/TiltShift.cjs +0 -7
  242. package/dist/effects/TiltShift.cjs.map +0 -1
  243. package/dist/effects/TiltShift.d.ts +0 -17
  244. package/dist/effects/TiltShift.js +0 -7
  245. package/dist/effects/TiltShift.js.map +0 -1
  246. package/dist/effects/TiltShift2.cjs +0 -98
  247. package/dist/effects/TiltShift2.cjs.map +0 -1
  248. package/dist/effects/TiltShift2.d.ts +0 -30
  249. package/dist/effects/TiltShift2.js.map +0 -1
  250. package/dist/effects/ToneMapping.cjs +0 -7
  251. package/dist/effects/ToneMapping.cjs.map +0 -1
  252. package/dist/effects/ToneMapping.d.ts +0 -19
  253. package/dist/effects/ToneMapping.js +0 -7
  254. package/dist/effects/ToneMapping.js.map +0 -1
  255. package/dist/effects/Vignette.cjs +0 -7
  256. package/dist/effects/Vignette.cjs.map +0 -1
  257. package/dist/effects/Vignette.d.ts +0 -12
  258. package/dist/effects/Vignette.js +0 -7
  259. package/dist/effects/Vignette.js.map +0 -1
  260. package/dist/effects/Water.cjs +0 -38
  261. package/dist/effects/Water.cjs.map +0 -1
  262. package/dist/effects/Water.d.ts +0 -15
  263. package/dist/effects/Water.js.map +0 -1
  264. package/dist/index.cjs +0 -89
  265. package/dist/index.cjs.map +0 -1
  266. package/dist/util.cjs +0 -69
  267. package/dist/util.cjs.map +0 -1
  268. package/dist/util.d.ts +0 -13
  269. package/dist/util.js +0 -52
  270. package/dist/util.js.map +0 -1
@@ -1,30 +0,0 @@
1
- /// <reference types="react" />
2
- import { SSAOEffect, BlendFunction } from 'postprocessing';
3
- export declare const SSAO: import("react").ForwardRefExoticComponent<{
4
- blendFunction?: BlendFunction | undefined;
5
- distanceScaling?: boolean | undefined;
6
- depthAwareUpsampling?: boolean | undefined;
7
- normalDepthBuffer?: import("three").Texture | undefined;
8
- samples?: number | undefined;
9
- rings?: number | undefined;
10
- worldDistanceThreshold: number;
11
- worldDistanceFalloff: number;
12
- worldProximityThreshold: number;
13
- worldProximityFalloff: number;
14
- distanceThreshold?: number | undefined;
15
- distanceFalloff?: number | undefined;
16
- rangeThreshold?: number | undefined;
17
- rangeFalloff?: number | undefined;
18
- minRadiusScale?: number | undefined;
19
- luminanceInfluence?: number | undefined;
20
- radius?: number | undefined;
21
- intensity?: number | undefined;
22
- bias?: number | undefined;
23
- fade?: number | undefined;
24
- color?: import("three").Color | undefined;
25
- resolutionScale?: number | undefined;
26
- resolutionX?: number | undefined;
27
- resolutionY?: number | undefined;
28
- width?: number | undefined;
29
- height?: number | undefined;
30
- } & import("react").RefAttributes<SSAOEffect>>;
@@ -1,37 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { forwardRef, useContext, useMemo } from "react";
3
- import { SSAOEffect, BlendFunction } from "postprocessing";
4
- import { EffectComposerContext } from "../EffectComposer.js";
5
- const SSAO = forwardRef(function SSAO2(props, ref) {
6
- const { camera, normalPass, downSamplingPass, resolutionScale } = useContext(EffectComposerContext);
7
- const effect = useMemo(() => {
8
- if (normalPass === null && downSamplingPass === null) {
9
- console.error("Please enable the NormalPass in the EffectComposer in order to use SSAO.");
10
- return {};
11
- }
12
- return new SSAOEffect(camera, normalPass && !downSamplingPass ? normalPass.texture : null, {
13
- blendFunction: BlendFunction.MULTIPLY,
14
- samples: 30,
15
- rings: 4,
16
- distanceThreshold: 1,
17
- distanceFalloff: 0,
18
- rangeThreshold: 0.5,
19
- rangeFalloff: 0.1,
20
- luminanceInfluence: 0.9,
21
- radius: 20,
22
- bias: 0.5,
23
- intensity: 1,
24
- color: void 0,
25
- // @ts-ignore
26
- normalDepthBuffer: downSamplingPass ? downSamplingPass.texture : null,
27
- resolutionScale: resolutionScale != null ? resolutionScale : 1,
28
- depthAwareUpsampling: true,
29
- ...props
30
- });
31
- }, [camera, downSamplingPass, normalPass, resolutionScale]);
32
- return /* @__PURE__ */ jsx("primitive", { ref, object: effect, dispose: null });
33
- });
34
- export {
35
- SSAO
36
- };
37
- //# sourceMappingURL=SSAO.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SSAO.js","sources":["../../src/effects/SSAO.tsx"],"sourcesContent":["import { Ref, forwardRef, useContext, useMemo } from 'react'\nimport { SSAOEffect, BlendFunction } from 'postprocessing'\nimport { EffectComposerContext } from '../EffectComposer'\n\n// first two args are camera and texture\ntype SSAOProps = ConstructorParameters<typeof SSAOEffect>[2]\n\nexport const SSAO = forwardRef<SSAOEffect, SSAOProps>(function SSAO(props: SSAOProps, ref: Ref<SSAOEffect>) {\n const { camera, normalPass, downSamplingPass, resolutionScale } = useContext(EffectComposerContext)\n const effect = useMemo<SSAOEffect | {}>(() => {\n if (normalPass === null && downSamplingPass === null) {\n console.error('Please enable the NormalPass in the EffectComposer in order to use SSAO.')\n return {}\n }\n return new SSAOEffect(camera, normalPass && !downSamplingPass ? (normalPass as any).texture : null, {\n blendFunction: BlendFunction.MULTIPLY,\n samples: 30,\n rings: 4,\n distanceThreshold: 1.0,\n distanceFalloff: 0.0,\n rangeThreshold: 0.5,\n rangeFalloff: 0.1,\n luminanceInfluence: 0.9,\n radius: 20,\n bias: 0.5,\n intensity: 1.0,\n color: undefined,\n // @ts-ignore\n normalDepthBuffer: downSamplingPass ? downSamplingPass.texture : null,\n resolutionScale: resolutionScale ?? 1,\n depthAwareUpsampling: true,\n ...props,\n })\n // NOTE: `props` is an unstable reference, so we can't memoize it\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [camera, downSamplingPass, normalPass, resolutionScale])\n return <primitive ref={ref} object={effect} dispose={null} />\n})\n"],"names":["SSAO"],"mappings":";;;;AAOO,MAAM,OAAO,WAAkC,SAASA,MAAK,OAAkB,KAAsB;AAC1G,QAAM,EAAE,QAAQ,YAAY,kBAAkB,oBAAoB,WAAW,qBAAqB;AAC5F,QAAA,SAAS,QAAyB,MAAM;AACxC,QAAA,eAAe,QAAQ,qBAAqB,MAAM;AACpD,cAAQ,MAAM,0EAA0E;AACxF,aAAO;IACT;AACO,WAAA,IAAI,WAAW,QAAQ,cAAc,CAAC,mBAAoB,WAAmB,UAAU,MAAM;AAAA,MAClG,eAAe,cAAc;AAAA,MAC7B,SAAS;AAAA,MACT,OAAO;AAAA,MACP,mBAAmB;AAAA,MACnB,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,MAChB,cAAc;AAAA,MACd,oBAAoB;AAAA,MACpB,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,WAAW;AAAA,MACX,OAAO;AAAA;AAAA,MAEP,mBAAmB,mBAAmB,iBAAiB,UAAU;AAAA,MACjE,iBAAiB,4CAAmB;AAAA,MACpC,sBAAsB;AAAA,MACtB,GAAG;AAAA,IAAA,CACJ;AAAA,KAGA,CAAC,QAAQ,kBAAkB,YAAY,eAAe,CAAC;AAC1D,6BAAQ,aAAU,EAAA,KAAU,QAAQ,QAAQ,SAAS,KAAM,CAAA;AAC7D,CAAC;"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const React = require("react");
5
- const screenSpaceReflections = require("./screen-space-reflections.cjs");
6
- const EffectComposer = require("../../EffectComposer.cjs");
7
- const Selection = require("../../Selection.cjs");
8
- const fiber = require("@react-three/fiber");
9
- const SSR = React.forwardRef(function SSR2({ ENABLE_BLUR = true, USE_MRT = true, ...props }, ref) {
10
- const invalidate = fiber.useThree((s) => s.invalidate);
11
- const { scene, camera } = React.useContext(EffectComposer.EffectComposerContext);
12
- const effect = React.useMemo(
13
- () => new screenSpaceReflections.SSREffect(scene, camera, { ENABLE_BLUR, USE_MRT, ...props }),
14
- [scene, camera, ENABLE_BLUR, USE_MRT, props]
15
- );
16
- const api = React.useContext(Selection.selectionContext);
17
- React.useEffect(() => {
18
- var _a;
19
- if (api && api.enabled) {
20
- if ((_a = api.selected) == null ? void 0 : _a.length) {
21
- effect.selection.set(api.selected);
22
- invalidate();
23
- return () => {
24
- effect.selection.clear();
25
- invalidate();
26
- };
27
- }
28
- }
29
- }, [api, effect, invalidate]);
30
- return /* @__PURE__ */ jsxRuntime.jsx("primitive", { ref, object: effect, ...props });
31
- });
32
- exports.SSR = SSR;
33
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/effects/SSR/index.tsx"],"sourcesContent":["import React, { Ref, forwardRef, useLayoutEffect, useEffect, useContext, useMemo } from 'react'\n/* @ts-ignore */\nimport { SSREffect } from './screen-space-reflections'\nimport { EffectComposerContext } from '../../EffectComposer'\nimport { selectionContext } from '../../Selection'\nimport { useThree } from '@react-three/fiber'\n\n// first two args are camera and texture\ntype SSRProps = {\n /** whether you want to use Temporal Resolving to re-use reflections from the last frames; this will reduce noise tremendously but may result in \"smearing\" */\n temporalResolve?: boolean\n /** a value between 0 and 1 to set how much the last frame's reflections should be blended in; higher values will result in less noisy reflections when moving the camera but a more smeary look */\n temporalResolveMix?: number\n /** a value between 0 and 1 to set how much the reprojected reflection should be corrected; higher values will reduce smearing but will result in less flickering at reflection edges */\n temporalResolveCorrectionMix?: number\n /** the maximum number of samples for reflections; settings it to 0 means unlimited samples; setting it to a value like 6 can help make camera movements less disruptive when calculating reflections */\n maxSamples?: number\n /** whether to blur the reflections and blend these blurred reflections with the raw ones depending on the blurMix value */\n ENABLE_BLUR?: boolean\n /** how much the blurred reflections should be mixed with the raw reflections */\n blurMix?: number\n /** the sharpness of the Bilateral Filter used to blur reflections */\n blurSharpness?: number\n /** the kernel size of the Bilateral Blur Filter; higher kernel sizes will result in blurrier reflections with more artifacts */\n blurKernelSize?: number\n /** how much the reflection ray should travel in each of its iteration; higher values will give deeper reflections but with more artifacts */\n rayStep?: number\n /** the intensity of the reflections */\n intensity?: number\n /** the maximum roughness a texel can have to have reflections calculated for it */\n maxRoughness?: number\n /** whether jittering is enabled; jittering will randomly jitter the reflections resulting in a more noisy but overall more realistic look, enabling jittering can be expensive depending on the view angle */\n ENABLE_JITTERING?: boolean\n /** how intense jittering should be */\n jitter?: number\n /** how much the jittered rays should be spread; higher values will give a rougher look regarding the reflections but are more expensive to compute with */\n jitterSpread?: number\n /** how intense jittering should be in relation to a material's roughness */\n jitterRough?: number\n /** the number of steps a reflection ray can maximally do to find an object it intersected (and thus reflects) */\n MAX_STEPS?: number\n /** once we had our ray intersect something, we need to find the exact point in space it intersected and thus it reflects; this can be done through binary search with the given number of maximum steps */\n NUM_BINARY_SEARCH_STEPS?: number\n /** the maximum depth difference between a ray and the particular depth at its screen position after refining with binary search; lower values will result in better performance */\n maxDepthDifference?: number\n /** the maximum depth for which reflections will be calculated */\n maxDepth?: number\n /** the maximum depth difference between a ray and the particular depth at its screen position before refining with binary search; lower values will result in better performance */\n thickness?: number\n /** Index of Refraction, used for calculating fresnel; reflections tend to be more intense the steeper the angle between them and the viewer is, the ior parameter set how much the intensity varies */\n ior?: number\n /** if there should still be reflections for rays for which a reflecting point couldn't be found; enabling this will result in stretched looking reflections which can look good or bad depending on the angle */\n STRETCH_MISSED_RAYS?: boolean\n /** WebGL2 only - whether to use multiple render targets when rendering the G-buffers (normals, depth and roughness); using them can improve performance as they will render all information to multiple buffers for each fragment in one run; this setting can't be changed during run-time */\n USE_MRT?: boolean\n /** if roughness maps should be taken account of when calculating reflections */\n USE_ROUGHNESSMAP?: boolean\n /** if normal maps should be taken account of when calculating reflections */\n USE_NORMALMAP?: boolean\n}\n\nexport const SSR = forwardRef<SSREffect, SSRProps>(function SSR(\n { ENABLE_BLUR = true, USE_MRT = true, ...props }: SSRProps,\n\n ref: Ref<SSREffect>\n) {\n const invalidate = useThree((s) => s.invalidate)\n const { scene, camera } = useContext(EffectComposerContext)\n const effect = useMemo(\n () => new SSREffect(scene, camera, { ENABLE_BLUR, USE_MRT, ...props }),\n [scene, camera, ENABLE_BLUR, USE_MRT, props]\n )\n\n const api = useContext(selectionContext)\n useEffect(() => {\n if (api && api.enabled) {\n if (api.selected?.length) {\n effect.selection.set(api.selected)\n invalidate()\n return () => {\n effect.selection.clear()\n invalidate()\n }\n }\n }\n }, [api, effect, invalidate])\n\n return <primitive ref={ref} object={effect} {...props} />\n})\n"],"names":["forwardRef","SSR","useThree","useContext","EffectComposerContext","useMemo","SSREffect","selectionContext","useEffect"],"mappings":";;;;;;;;AA6DO,MAAM,MAAMA,MAAA,WAAgC,SAASC,KAC1D,EAAE,cAAc,MAAM,UAAU,MAAM,GAAG,MAAM,GAE/C,KACA;AACA,QAAM,aAAaC,MAAAA,SAAS,CAAC,MAAM,EAAE,UAAU;AAC/C,QAAM,EAAE,OAAO,OAAO,IAAIC,iBAAWC,eAAqB,qBAAA;AAC1D,QAAM,SAASC,MAAA;AAAA,IACb,MAAM,IAAIC,uBAAAA,UAAU,OAAO,QAAQ,EAAE,aAAa,SAAS,GAAG,OAAO;AAAA,IACrE,CAAC,OAAO,QAAQ,aAAa,SAAS,KAAK;AAAA,EAAA;AAGvC,QAAA,MAAMH,iBAAWI,UAAAA,gBAAgB;AACvCC,QAAAA,UAAU,MAAM;;AACV,QAAA,OAAO,IAAI,SAAS;AAClB,WAAA,SAAI,aAAJ,mBAAc,QAAQ;AACjB,eAAA,UAAU,IAAI,IAAI,QAAQ;AACtB;AACX,eAAO,MAAM;AACX,iBAAO,UAAU;AACN;QAAA;AAAA,MAEf;AAAA,IACF;AAAA,EACC,GAAA,CAAC,KAAK,QAAQ,UAAU,CAAC;AAE5B,wCAAQ,aAAU,EAAA,KAAU,QAAQ,QAAS,GAAG,MAAO,CAAA;AACzD,CAAC;;"}
@@ -1,55 +0,0 @@
1
- import React from 'react';
2
- type SSRProps = {
3
- /** whether you want to use Temporal Resolving to re-use reflections from the last frames; this will reduce noise tremendously but may result in "smearing" */
4
- temporalResolve?: boolean;
5
- /** a value between 0 and 1 to set how much the last frame's reflections should be blended in; higher values will result in less noisy reflections when moving the camera but a more smeary look */
6
- temporalResolveMix?: number;
7
- /** a value between 0 and 1 to set how much the reprojected reflection should be corrected; higher values will reduce smearing but will result in less flickering at reflection edges */
8
- temporalResolveCorrectionMix?: number;
9
- /** the maximum number of samples for reflections; settings it to 0 means unlimited samples; setting it to a value like 6 can help make camera movements less disruptive when calculating reflections */
10
- maxSamples?: number;
11
- /** whether to blur the reflections and blend these blurred reflections with the raw ones depending on the blurMix value */
12
- ENABLE_BLUR?: boolean;
13
- /** how much the blurred reflections should be mixed with the raw reflections */
14
- blurMix?: number;
15
- /** the sharpness of the Bilateral Filter used to blur reflections */
16
- blurSharpness?: number;
17
- /** the kernel size of the Bilateral Blur Filter; higher kernel sizes will result in blurrier reflections with more artifacts */
18
- blurKernelSize?: number;
19
- /** how much the reflection ray should travel in each of its iteration; higher values will give deeper reflections but with more artifacts */
20
- rayStep?: number;
21
- /** the intensity of the reflections */
22
- intensity?: number;
23
- /** the maximum roughness a texel can have to have reflections calculated for it */
24
- maxRoughness?: number;
25
- /** whether jittering is enabled; jittering will randomly jitter the reflections resulting in a more noisy but overall more realistic look, enabling jittering can be expensive depending on the view angle */
26
- ENABLE_JITTERING?: boolean;
27
- /** how intense jittering should be */
28
- jitter?: number;
29
- /** how much the jittered rays should be spread; higher values will give a rougher look regarding the reflections but are more expensive to compute with */
30
- jitterSpread?: number;
31
- /** how intense jittering should be in relation to a material's roughness */
32
- jitterRough?: number;
33
- /** the number of steps a reflection ray can maximally do to find an object it intersected (and thus reflects) */
34
- MAX_STEPS?: number;
35
- /** once we had our ray intersect something, we need to find the exact point in space it intersected and thus it reflects; this can be done through binary search with the given number of maximum steps */
36
- NUM_BINARY_SEARCH_STEPS?: number;
37
- /** the maximum depth difference between a ray and the particular depth at its screen position after refining with binary search; lower values will result in better performance */
38
- maxDepthDifference?: number;
39
- /** the maximum depth for which reflections will be calculated */
40
- maxDepth?: number;
41
- /** the maximum depth difference between a ray and the particular depth at its screen position before refining with binary search; lower values will result in better performance */
42
- thickness?: number;
43
- /** Index of Refraction, used for calculating fresnel; reflections tend to be more intense the steeper the angle between them and the viewer is, the ior parameter set how much the intensity varies */
44
- ior?: number;
45
- /** if there should still be reflections for rays for which a reflecting point couldn't be found; enabling this will result in stretched looking reflections which can look good or bad depending on the angle */
46
- STRETCH_MISSED_RAYS?: boolean;
47
- /** WebGL2 only - whether to use multiple render targets when rendering the G-buffers (normals, depth and roughness); using them can improve performance as they will render all information to multiple buffers for each fragment in one run; this setting can't be changed during run-time */
48
- USE_MRT?: boolean;
49
- /** if roughness maps should be taken account of when calculating reflections */
50
- USE_ROUGHNESSMAP?: boolean;
51
- /** if normal maps should be taken account of when calculating reflections */
52
- USE_NORMALMAP?: boolean;
53
- };
54
- export declare const SSR: React.ForwardRefExoticComponent<SSRProps & React.RefAttributes<SSREffect>>;
55
- export {};
@@ -1,33 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { forwardRef, useContext, useMemo, useEffect } from "react";
3
- import { SSREffect } from "./screen-space-reflections.js";
4
- import { EffectComposerContext } from "../../EffectComposer.js";
5
- import { selectionContext } from "../../Selection.js";
6
- import { useThree } from "@react-three/fiber";
7
- const SSR = forwardRef(function SSR2({ ENABLE_BLUR = true, USE_MRT = true, ...props }, ref) {
8
- const invalidate = useThree((s) => s.invalidate);
9
- const { scene, camera } = useContext(EffectComposerContext);
10
- const effect = useMemo(
11
- () => new SSREffect(scene, camera, { ENABLE_BLUR, USE_MRT, ...props }),
12
- [scene, camera, ENABLE_BLUR, USE_MRT, props]
13
- );
14
- const api = useContext(selectionContext);
15
- useEffect(() => {
16
- var _a;
17
- if (api && api.enabled) {
18
- if ((_a = api.selected) == null ? void 0 : _a.length) {
19
- effect.selection.set(api.selected);
20
- invalidate();
21
- return () => {
22
- effect.selection.clear();
23
- invalidate();
24
- };
25
- }
26
- }
27
- }, [api, effect, invalidate]);
28
- return /* @__PURE__ */ jsx("primitive", { ref, object: effect, ...props });
29
- });
30
- export {
31
- SSR
32
- };
33
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/effects/SSR/index.tsx"],"sourcesContent":["import React, { Ref, forwardRef, useLayoutEffect, useEffect, useContext, useMemo } from 'react'\n/* @ts-ignore */\nimport { SSREffect } from './screen-space-reflections'\nimport { EffectComposerContext } from '../../EffectComposer'\nimport { selectionContext } from '../../Selection'\nimport { useThree } from '@react-three/fiber'\n\n// first two args are camera and texture\ntype SSRProps = {\n /** whether you want to use Temporal Resolving to re-use reflections from the last frames; this will reduce noise tremendously but may result in \"smearing\" */\n temporalResolve?: boolean\n /** a value between 0 and 1 to set how much the last frame's reflections should be blended in; higher values will result in less noisy reflections when moving the camera but a more smeary look */\n temporalResolveMix?: number\n /** a value between 0 and 1 to set how much the reprojected reflection should be corrected; higher values will reduce smearing but will result in less flickering at reflection edges */\n temporalResolveCorrectionMix?: number\n /** the maximum number of samples for reflections; settings it to 0 means unlimited samples; setting it to a value like 6 can help make camera movements less disruptive when calculating reflections */\n maxSamples?: number\n /** whether to blur the reflections and blend these blurred reflections with the raw ones depending on the blurMix value */\n ENABLE_BLUR?: boolean\n /** how much the blurred reflections should be mixed with the raw reflections */\n blurMix?: number\n /** the sharpness of the Bilateral Filter used to blur reflections */\n blurSharpness?: number\n /** the kernel size of the Bilateral Blur Filter; higher kernel sizes will result in blurrier reflections with more artifacts */\n blurKernelSize?: number\n /** how much the reflection ray should travel in each of its iteration; higher values will give deeper reflections but with more artifacts */\n rayStep?: number\n /** the intensity of the reflections */\n intensity?: number\n /** the maximum roughness a texel can have to have reflections calculated for it */\n maxRoughness?: number\n /** whether jittering is enabled; jittering will randomly jitter the reflections resulting in a more noisy but overall more realistic look, enabling jittering can be expensive depending on the view angle */\n ENABLE_JITTERING?: boolean\n /** how intense jittering should be */\n jitter?: number\n /** how much the jittered rays should be spread; higher values will give a rougher look regarding the reflections but are more expensive to compute with */\n jitterSpread?: number\n /** how intense jittering should be in relation to a material's roughness */\n jitterRough?: number\n /** the number of steps a reflection ray can maximally do to find an object it intersected (and thus reflects) */\n MAX_STEPS?: number\n /** once we had our ray intersect something, we need to find the exact point in space it intersected and thus it reflects; this can be done through binary search with the given number of maximum steps */\n NUM_BINARY_SEARCH_STEPS?: number\n /** the maximum depth difference between a ray and the particular depth at its screen position after refining with binary search; lower values will result in better performance */\n maxDepthDifference?: number\n /** the maximum depth for which reflections will be calculated */\n maxDepth?: number\n /** the maximum depth difference between a ray and the particular depth at its screen position before refining with binary search; lower values will result in better performance */\n thickness?: number\n /** Index of Refraction, used for calculating fresnel; reflections tend to be more intense the steeper the angle between them and the viewer is, the ior parameter set how much the intensity varies */\n ior?: number\n /** if there should still be reflections for rays for which a reflecting point couldn't be found; enabling this will result in stretched looking reflections which can look good or bad depending on the angle */\n STRETCH_MISSED_RAYS?: boolean\n /** WebGL2 only - whether to use multiple render targets when rendering the G-buffers (normals, depth and roughness); using them can improve performance as they will render all information to multiple buffers for each fragment in one run; this setting can't be changed during run-time */\n USE_MRT?: boolean\n /** if roughness maps should be taken account of when calculating reflections */\n USE_ROUGHNESSMAP?: boolean\n /** if normal maps should be taken account of when calculating reflections */\n USE_NORMALMAP?: boolean\n}\n\nexport const SSR = forwardRef<SSREffect, SSRProps>(function SSR(\n { ENABLE_BLUR = true, USE_MRT = true, ...props }: SSRProps,\n\n ref: Ref<SSREffect>\n) {\n const invalidate = useThree((s) => s.invalidate)\n const { scene, camera } = useContext(EffectComposerContext)\n const effect = useMemo(\n () => new SSREffect(scene, camera, { ENABLE_BLUR, USE_MRT, ...props }),\n [scene, camera, ENABLE_BLUR, USE_MRT, props]\n )\n\n const api = useContext(selectionContext)\n useEffect(() => {\n if (api && api.enabled) {\n if (api.selected?.length) {\n effect.selection.set(api.selected)\n invalidate()\n return () => {\n effect.selection.clear()\n invalidate()\n }\n }\n }\n }, [api, effect, invalidate])\n\n return <primitive ref={ref} object={effect} {...props} />\n})\n"],"names":["SSR"],"mappings":";;;;;;AA6DO,MAAM,MAAM,WAAgC,SAASA,KAC1D,EAAE,cAAc,MAAM,UAAU,MAAM,GAAG,MAAM,GAE/C,KACA;AACA,QAAM,aAAa,SAAS,CAAC,MAAM,EAAE,UAAU;AAC/C,QAAM,EAAE,OAAO,OAAO,IAAI,WAAW,qBAAqB;AAC1D,QAAM,SAAS;AAAA,IACb,MAAM,IAAI,UAAU,OAAO,QAAQ,EAAE,aAAa,SAAS,GAAG,OAAO;AAAA,IACrE,CAAC,OAAO,QAAQ,aAAa,SAAS,KAAK;AAAA,EAAA;AAGvC,QAAA,MAAM,WAAW,gBAAgB;AACvC,YAAU,MAAM;;AACV,QAAA,OAAO,IAAI,SAAS;AAClB,WAAA,SAAI,aAAJ,mBAAc,QAAQ;AACjB,eAAA,UAAU,IAAI,IAAI,QAAQ;AACtB;AACX,eAAO,MAAM;AACX,iBAAO,UAAU;AACN;QAAA;AAAA,MAEf;AAAA,IACF;AAAA,EACC,GAAA,CAAC,KAAK,QAAQ,UAAU,CAAC;AAE5B,6BAAQ,aAAU,EAAA,KAAU,QAAQ,QAAS,GAAG,MAAO,CAAA;AACzD,CAAC;"}