N8AO

A fast, high quality ambient occlusion pass, wrapping N8python/n8ao. Self-contained - unlike SSAO, it does not need enableNormalPass on <EffectComposer>.

import { N8AO } from '@react-three/postprocessing'

return (
  <N8AO
    enabled={true} // toggle the pass without unmounting it
    aoRadius={5} // ambient occlusion sampling radius
    distanceFalloff={1} // distance falloff
    intensity={1} // AO intensity
    quality="performance" // 'performance' | 'low' | 'medium' | 'high' | 'ultra'
    aoSamples={16} // amount of ambient occlusion samples per frame
    denoiseSamples={4} // amount of denoise samples per frame
    denoiseRadius={12} // denoise sampling radius
    color={undefined} // tints the occlusion, defaults to black
    halfRes={false} // renders the effect at half resolution
    depthAwareUpsampling={true} // enables or disables depth-aware upsampling
    screenSpaceRadius={false} // scales the sampling radius with distance from the camera
    renderMode={0} // 0: Combined, 1: AO only, 2: No AO, 3: Split, 4: Split AO
  />
)

Example

N8AO demo

Props

NameTypeDefaultDescription
enabledBooleantrueToggles the pass without unmounting it.
aoRadiusNumber5The ambient occlusion sampling radius.
distanceFalloffNumber1The distance falloff.
intensityNumber1The AO intensity.
quality'performance' | 'low' | 'medium' | 'high' | 'ultra''performance'The quality preset.
aoSamplesNumber16The amount of ambient occlusion samples per frame.
denoiseSamplesNumber4The amount of denoise samples per frame.
denoiseRadiusNumber12The denoise sampling radius.
colorColorundefinedTints the occlusion. Defaults to black.
halfResBooleanfalseRenders the effect at half resolution.
depthAwareUpsamplingBooleantrueEnables or disables depth-aware upsampling.
screenSpaceRadiusBooleanfalseScales the sampling radius with distance from the camera.
renderMode0 | 1 | 2 | 3 | 400: Combined, 1: AO only, 2: No AO, 3: Split, 4: Split AO.