threepipe
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符


prev:

text: 'GBufferPlugin'
link: './GBufferPlugin'

next:

text: 'CanvasSnapshotPlugin'
link: './CanvasSnapshotPlugin'

SSAOPlugin

ExampleSource CodeAPI 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 r channel to remain compatible with ORM. gba contains the depth in vec3(xyz) format. Note that its ssaoDisabled, so setting it to true will disable the effect.