Capítulo 479 de 859
Post processing node for applying Screen Space Global Illumination (SSGI) to a scene.
References:
The quality and performance of the effect mainly depend on sliceCount and stepCount. The total number of samples taken per pixel is sliceCount * stepCount * 2. Here are some recommended presets depending on whether temporal filtering is used or not.
With temporal filtering (recommended):
sliceCount of 1, stepCount of 12.sliceCount of 2, stepCount of 8.sliceCount of 3, stepCount of 16.Use for a higher slice count if you notice temporal instabilities like flickering. Reduce the sample count then to mitigate the performance lost.
Without temporal filtering:
sliceCount of 2, stepCount of 6.sliceCount of 3, stepCount of 8.sliceCount of 4, stepCount of 12.[0, 4].[0, 1].[0, 100].[1, 25].import { ssgi } from 'three/addons/tsl/display/SSGINode.js';
Constructor
| Signature |
|---|
new SSGINode( beautyNode : TextureNode, depthNode : TextureNode, normalNode : TextureNode, camera : PerspectiveCamera ) |
Properties
| Property | Description |
|---|---|
.aoIntensity : UniformNode.<float> | Power function applied to AO to make it appear darker/lighter. Should be in the range [0, 4]. |
.backfaceLighting : UniformNode.<float> | How much light backface surfaces emit. Should be in the range [0, 1]. |
.beautyNode : TextureNode | A texture node that represents the beauty or scene pass. |
.depthNode : TextureNode | A node that represents the scene's depth. |
.expFactor : UniformNode.<float> | Controls samples distribution. It's an exponent applied at each step get increasing step size over the distance. Should be in the range [1, 3]. |
.giIntensity : UniformNode.<float> | Intensity of the indirect diffuse light. Should be in the range [0, 100]. |
.normalNode : TextureNode | 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. |
.radius : UniformNode.<float> | Effective sampling radius in world space. AO and GI can only have influence within that radius. Should be in the range [1, 25]. |
.sliceCount : UniformNode.<uint> | Number of per-pixel hemisphere slices. This has a big performance cost and should be kept as low as possible. Should be in the range [1, 4]. |
.stepCount : UniformNode.<uint> | Number of samples taken along one side of a given hemisphere slice. This has a big performance cost and should be kept as low as possible. Should be in the range [1, 32]. |
.thickness : UniformNode.<float> | Constant thickness value of objects on the screen in world units. Allows light to pass behind surfaces past that thickness value. Should be in the range [0.01, 10]. |
.updateBeforeType : string | The updateBeforeType is set to NodeUpdateType.FRAME since the node renders its effect once per frame in updateBefore(). |
.useLinearThickness : UniformNode.<bool> | Whether to increase thickness linearly over distance or not (avoid losing detail over the distance). |
.useScreenSpaceSampling : UniformNode.<bool> | Makes the sample distance in screen space instead of world-space (helps having more detail up close). |
.useTemporalFiltering : boolean | 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 a… |
Methods
| Method | Description |
|---|---|
.dispose() | Frees internal resources. This method should be called when the effect is no longer required. |
.getAONode() : PassTextureNode | Returns the AO result of the effect as a texture node. |
.getGINode() : PassTextureNode | Returns the GI result of the effect as a texture node. |
.setSize( width : number, height : number ) | Sets the size of the effect. |
.setup( builder : NodeBuilder ) : PassTextureNode | This method is used to setup the effect's TSL code. |
.updateBefore( frame : NodeFrame ) | This method is used to render the effect once per frame. |