Constructs a new SSAO effect.
The options.
The blend mode of this effect.
Preprocessor macro definitions.
Call Effect.setChanged after changing macro definitions.
WebGL extensions that are required by this effect.
Call Effect.setChanged after adding or removing extensions.
The name of this effect.
The renderer.
Shader uniforms.
Call Effect.setChanged after adding or removing uniforms.
The color of the ambient occlusion. Set to null
to disable.
The color of the ambient occlusion. Set to null
to disable.
Indicates whether depth-aware upsampling is enabled.
Indicates whether depth-aware upsampling is enabled.
Indicates whether distance-based radius scaling is enabled.
Indicates whether distance-based radius scaling is enabled.
The input color space.
The input color space.
The intensity.
The intensity.
The luminance influence factor. Range: [0.0, 1.0].
The luminance influence factor. Range: [0.0, 1.0].
Sets the main camera.
Sets the main scene.
Sets the normal buffer.
Sets the normal buffer.
The output color space.
Should only be changed if this effect converts the input colors to a different color space.
The output color space.
Should only be changed if this effect converts the input colors to a different color space.
The occlusion sampling radius.
The occlusion sampling radius.
The amount of spiral turns in the occlusion sampling pattern.
The amount of spiral turns in the occlusion sampling pattern.
The amount of occlusion samples per pixel.
The amount of occlusion samples per pixel.
The SSAO material.
Adds a listener to an event type.
The type of event to listen to.
The function that gets called when the event is fired.
Fire an event type.
The event that gets fired.
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.
Returns the blend mode.
The result of this effect will be blended with the result of the previous effect using this blend mode.
The blend mode.
Returns the color of the ambient occlusion.
The color.
Returns the preprocessor macro definitions.
The extensions.
Returns the WebGL extensions that are required by this effect.
The extensions.
Returns the fragment shader.
The fragment shader.
Returns the name of this effect.
The name.
Returns the resolution settings.
The resolution.
Returns the SSAO material.
The material.
Returns the uniforms of this effect.
The extensions.
Returns the vertex shader.
The vertex shader.
Checks if listener is added to an event type.
The type of event to listen to.
The function that gets called when the event is fired.
Performs initialization tasks.
This method is called when the associated {@link EffectPass} is added to an EffectComposer.
The renderer.
Whether the renderer uses the alpha channel or not.
The type of the main frame buffers.
Indicates whether depth-aware upsampling is enabled.
Whether depth-aware upsampling is enabled.
Removes a listener from an event type.
The type of the listener that gets removed.
The listener function that gets removed.
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.
Informs the associated {@link EffectPass} that this effect requires a shader recompilation.
Should be called after changing macros or extensions and after adding/removing uniforms.
Sets the color of the ambient occlusion. Set to null
to disable colorization.
The color.
Enables or disables depth-aware upsampling.
Whether depth-aware upsampling should be enabled.
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 {@link EffectPass}.
A depth texture.
Sets the occlusion distance cutoff.
The distance threshold. Range [0.0, 1.0].
The falloff. Range [0.0, 1.0].
Sets the fragment shader.
The fragment shader.
Sets the occlusion proximity cutoff.
The proximity threshold. Range [0.0, 1.0].
The falloff. Range [0.0, 1.0].
Sets the renderer.
The renderer.
Sets the size.
The width.
The height.
Sets the vertex shader.
The vertex shader.
Updates this effect.
The renderer.
A frame buffer that contains the result of the previous pass.
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