@react-three/postprocessing 2.15.1 → 2.15.2
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.
- package/dist/EffectComposer.cjs +126 -0
- package/dist/EffectComposer.cjs.map +1 -0
- package/dist/EffectComposer.js +126 -0
- package/dist/EffectComposer.js.map +1 -0
- package/dist/Selection.cjs +36 -0
- package/dist/Selection.cjs.map +1 -0
- package/dist/Selection.js +36 -0
- package/dist/Selection.js.map +1 -0
- package/dist/effects/ASCII.cjs +105 -0
- package/dist/effects/ASCII.cjs.map +1 -0
- package/dist/effects/ASCII.js +105 -0
- package/dist/effects/ASCII.js.map +1 -0
- package/dist/effects/Autofocus.cjs +126 -0
- package/dist/effects/Autofocus.cjs.map +1 -0
- package/dist/effects/Autofocus.js +109 -0
- package/dist/effects/Autofocus.js.map +1 -0
- package/dist/effects/Bloom.cjs +9 -0
- package/dist/effects/Bloom.cjs.map +1 -0
- package/dist/effects/Bloom.js +9 -0
- package/dist/effects/Bloom.js.map +1 -0
- package/dist/effects/BrightnessContrast.cjs +7 -0
- package/dist/effects/BrightnessContrast.cjs.map +1 -0
- package/dist/effects/BrightnessContrast.js +7 -0
- package/dist/effects/BrightnessContrast.js.map +1 -0
- package/dist/effects/ChromaticAberration.cjs +7 -0
- package/dist/effects/ChromaticAberration.cjs.map +1 -0
- package/dist/effects/ChromaticAberration.js +7 -0
- package/dist/effects/ChromaticAberration.js.map +1 -0
- package/dist/effects/ColorAverage.cjs +11 -0
- package/dist/effects/ColorAverage.cjs.map +1 -0
- package/dist/effects/ColorAverage.js +11 -0
- package/dist/effects/ColorAverage.js.map +1 -0
- package/dist/effects/ColorDepth.cjs +7 -0
- package/dist/effects/ColorDepth.cjs.map +1 -0
- package/dist/effects/ColorDepth.js +7 -0
- package/dist/effects/ColorDepth.js.map +1 -0
- package/dist/effects/Depth.cjs +7 -0
- package/dist/effects/Depth.cjs.map +1 -0
- package/dist/effects/Depth.js +7 -0
- package/dist/effects/Depth.js.map +1 -0
- package/dist/effects/DepthOfField.cjs +74 -0
- package/dist/effects/DepthOfField.cjs.map +1 -0
- package/dist/effects/DepthOfField.js +74 -0
- package/dist/effects/DepthOfField.js.map +1 -0
- package/dist/effects/DotScreen.cjs +7 -0
- package/dist/effects/DotScreen.cjs.map +1 -0
- package/dist/effects/DotScreen.js +7 -0
- package/dist/effects/DotScreen.js.map +1 -0
- package/dist/effects/FXAA.cjs +7 -0
- package/dist/effects/FXAA.cjs.map +1 -0
- package/dist/effects/FXAA.js +7 -0
- package/dist/effects/FXAA.js.map +1 -0
- package/dist/effects/Glitch.cjs +30 -0
- package/dist/effects/Glitch.cjs.map +1 -0
- package/dist/effects/Glitch.js +30 -0
- package/dist/effects/Glitch.js.map +1 -0
- package/dist/effects/GodRays.cjs +15 -0
- package/dist/effects/GodRays.cjs.map +1 -0
- package/dist/effects/GodRays.js +15 -0
- package/dist/effects/GodRays.js.map +1 -0
- package/dist/effects/Grid.cjs +18 -0
- package/dist/effects/Grid.cjs.map +1 -0
- package/dist/effects/Grid.js +18 -0
- package/dist/effects/Grid.js.map +1 -0
- package/dist/effects/HueSaturation.cjs +7 -0
- package/dist/effects/HueSaturation.cjs.map +1 -0
- package/dist/effects/HueSaturation.js +7 -0
- package/dist/effects/HueSaturation.js.map +1 -0
- package/dist/effects/LUT.cjs +20 -0
- package/dist/effects/LUT.cjs.map +1 -0
- package/dist/effects/LUT.js +20 -0
- package/dist/effects/LUT.js.map +1 -0
- package/dist/effects/LensFlare.cjs +189 -0
- package/dist/effects/LensFlare.cjs.map +1 -0
- package/dist/effects/LensFlare.js +172 -0
- package/dist/effects/LensFlare.js.map +1 -0
- package/dist/effects/N8AO.cjs +59 -0
- package/dist/effects/N8AO.cjs.map +1 -0
- package/dist/effects/N8AO.js +59 -0
- package/dist/effects/N8AO.js.map +1 -0
- package/dist/effects/Noise.cjs +7 -0
- package/dist/effects/Noise.cjs.map +1 -0
- package/dist/effects/Noise.js +7 -0
- package/dist/effects/Noise.js.map +1 -0
- package/dist/effects/Outline.cjs +93 -0
- package/dist/effects/Outline.cjs.map +1 -0
- package/dist/effects/Outline.js +93 -0
- package/dist/effects/Outline.js.map +1 -0
- package/dist/effects/Pixelation.cjs +11 -0
- package/dist/effects/Pixelation.cjs.map +1 -0
- package/dist/effects/Pixelation.js +11 -0
- package/dist/effects/Pixelation.js.map +1 -0
- package/dist/effects/SMAA.cjs +7 -0
- package/dist/effects/SMAA.cjs.map +1 -0
- package/dist/effects/SMAA.js +7 -0
- package/dist/effects/SMAA.js.map +1 -0
- package/dist/effects/SSAO.cjs +37 -0
- package/dist/effects/SSAO.cjs.map +1 -0
- package/dist/effects/SSAO.js +37 -0
- package/dist/effects/SSAO.js.map +1 -0
- package/dist/effects/SSR/index.cjs +33 -0
- package/dist/effects/SSR/index.cjs.map +1 -0
- package/dist/effects/SSR/index.js +33 -0
- package/dist/effects/SSR/index.js.map +1 -0
- package/dist/effects/SSR/screen-space-reflections.cjs +1133 -0
- package/dist/effects/SSR/screen-space-reflections.cjs.map +1 -0
- package/dist/effects/SSR/screen-space-reflections.js +1133 -0
- package/dist/effects/SSR/screen-space-reflections.js.map +1 -0
- package/dist/effects/ScanlineEffect.cjs +7 -0
- package/dist/effects/ScanlineEffect.cjs.map +1 -0
- package/dist/effects/ScanlineEffect.js +7 -0
- package/dist/effects/ScanlineEffect.js.map +1 -0
- package/dist/effects/SelectiveBloom.cjs +87 -0
- package/dist/effects/SelectiveBloom.cjs.map +1 -0
- package/dist/effects/SelectiveBloom.js +87 -0
- package/dist/effects/SelectiveBloom.js.map +1 -0
- package/dist/effects/Sepia.cjs +7 -0
- package/dist/effects/Sepia.cjs.map +1 -0
- package/dist/effects/Sepia.js +7 -0
- package/dist/effects/Sepia.js.map +1 -0
- package/dist/effects/ShockWave.cjs +7 -0
- package/dist/effects/ShockWave.cjs.map +1 -0
- package/dist/effects/ShockWave.js +7 -0
- package/dist/effects/ShockWave.js.map +1 -0
- package/dist/effects/Texture.cjs +18 -0
- package/dist/effects/Texture.cjs.map +1 -0
- package/dist/effects/Texture.js +18 -0
- package/dist/effects/Texture.js.map +1 -0
- package/dist/effects/TiltShift.cjs +7 -0
- package/dist/effects/TiltShift.cjs.map +1 -0
- package/dist/effects/TiltShift.js +7 -0
- package/dist/effects/TiltShift.js.map +1 -0
- package/dist/effects/TiltShift2.cjs +98 -0
- package/dist/effects/TiltShift2.cjs.map +1 -0
- package/dist/effects/TiltShift2.js +98 -0
- package/dist/effects/TiltShift2.js.map +1 -0
- package/dist/effects/ToneMapping.cjs +7 -0
- package/dist/effects/ToneMapping.cjs.map +1 -0
- package/dist/effects/ToneMapping.js +7 -0
- package/dist/effects/ToneMapping.js.map +1 -0
- package/dist/effects/Vignette.cjs +7 -0
- package/dist/effects/Vignette.cjs.map +1 -0
- package/dist/effects/Vignette.js +7 -0
- package/dist/effects/Vignette.js.map +1 -0
- package/dist/index.cjs +79 -3661
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -3602
- package/dist/index.js.map +1 -1
- package/dist/node_modules/n8ao/dist/N8AO.cjs +1439 -0
- package/dist/node_modules/n8ao/dist/N8AO.cjs.map +1 -0
- package/dist/node_modules/n8ao/dist/N8AO.js +1439 -0
- package/dist/node_modules/n8ao/dist/N8AO.js.map +1 -0
- package/dist/util.cjs +69 -0
- package/dist/util.cjs.map +1 -0
- package/dist/util.js +52 -0
- package/dist/util.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SMAA.js","sources":["../../src/effects/SMAA.tsx"],"sourcesContent":["import { SMAAEffect } from 'postprocessing'\nimport { wrapEffect } from '../util'\n\nexport const SMAA = wrapEffect(SMAAEffect)\n"],"names":[],"mappings":";;AAGa,MAAA,OAAO,WAAW,UAAU;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 postprocessing = require("postprocessing");
|
|
6
|
+
const EffectComposer = require("../EffectComposer.cjs");
|
|
7
|
+
const SSAO = React.forwardRef(function SSAO2(props, ref) {
|
|
8
|
+
const { camera, normalPass, downSamplingPass, resolutionScale } = React.useContext(EffectComposer.EffectComposerContext);
|
|
9
|
+
const effect = React.useMemo(() => {
|
|
10
|
+
if (normalPass === null && downSamplingPass === null) {
|
|
11
|
+
console.error("Please enable the NormalPass in the EffectComposer in order to use SSAO.");
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
return new postprocessing.SSAOEffect(camera, normalPass && !downSamplingPass ? normalPass.texture : null, {
|
|
15
|
+
blendFunction: postprocessing.BlendFunction.MULTIPLY,
|
|
16
|
+
samples: 30,
|
|
17
|
+
rings: 4,
|
|
18
|
+
distanceThreshold: 1,
|
|
19
|
+
distanceFalloff: 0,
|
|
20
|
+
rangeThreshold: 0.5,
|
|
21
|
+
rangeFalloff: 0.1,
|
|
22
|
+
luminanceInfluence: 0.9,
|
|
23
|
+
radius: 20,
|
|
24
|
+
bias: 0.5,
|
|
25
|
+
intensity: 1,
|
|
26
|
+
color: void 0,
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
normalDepthBuffer: downSamplingPass ? downSamplingPass.texture : null,
|
|
29
|
+
resolutionScale: resolutionScale != null ? resolutionScale : 1,
|
|
30
|
+
depthAwareUpsampling: true,
|
|
31
|
+
...props
|
|
32
|
+
});
|
|
33
|
+
}, [camera, normalPass, props]);
|
|
34
|
+
return /* @__PURE__ */ jsxRuntime.jsx("primitive", { ref, object: effect, dispose: null });
|
|
35
|
+
});
|
|
36
|
+
exports.SSAO = SSAO;
|
|
37
|
+
//# sourceMappingURL=SSAO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SSAO.cjs","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 }, [camera, normalPass, props])\n return <primitive ref={ref} object={effect} dispose={null} />\n})\n"],"names":["forwardRef","SSAO","useContext","EffectComposerContext","useMemo","SSAOEffect","BlendFunction"],"mappings":";;;;;;AAOO,MAAM,OAAOA,MAAAA,WAAkC,SAASC,MAAK,OAAkB,KAAsB;AAC1G,QAAM,EAAE,QAAQ,YAAY,kBAAkB,oBAAoBC,MAAAA,WAAWC,eAAAA,qBAAqB;AAC5F,QAAA,SAASC,MAAAA,QAAyB,MAAM;AACxC,QAAA,eAAe,QAAQ,qBAAqB,MAAM;AACpD,cAAQ,MAAM,0EAA0E;AACxF,aAAO;IACT;AACO,WAAA,IAAIC,eAAAA,WAAW,QAAQ,cAAc,CAAC,mBAAoB,WAAmB,UAAU,MAAM;AAAA,MAClG,eAAeC,eAAc,cAAA;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,EACA,GAAA,CAAC,QAAQ,YAAY,KAAK,CAAC;AAC9B,wCAAQ,aAAU,EAAA,KAAU,QAAQ,QAAQ,SAAS,KAAM,CAAA;AAC7D,CAAC;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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, normalPass, props]);
|
|
32
|
+
return /* @__PURE__ */ jsx("primitive", { ref, object: effect, dispose: null });
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
SSAO
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=SSAO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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 }, [camera, normalPass, props])\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,EACA,GAAA,CAAC,QAAQ,YAAY,KAAK,CAAC;AAC9B,6BAAQ,aAAU,EAAA,KAAU,QAAQ,QAAQ,SAAS,KAAM,CAAA;AAC7D,CAAC;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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();
|
|
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]);
|
|
30
|
+
return /* @__PURE__ */ jsxRuntime.jsx("primitive", { ref, object: effect, ...props });
|
|
31
|
+
});
|
|
32
|
+
exports.SSR = SSR;
|
|
33
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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()\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])\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;AACM,QAAA,EAAE,eAAeC,MAAAA;AACvB,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,EAAA,GACC,CAAC,GAAG,CAAC;AAER,wCAAQ,aAAU,EAAA,KAAU,QAAQ,QAAS,GAAG,MAAO,CAAA;AACzD,CAAC;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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();
|
|
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]);
|
|
28
|
+
return /* @__PURE__ */ jsx("primitive", { ref, object: effect, ...props });
|
|
29
|
+
});
|
|
30
|
+
export {
|
|
31
|
+
SSR
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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()\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])\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;AACM,QAAA,EAAE,eAAe;AACvB,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,EAAA,GACC,CAAC,GAAG,CAAC;AAER,6BAAQ,aAAU,EAAA,KAAU,QAAQ,QAAS,GAAG,MAAO,CAAA;AACzD,CAAC;"}
|