SSAOEffect
Extends:
Indirect Implements:
A Screen Space Ambient Occlusion (SSAO) effect.
For high quality visuals use two SSAO effect instances in a row with different radii, one for rough AO and one for fine details.
This implementation uses a spiral sampling pattern: https://jsfiddle.net/a16ff1p7
Constructor Summary
Public Constructor | ||
public |
constructor(camera: Camera, normalBuffer: Texture, options: Object) Constructs a new SSAO effect. |
Member Summary
Public Members | ||
public get |
The occlusion sampling radius. |
|
public set |
Sets the occlusion sampling radius. |
|
public get |
The amount of rings in the occlusion sampling spiral pattern. |
|
public set |
Sets the amount of rings in the occlusion sampling spiral pattern. |
|
public get |
The amount of occlusion samples per pixel. |
|
public set |
Sets the amount of occlusion samples per pixel. |
Method Summary
Public Methods | ||
public |
setDistanceCutoff(threshold: Number, falloff: Number) Sets the occlusion distance cutoff. |
|
public |
setProximityCutoff(threshold: Number, falloff: Number) Sets the occlusion proximity cutoff. |
|
public |
Updates the camera projection matrix uniforms. |
Inherited Summary
From class Effect | ||
public |
The effect attributes. |
|
public |
The blend mode of this effect. |
|
public |
Preprocessor macro definitions. |
|
public |
WebGL extensions that are required by this effect. |
|
public |
The fragment shader. |
|
public |
The name of this effect. |
|
public |
Shader uniforms. |
|
public |
The vertex shader. |
|
public |
dispose() Performs a shallow search for properties that define a dispose method and deletes them. |
|
public |
initialize(renderer: WebGLRenderer, alpha: Boolean) Performs initialization tasks. |
|
public |
setDepthTexture(depthTexture: Texture, depthPacking: Number) Sets the depth texture. |
|
public |
Updates the size of this effect. |
|
public |
Updates the effect by performing supporting operations. |
Public Constructors
public constructor(camera: Camera, normalBuffer: Texture, options: Object) source
Constructs a new SSAO effect.
Override:
Effect#constructorParams:
Name | Type | Attribute | Description |
camera | Camera | The main camera. |
|
normalBuffer | Texture | A texture that contains the scene normals. See NormalPass. |
|
options | Object |
|
The options. |
options.blendFunction | BlendFunction |
|
The blend function of this effect. |
options.samples | Number |
|
The amount of samples per pixel. Should not be a multiple of the ring count. |
options.rings | Number |
|
The amount of rings in the occlusion sampling pattern. |
options.distanceThreshold | Number |
|
A global distance threshold at which the occlusion effect starts to fade out. Range [0.0, 1.0]. |
options.distanceFalloff | Number |
|
The distance falloff. Influences the smoothness of the overall occlusion cutoff. Range [0.0, 1.0]. |
options.rangeThreshold | Number |
|
A local occlusion range threshold at which the occlusion starts to fade out. Range [0.0, 1.0]. |
options.rangeFalloff | Number |
|
The occlusion range falloff. Influences the smoothness of the proximity cutoff. Range [0.0, 1.0]. |
options.luminanceInfluence | Number |
|
Determines how much the luminance of the scene influences the ambient occlusion. |
options.radius | Number |
|
The occlusion sampling radius. |
options.scale | Number |
|
The scale of the ambient occlusion. |
options.bias | Number |
|
An occlusion bias. |
Public Members
public set rings: Number source
Sets the amount of rings in the occlusion sampling spiral pattern.
You'll need to call EffectPass#recompile after changing this value.
public set samples: Number source
Sets the amount of occlusion samples per pixel.
You'll need to call EffectPass#recompile after changing this value.