File: GTAONode.md | Updated: 11/15/2025
Post processing node for applying Ground Truth Ambient Occlusion (GTAO) to a scene.
const postProcessing = new THREE.PostProcessing( renderer );
const scenePass = pass( scene, camera );
scenePass.setMRT( mrt( {
output: output,
normal: normalView
} ) );
const scenePassColor = scenePass.getTextureNode( 'output' );
const scenePassNormal = scenePass.getTextureNode( 'normal' );
const scenePassDepth = scenePass.getTextureNode( 'depth' );
const aoPass = ao( scenePassDepth, scenePassNormal, camera );
postProcessing.outputNod = aoPass.getTextureNode().mul( scenePassColor );
GTAONode is an addon, and must be imported explicitly, see Installation#Addons.
import { ao } from 'three/addons/tsl/display/GTAONode.js';
Constructs a new GTAO node.
depthNode | A node that represents the scene's depth.
---|---
normalNode | A node that represents the scene's normals.
camera | The camera the scene is rendered with.
A node that represents the scene's depth.
Another option to tweak the occlusion. The recommended range is [1,2] for attenuating the AO.
The distance fall off value of the ambient occlusion. A lower value leads to a larger AO effect. The value should lie in the range [0,1].
A node that represents the scene's normals. If no normals are passed to the constructor (because MRT is not available), normals can be automatically reconstructed from depth values in the shader.
The radius of the ambient occlusion.
The resolution of the effect. Can be scaled via resolutionScale.
The resolution scale. By default the effect is rendered in full resolution for best quality but a value of 0.5 should be sufficient for most scenes.
Default is 1.
How many samples are used to compute the AO. A higher value results in better quality but also in a more expensive runtime behavior.
The scale of the ambient occlusion.
The thickness of the ambient occlusion.
The updateBeforeType is set to NodeUpdateType.FRAME since the node renders its effect once per frame in updateBefore().
Default is 'frame'.
Overrides: TempNode#updateBeforeType
Whether to use temporal filtering or not. Setting this property to true requires the usage of TRAANode. This will help to reduce noise although it introduces typical TAA artifacts like ghosting and temporal instabilities.
If setting this property to false, a manual denoise via DenoiseNode might be required.
Default is false.
Frees internal resources. This method should be called when the effect is no longer required.
Overrides: TempNode#dispose
Returns the result of the effect as a texture node.
Returns: A texture node that represents the result of the effect.
Sets the size of the effect.
width | The width of the effect.
---|---
height | The height of the effect.
This method is used to setup the effect's TSL code.
builder | The current node builder.
---|---
Overrides: TempNode#setup
This method is used to render the effect once per frame.
frame | The current node frame.
---|---
Overrides: TempNode#updateBefore