Skip to content

Commit 404d303

Browse files
Merge branch 'master' into rc
2 parents 732bd89 + eb0d5fb commit 404d303

File tree

9 files changed

+782
-175
lines changed

9 files changed

+782
-175
lines changed

docs/effect-composer.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The `EffectComposer` must wrap all your effects. It will manage them for you.
99
<EffectComposer
1010
enabled?: boolean
1111
depthBuffer?: boolean
12-
disableNormalPass?: boolean
12+
enableNormalPass?: boolean
1313
stencilBuffer?: boolean
1414
autoClear?: boolean
1515
multisampling?: number

docs/effects/lensflare.mdx

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,48 +10,29 @@ Based on [ektogamat/R3F-Ultimate-Lens-Flare](https://github.com/ektogamat/R3F-Ul
1010
```jsx
1111
import { LensFlare } from '@react-three/postprocessing'
1212

13-
return (
14-
<LensFlare
15-
blendFunction={BlendFunction.Screen} // The blend function of this effect.
16-
enabled={true} // Boolean to enable/disable the effect.
17-
opacity={1.0} // The opacity for this effect. Default: 1.0
18-
starBurst={true} // Boolean to enable/disable the start burst effect. Can be disabled to improve performance.
19-
glareSize={0.96} // The glare size. Default: 0.2
20-
followMouse={false} // Set it to follow the mouse, ignoring the lens position. Default: false
21-
lensPosition={[0, 0.5, 0]} // The position of the lens flare in 3d space.
22-
starPoints={6} // The number of points for the star. Default: 6
23-
flareSize={0.01} // The flare side. Default 0.01
24-
flareSpeed={0.01} // The flare animation speed. Default 0.01
25-
flareShape={0.01} // Changes the appearance to anamorphic. Default 0.01
26-
animated={true} // Animated flare. Default: true
27-
anamorphic={false} //Set the appearance to full anamorphic. Default: false
28-
colorGain={new THREE.Color(70, 70, 70)} // Set the color gain for the lens flare. Must be a THREE.Color in RBG format.
29-
lensDirtTexture={'/lensDirtTexture.png'} // Texture to be used as color dirt for starburst effect.
30-
haloScale={0.5} // The halo scale. Default: 0.5
31-
secondaryGhosts={true} // Option to enable/disable secondary ghosts. Default: true.
32-
ghostScale={0.0} // Option to enable/disable secondary ghosts. Default: true.
33-
aditionalStreaks={true} // Option to enable/disable aditional streaks. Default: true.
34-
smoothTime={0.07} // The time that it takes to fade the occlusion. Default: 0.07
35-
/>
36-
)
13+
return <LensFlare />
3714
```
3815

39-
#### Ignoring occlusion on some objects
16+
## Ignoring occlusion on some objects
4017

4118
To disable the occlusion effect, simply add `userData={{ lensflare: 'no-occlusion' }}` to your object/mesh props.
4219

43-
#### Improving performance
20+
## Improving performance
4421

4522
Use bvh `<bvh><Scene></bvh>` to enhance the internal raycaster performance.
4623

47-
#### Limitations
24+
## Limitations
4825

4926
The Ultimate Lens Flare leverages the raycaster to examine the material type of objects and determine if they are `MeshTransmissionMaterial` or `MeshPhysicalMaterial`. It checks for the transmission parameter to identify glass-like materials. Therefore, for an object to behave like glass, its material should have either `transmission = 1` or `transparent = true` and `opacity = NUMBER`. The effect automatically interprets the opacity `NUMBER` value to determine the brightness of the flare.
5027

51-
#### Credits
28+
## Credits
5229

5330
- https://www.shadertoy.com/view/4sK3W3
5431
- https://www.shadertoy.com/view/4sX3Rs
5532
- https://www.shadertoy.com/view/dllSRX
5633
- https://www.shadertoy.com/view/Xlc3D2
5734
- https://www.shadertoy.com/view/XtKfRV
35+
36+
## Example
37+
38+
<Codesandbox id="5ydkm4" />

docs/effects/ramp.mdx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: Ramp
3+
nav: 1
4+
---
5+
6+
Ramp effect for linear and radial color gradients, as well as masking of effects before it in the effect array.
7+
8+
```jsx
9+
import { Ramp, RampType } from '@react-three/postprocessing'
10+
11+
return (
12+
<Ramp
13+
rampType={RampType.Linear}
14+
rampStart={[0.5, 0.5]}
15+
rampEnd={[1.0, 1.0]}
16+
startColor={[0, 0, 0, 1]}
17+
endColor={[1, 1, 1, 1]}
18+
rampBias={0.5}
19+
rampGain={0.5}
20+
rampMask={false}
21+
rampInvert={false}
22+
/>
23+
)
24+
```
25+
26+
## Example
27+
28+
<Codesandbox id="zdpzei" />
29+
30+
## Props
31+
32+
| Name | Type | Default | Description |
33+
| ---------- | -------------------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------- |
34+
| rampType | RampType | RampType.Linear | Type of ramp gradient. |
35+
| rampStart | [x: number, y: number] | [0.5, 0.5] | Starting point of the ramp gradient in normalized coordinates. |
36+
| rampEnd | [x: number, y: number] | [1.0, 1.0] | Ending point of the ramp gradient in normalized coordinates. |
37+
| startColor | [r: number, g: number, b: number, a: number] | [0, 0, 0, 1] | Color at the starting point of the gradient. |
38+
| endColor | [r: number, g: number, b: number, a: number] | [1, 1, 1, 1] | Color at the ending point of the gradient. |
39+
| rampBias | number | 0.5 | Bias for the interpolation curve when both bias and gain are 0.5. |
40+
| rampGain | number | 0.5 | Gain for the interpolation curve when both bias and gain are 0.5. |
41+
| rampMask | boolean | false | When enabled, the ramp gradient is used as an effect mask, and colors are ignored. |
42+
| rampInvert | boolean | false | Controls whether the ramp gradient is inverted. When disabled, rampStart is transparent and rampEnd is opaque. |

docs/effects/sepia.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ return (
2424

2525
| Name | Type | Default | Description |
2626
| ------------- | ------------- | -------------------- | ---------------------------------- |
27-
| intensity | Boolean | 1 | The intensity of the effect |
27+
| intensity | Number | 1 | The intensity of the effect |
2828
| blendFunction | BlendFunction | BlendFunction.NORMAL | The blend function of this effect. |

docs/effects/ssao.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,37 +77,37 @@ return (
7777
<tr>
7878
<td>samples</td>
7979
<td>Number</td>
80-
<td>9</td>
80+
<td>8</td>
8181
<td>The amount of samples per pixel. Should not be a multiple of the ring count.</td>
8282
</tr>
8383
<tr>
8484
<td>rings</td>
8585
<td>Number</td>
86-
<td>7</td>
86+
<td>4</td>
8787
<td>The amount of spiral turns in the occlusion sampling pattern. Should be a prime number.</td>
8888
</tr>
8989
<tr>
9090
<td>distanceThreshold</td>
9191
<td>Number</td>
92-
<td>0.97</td>
92+
<td>1</td>
9393
<td>A global distance threshold at which the occlusion effect starts to fade out. Range [0.0, 1.0].</td>
9494
</tr>
9595
<tr>
9696
<td>distanceFalloff</td>
9797
<td>Number</td>
98-
<td>0.03</td>
98+
<td>0.0</td>
9999
<td>The distance falloff. Influences the smoothness of the overall occlusion cutoff. Range [0.0, 1.0].</td>
100100
</tr>
101101
<tr>
102102
<td>rangeThreshold</td>
103103
<td>Number</td>
104-
<td>0.0005</td>
104+
<td>0.5</td>
105105
<td>A local occlusion range threshold at which the occlusion starts to fade out. Range [0.0, 1.0].</td>
106106
</tr>
107107
<tr>
108108
<td>rangeFalloff</td>
109109
<td>Number</td>
110-
<td>0.001</td>
110+
<td>0.1</td>
111111
<td>The occlusion range falloff. Influences the smoothness of the proximity cutoff. Range [0.0, 1.0].</td>
112112
</tr>
113113
<tr>
@@ -119,13 +119,13 @@ return (
119119
<tr>
120120
<td>luminanceInfluence</td>
121121
<td>Number</td>
122-
<td>0.7</td>
122+
<td>0.9</td>
123123
<td>Determines how much the luminance of the scene influences the ambient occlusion.</td>
124124
</tr>
125125
<tr>
126126
<td>radius</td>
127127
<td>Number</td>
128-
<td>0.1825</td>
128+
<td>20</td>
129129
<td>The occlusion sampling radius, expressed as a resolution independent scale. Range [1e-6, 1.0].</td>
130130
</tr>
131131
<tr>

0 commit comments

Comments
 (0)