threepipe
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

SSAOPlugin.md 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ---
  2. prev:
  3. text: 'GBufferPlugin'
  4. link: './GBufferPlugin'
  5. next:
  6. text: 'CanvasSnapshotPlugin'
  7. link: './CanvasSnapshotPlugin'
  8. ---
  9. # SSAOPlugin
  10. [//]: # (todo: image)
  11. [Example](https://threepipe.org/examples/#ssao-plugin/) —
  12. [Source Code](https://github.com/repalash/threepipe/blob/master/src/plugins/pipeline/SSAOPlugin.ts) —
  13. [API Reference](https://threepipe.org/docs/classes/SSAOPlugin.html)
  14. SSAO Plugin adds support for [Screen Space Ambient Occlusion](https://en.wikipedia.org/wiki/Screen_space_ambient_occlusion) to the viewer. Simply add the plugin to the viewer to use it.
  15. 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](./GBufferPlugin), and is automatically added if not already.
  16. 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.
  17. Note: Use with [ProgressivePlugin](./ProgressivePlugin) and `TemporalAAPlugin` for best results.
  18. ```typescript
  19. import {ThreeViewer, SSAOPlugin} from 'threepipe'
  20. const viewer = new ThreeViewer({...})
  21. const ssaoPlugin = viewer.addPluginSync(new SSAOPlugin())
  22. // get the buffer.
  23. console.log(ssaoPlugin.target);
  24. // disable ssao for a material in the scene
  25. material.userData.ssaoDisabled = true
  26. ```
  27. > 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.
  28. > Note that its `ssaoDisabled`, so setting it to `true` will disable the effect.