Use a custom Render Target with N8AO
masterTo use a pre-existing render target with a depth buffer instead of letting N8AO generate a new one:
- Assign your target to
n8aopass.beautyRenderTarget. - Set
n8aopass.configuration.autoRenderBeauty = false. - Ensure your target has a
depthTextureattached, otherwise N8AO may fail silently.
const renderTarget = new THREE.WebGLRenderTarget(width, height);
// Attach depth texture
renderTarget.depthTexture = new THREE.DepthTexture(width, height, THREE.UnsignedIntType);
renderTarget.depthTexture.format = THREE.DepthFormat;
// Configure pass
n8aopass.beautyRenderTarget = renderTarget;
n8aopass.configuration.autoRenderBeauty = false;