Capítulo 273 de 859

Chapter 273: SSAOPass

Core Idea

A pass for a basic SSAO effect.

SAOPass and GTAPass produce a more advanced AO but are also more expensive.

Key Concepts

  • camera : Camera: The camera.
  • clear : boolean: Overwritten to perform a clear operation by default.
  • height : number: The height of the effect.
  • kernelRadius : number: The kernel radius controls how wide the AO spreads.
  • maxDistance : number: Defines the maximum distance that should be affected by the AO.
  • minDistance : number: Defines the minimum distance that should be affected by the AO.
  • needsSwap : boolean: Overwritten to disable the swap.
  • output : number: The output configuration.
  • scene : Scene: The scene to render the AO for.
  • width : number: The width of the effect.

Code Examples

const ssaoPass = new SSAOPass( scene, camera, width, height );
composer.addPass( ssaoPass );
  • What it demonstrates: Typical usage of SSAOPass.

Reference Tables

Constructor

Signature
new SSAOPass( scene : Scene, camera : Camera, width : number, height : number, kernelSize : number )

Properties

PropertyDescription
.camera : CameraThe camera.
.clear : booleanOverwritten to perform a clear operation by default.
.height : numberThe height of the effect.
.kernelRadius : numberThe kernel radius controls how wide the AO spreads.
.maxDistance : numberDefines the maximum distance that should be affected by the AO.
.minDistance : numberDefines the minimum distance that should be affected by the AO.
.needsSwap : booleanOverwritten to disable the swap.
.output : numberThe output configuration.
.scene : SceneThe scene to render the AO for.
.width : numberThe width of the effect.

Methods

MethodDescription
.dispose()Frees the GPU-related resources allocated by this instance. Call this method whenever the pass is no longer used in your app.
.render( renderer : WebGLRenderer, writeBuffer : WebGLRenderTarget, readBuffer : WebGLRenderTarget, deltaTime : number, maskActive : boolean )Performs the SSAO pass.
.setSize( width : number, height : number )Sets the size of the pass.

Key Takeaways

  1. SSAOPass extends: Pass
  2. Most relevant properties: camera, clear, height, kernelRadius.
  3. Key methods: dispose, render, setSize.

Connects To