@react-three/postprocessing 2.6.2 → 2.7.1
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/README.md +24 -1
- package/dist/effects/TiltShift.d.ts +17 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@react-three/postprocessing)
|
|
5
5
|
[](https://discord.gg/ZZjjNvJ)
|
|
6
6
|
|
|
7
|
-
`react-postprocessing` is a [postprocessing](https://github.com/pmndrs/postprocessing) wrapper for [@react-three/fiber](https://github.com/pmndrs
|
|
7
|
+
`react-postprocessing` is a [postprocessing](https://github.com/pmndrs/postprocessing) wrapper for [@react-three/fiber](https://github.com/pmndrs/react-three-fiber). This is not (yet) meant for complex orchestration of effects, but can save you [hundreds of LOC](https://twitter.com/0xca0a/status/1289501594698960897) for a straight forward effects-chain.
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npm install @react-three/postprocessing
|
|
@@ -123,5 +123,28 @@ Selection can be nested and group multiple object, higher up selection take prec
|
|
|
123
123
|
</Select>
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
+
#### Selective bloom
|
|
127
|
+
|
|
128
|
+
Bloom is selective by default, you control it not on the effect pass but on the materials by lifting their colors out of 0-1 range. a `luminanceThreshold` of 1 ensures that ootb nothing will glow, only the materials you pick. For this to work `toneMapped` has to be false on the materials, because it would otherwise clamp colors between 0 and 1 again.
|
|
129
|
+
|
|
130
|
+
```jsx
|
|
131
|
+
<Bloom mipmapBlur luminanceThreshold={1} />
|
|
132
|
+
|
|
133
|
+
// ❌ will not glow, same as RGB [1,0,0]
|
|
134
|
+
<meshStandardMaterial color="red"/>
|
|
135
|
+
|
|
136
|
+
// ✅ will glow, same as RGB [2,0,0]
|
|
137
|
+
<meshStandardMaterial emissive="red" emissiveIntensity={2} toneMapped={false} />
|
|
138
|
+
|
|
139
|
+
// ❌ will not glow, same as RGB [1,0,0]
|
|
140
|
+
<meshBasicMaterial color="red" />
|
|
141
|
+
|
|
142
|
+
// ❌ will not glow, same as RGB [1,0,0], tone-mapping will clamp colors between 0 and 1
|
|
143
|
+
<meshBasicMaterial color={[2,0,0]} />
|
|
144
|
+
|
|
145
|
+
// ✅ will glow, same as RGB [2,0,0]
|
|
146
|
+
<meshBasicMaterial color={[2,0,0]} toneMapped={false} />
|
|
147
|
+
```
|
|
148
|
+
|
|
126
149
|
- [react-postprocessing exports](https://github.com/pmndrs/react-postprocessing/blob/master/api.md)
|
|
127
150
|
- [postprocessing docs](https://pmndrs.github.io/postprocessing/public/docs/)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TiltShiftEffect, BlendFunction } from 'postprocessing';
|
|
3
|
+
export declare const TiltShift: import("react").ForwardRefExoticComponent<{
|
|
4
|
+
blendFunction?: BlendFunction;
|
|
5
|
+
offset?: number;
|
|
6
|
+
rotation?: number;
|
|
7
|
+
focusArea?: number;
|
|
8
|
+
feather?: number;
|
|
9
|
+
bias?: number;
|
|
10
|
+
kernelSize?: KernelSize;
|
|
11
|
+
resolutionScale?: number;
|
|
12
|
+
resolutionX?: Resolution;
|
|
13
|
+
resolutionY?: Resolutio;
|
|
14
|
+
} & Partial<{
|
|
15
|
+
blendFunction: BlendFunction;
|
|
16
|
+
opacity: number;
|
|
17
|
+
}> & import("react").RefAttributes<typeof TiltShiftEffect>>;
|
package/dist/index.cjs
CHANGED
|
@@ -700,6 +700,8 @@ var LUT = /*#__PURE__*/React.forwardRef(function LUT(_ref, ref) {
|
|
|
700
700
|
});
|
|
701
701
|
});
|
|
702
702
|
|
|
703
|
+
var TiltShift = wrapEffect(postprocessing.TiltShiftEffect, postprocessing.BlendFunction.ADD);
|
|
704
|
+
|
|
703
705
|
var _excluded = ["ENABLE_BLUR", "USE_MRT"];
|
|
704
706
|
|
|
705
707
|
var SSR = /*#__PURE__*/React.forwardRef(function SSR(_ref, ref) {
|
|
@@ -777,6 +779,7 @@ exports.SelectiveBloom = SelectiveBloom;
|
|
|
777
779
|
exports.Sepia = Sepia;
|
|
778
780
|
exports.ShockWave = ShockWave;
|
|
779
781
|
exports.Texture = Texture;
|
|
782
|
+
exports.TiltShift = TiltShift;
|
|
780
783
|
exports.ToneMapping = ToneMapping;
|
|
781
784
|
exports.Vignette = Vignette;
|
|
782
785
|
exports.selectionContext = selectionContext;
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from './effects/ToneMapping';
|
|
|
23
23
|
export * from './effects/Vignette';
|
|
24
24
|
export * from './effects/ShockWave';
|
|
25
25
|
export * from './effects/LUT';
|
|
26
|
+
export * from './effects/TiltShift';
|
|
26
27
|
export * from './effects/SSR';
|
|
27
28
|
export * from './Selection';
|
|
28
29
|
export * from './EffectComposer';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BlendFunction, BloomEffect, BrightnessContrastEffect, ChromaticAberrationEffect, ColorAverageEffect, ColorDepthEffect, DepthEffect, EffectComposer as EffectComposer$1, RenderPass, NormalPass, DepthDownsamplingPass, EffectPass, DepthOfFieldEffect, DotScreenEffect, GlitchEffect, GlitchMode, GodRaysEffect, GridEffect, HueSaturationEffect, NoiseEffect, OutlineEffect, PixelationEffect, ScanlineEffect, SelectiveBloomEffect, SepiaEffect, SSAOEffect, SMAAPreset, EdgeDetectionMode, SMAAImageLoader, SMAAEffect, TextureEffect, ToneMappingEffect, VignetteEffect, ShockWaveEffect, LUTEffect } from 'postprocessing';
|
|
1
|
+
import { BlendFunction, BloomEffect, BrightnessContrastEffect, ChromaticAberrationEffect, ColorAverageEffect, ColorDepthEffect, DepthEffect, EffectComposer as EffectComposer$1, RenderPass, NormalPass, DepthDownsamplingPass, EffectPass, DepthOfFieldEffect, DotScreenEffect, GlitchEffect, GlitchMode, GodRaysEffect, GridEffect, HueSaturationEffect, NoiseEffect, OutlineEffect, PixelationEffect, ScanlineEffect, SelectiveBloomEffect, SepiaEffect, SSAOEffect, SMAAPreset, EdgeDetectionMode, SMAAImageLoader, SMAAEffect, TextureEffect, ToneMappingEffect, VignetteEffect, ShockWaveEffect, LUTEffect, TiltShiftEffect } from 'postprocessing';
|
|
2
2
|
import React, { forwardRef, useMemo, useLayoutEffect, createContext, useEffect, useRef, useImperativeHandle, useContext, useState } from 'react';
|
|
3
3
|
import { Vector2, HalfFloatType, Vector3, TextureLoader, sRGBEncoding, RepeatWrapping } from 'three';
|
|
4
4
|
import { useThree, useFrame, useLoader } from '@react-three/fiber';
|
|
@@ -599,6 +599,8 @@ const LUT = /*#__PURE__*/forwardRef(function LUT(_ref, ref) {
|
|
|
599
599
|
});
|
|
600
600
|
});
|
|
601
601
|
|
|
602
|
+
const TiltShift = wrapEffect(TiltShiftEffect, BlendFunction.ADD);
|
|
603
|
+
|
|
602
604
|
const SSR = /*#__PURE__*/forwardRef(function SSR(_ref, ref) {
|
|
603
605
|
let {
|
|
604
606
|
ENABLE_BLUR = true,
|
|
@@ -642,4 +644,4 @@ const SSR = /*#__PURE__*/forwardRef(function SSR(_ref, ref) {
|
|
|
642
644
|
});
|
|
643
645
|
});
|
|
644
646
|
|
|
645
|
-
export { Bloom, BrightnessContrast, ChromaticAberration, ColorAverage, ColorDepth, Depth, DepthOfField, DotScreen, EffectComposer, EffectComposerContext, Glitch, GodRays, Grid, HueSaturation, LUT, Noise, Outline, Pixelation, SMAA, SSAO, SSR, Scanline, Select, Selection, SelectiveBloom, Sepia, ShockWave, Texture, ToneMapping, Vignette, selectionContext };
|
|
647
|
+
export { Bloom, BrightnessContrast, ChromaticAberration, ColorAverage, ColorDepth, Depth, DepthOfField, DotScreen, EffectComposer, EffectComposerContext, Glitch, GodRays, Grid, HueSaturation, LUT, Noise, Outline, Pixelation, SMAA, SSAO, SSR, Scanline, Select, Selection, SelectiveBloom, Sepia, ShockWave, Texture, TiltShift, ToneMapping, Vignette, selectionContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-three/postprocessing",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "postprocessing wrapper for React and @react-three/fiber",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"postprocessing",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"typegen": "tsc --emitDeclarationOnly || true"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"postprocessing": "^6.
|
|
42
|
+
"postprocessing": "^6.30.1",
|
|
43
43
|
"react-merge-refs": "^1.1.0",
|
|
44
44
|
"screen-space-reflections": "2.5.0",
|
|
45
45
|
"three-stdlib": "^2.8.11"
|