|
| 1 | +--- |
| 2 | +title: N8AO |
| 3 | +nav: 1 |
| 4 | +--- |
| 5 | + |
| 6 | +A fast, high quality ambient occlusion effect, wrapping [N8python/n8ao](https://github.com/N8python/n8ao). Self-contained - unlike [SSAO](/effects/ssao), it does not need `enableNormalPass` on `<EffectComposer>`. |
| 7 | + |
| 8 | +```jsx |
| 9 | +import { N8AO } from '@react-three/postprocessing' |
| 10 | + |
| 11 | +return ( |
| 12 | + <N8AO |
| 13 | + aoRadius={5} // ambient occlusion sampling radius |
| 14 | + distanceFalloff={1} // distance falloff |
| 15 | + intensity={1} // effect intensity |
| 16 | + quality="performance" // 'performance' | 'low' | 'medium' | 'high' | 'ultra' |
| 17 | + aoSamples={16} // amount of ambient occlusion samples per frame |
| 18 | + denoiseSamples={4} // amount of denoise samples per frame |
| 19 | + denoiseRadius={12} // denoise sampling radius |
| 20 | + color={undefined} // tints the occlusion, defaults to black |
| 21 | + halfRes={false} // renders the effect at half resolution |
| 22 | + depthAwareUpsampling={true} // enables or disables depth-aware upsampling |
| 23 | + screenSpaceRadius={false} // scales the sampling radius with distance from the camera |
| 24 | + renderMode={0} // 0: Combined, 1: AO only, 2: No AO, 3: Split, 4: Split AO |
| 25 | + /> |
| 26 | +) |
| 27 | +``` |
| 28 | + |
| 29 | +## Props |
| 30 | + |
| 31 | +| Name | Type | Default | Description | |
| 32 | +| -------------------- | ------------------------------------------------------- | ------------- | --------------------------------------------------------- | |
| 33 | +| aoRadius | Number | 5 | The ambient occlusion sampling radius. | |
| 34 | +| distanceFalloff | Number | 1 | The distance falloff. | |
| 35 | +| intensity | Number | 1 | The effect intensity. | |
| 36 | +| quality | 'performance' \| 'low' \| 'medium' \| 'high' \| 'ultra' | 'performance' | The quality preset. | |
| 37 | +| aoSamples | Number | 16 | The amount of ambient occlusion samples per frame. | |
| 38 | +| denoiseSamples | Number | 4 | The amount of denoise samples per frame. | |
| 39 | +| denoiseRadius | Number | 12 | The denoise sampling radius. | |
| 40 | +| color | Color | undefined | Tints the occlusion. Defaults to black. | |
| 41 | +| halfRes | Boolean | false | Renders the effect at half resolution. | |
| 42 | +| depthAwareUpsampling | Boolean | true | Enables or disables depth-aware upsampling. | |
| 43 | +| screenSpaceRadius | Boolean | false | Scales the sampling radius with distance from the camera. | |
| 44 | +| renderMode | 0 \| 1 \| 2 \| 3 \| 4 | 0 | 0: Combined, 1: AO only, 2: No AO, 3: Split, 4: Split AO. | |
0 commit comments