Constructs a new SSAO effect.
Optional
camera: CameraThe main camera.
Optional
normalBuffer: TextureA texture that contains the scene normals.
Optional
options: { The options.
Optional
bias?: numberAn occlusion bias. Eliminates artifacts caused by depth discontinuities.
Optional
blendThe blend function of this effect.
Optional
color?: ColorThe color of the ambient occlusion.
Optional
depthEnables or disables depth-aware upsampling. Has no effect if WebGL 2 is not supported.
Optional
distanceDeprecated.
Optional
distanceDeprecated.
Optional
distanceDeprecated.
Optional
fade?: numberInfluences the smoothness of the shadows. A lower value results in higher contrast.
Optional
height?: numberDeprecated. Use resolutionY instead.
Optional
intensity?: numberThe intensity of the ambient occlusion.
Optional
luminanceDetermines how much the luminance of the scene influences the ambient occlusion.
Optional
minThe minimum radius scale.
Optional
normalDeprecated.
Optional
radius?: numberThe occlusion sampling radius, expressed as a scale relative to the resolution. Range [1e-6, 1.0].
Optional
rangeDeprecated.
Optional
rangeDeprecated.
Optional
resolutionThe resolution scale.
Optional
resolutionX?: numberThe horizontal resolution.
Optional
resolutionY?: numberThe vertical resolution.
Optional
rings?: numberThe amount of spiral turns in the occlusion sampling pattern. Should be a prime number.
Optional
samples?: numberThe amount of samples per pixel. Should not be a multiple of the ring count.
Optional
width?: numberDeprecated. Use resolutionX instead.
Optional
worldThe world distance falloff. Influences the smoothness of the occlusion cutoff.
Optional
worldThe world distance threshold at which the occlusion effect starts to fade out.
Optional
worldThe world proximity falloff. Influences the smoothness of the proximity cutoff.
Optional
worldThe world proximity threshold at which the occlusion starts to fade out.
Move normalBuffer to options.
Readonly
blendThe blend mode of this effect.
Readonly
definesPreprocessor macro definitions.
Call Effect.setChanged after changing macro definitions.
Readonly
extensionsWebGL extensions that are required by this effect.
Call Effect.setChanged after adding or removing extensions.
The name of this effect.
Protected
rendererThe renderer.
Readonly
uniformsShader uniforms.
Call Effect.setChanged after adding or removing uniforms.
The color of the ambient occlusion. Set to null
to disable.
Indicates whether depth-aware upsampling is enabled.
Indicates whether distance-based radius scaling is enabled.
Use ssaoMaterial.distanceScaling instead.
Experimental
The input color space.
Protected
Experimental
The intensity.
The luminance influence factor. Range: [0.0, 1.0].
Sets the main camera.
Sets the main scene.
Sets the normal buffer.
Experimental
The output color space.
Should only be changed if this effect converts the input colors to a different color space.
Protected
Experimental
The occlusion sampling radius.
Use ssaoMaterial.radius instead.
The amount of spiral turns in the occlusion sampling pattern.
Use ssaoMaterial.rings instead.
The amount of occlusion samples per pixel.
Use ssaoMaterial.samples instead.
The SSAO material.
Performs a shallow search for properties that define a dispose method and deletes them.
The EffectComposer calls this method when it is being destroyed.
Returns the effect attributes.
The attributes.
Performs initialization tasks.
This method is called when the associated EffectPass is added to an EffectComposer.
The renderer.
Whether the renderer uses the alpha channel or not.
The type of the main frame buffers.
if(!alpha && frameBufferType === UnsignedByteType) { this.myRenderTarget.texture.format = RGBFormat; }
Protected
setProtected
Sets the effect attributes.
Effects that have the same attributes will be executed in the order in which they were registered. Some attributes imply a higher priority.
The attributes.
Protected
setProtected
Informs the associated EffectPass that this effect requires a shader recompilation.
Should be called after changing macros or extensions and after adding/removing uniforms.
Sets the depth texture.
You may override this method if your effect requires direct access to the depth texture that is bound to the associated EffectPass.
A depth texture.
Optional
depthPacking: DepthPackingStrategiesThe depth packing.
Protected
setProtected
setUpdates this effect.
The renderer.
A frame buffer that contains the result of the previous pass.
Optional
deltaTime: numberThe time between the last frame and the current one in seconds.
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 effect supports depth-aware upsampling and should be rendered at a lower resolution. The resolution should match that of the downsampled normals and depth. If you intend to render SSAO at full resolution, do not provide a downsampled
normalDepthBuffer
.It's recommended to specify a relative render resolution using the
resolutionScale
constructor parameter to avoid undesired sampling patterns.Based on "Scalable Ambient Obscurance" by Morgan McGuire et al. and "Depth-aware upsampling experiments" by Eleni Maria Stea: https://research.nvidia.com/publication/scalable-ambient-obscurance https://eleni.mutantstargoat.com/hikiko/on-depth-aware-upsampling
The view position calculation is based on a shader by Norbert Nopper: https://github.com/McNopper/OpenGL/blob/master/Example28/shader/ssao.frag.glsl