prev:
text: 'GBufferPlugin'
link: './GBufferPlugin'
next:
text: 'CanvasSnapshotPlugin'
link: './CanvasSnapshotPlugin'
Example — Source Code — API Reference
SSAO Plugin adds support for Screen Space Ambient Occlusion to the viewer. Simply add the plugin to the viewer to use it.
This is done by adding a pre-render pass to the render manager which renders SSAO to a custom render target. SSAOPlugin depends on GBufferPlugin, and is automatically added if not already.
This render target is then used by all PhysicalMaterial(s) in the scene during the main RenderPass to get the AO data. SSAO can also be disabled from the UI of the material.
Note: Use with ProgressivePlugin and TemporalAAPlugin for best results.
import {ThreeViewer, SSAOPlugin} from 'threepipe'
const viewer = new ThreeViewer({...})
const ssaoPlugin = viewer.addPluginSync(new SSAOPlugin())
// get the buffer.
console.log(ssaoPlugin.target);
// disable ssao for a material in the scene
material.userData.ssaoDisabled = true
In the target/buffer - The ssao data is in the
rchannel to remain compatible with ORM.gbacontains the depth in vec3(xyz) format. Note that itsssaoDisabled, so setting it totruewill disable the effect.