Skip to content

Commit 1c02d87

Browse files
zaloMugen87
andauthored
Improve SSGI Temporal Noise (#31890)
* Improve SSGI Temporal Noise * Fix bug toggling temporal filtering in AO/GI Mode * Update SSGINode.js * Make it mathematically equivalent to using frameId * Update SSGINode.js Add PR number. --------- Co-authored-by: Michael Herzog <[email protected]>
1 parent 3ecd1c3 commit 1c02d87

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

examples/jsm/tsl/display/SSGINode.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,8 @@ class SSGINode extends TempNode {
576576

577577
const noiseOffset = spatialOffsets( screenCoordinate );
578578
const noiseDirection = gradientNoise( screenCoordinate );
579-
const initialRayStep = fract( noiseOffset.add( this._temporalOffset ) ).add( rand( uvNode ).mul( 2 ).sub( 1 ) );
579+
const noiseJitterIdx = this._temporalDirection.mul( 0.02 ); // Port: Add noiseJitterIdx here for slightly better noise convergence with TRAA (see #31890 for more details)
580+
const initialRayStep = fract( noiseOffset.add( this._temporalOffset ) ).add( rand( uvNode.add( noiseJitterIdx ).mul( 2 ).sub( 1 ) ) );
580581

581582
const ao = float( 0 );
582583
const color = vec3( 0 );

examples/webgpu_postprocessing_ssgi.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@
160160
gui.add( giPass.useScreenSpaceSampling, 'value' ).name( 'screen-space sampling' );
161161
gui.add( giPass, 'useTemporalFiltering' ).name( 'temporal filtering' ).onChange( updatePostprocessing );
162162

163-
function updatePostprocessing( value ) {
163+
function updatePostprocessing() {
164+
165+
const value = params.output;
164166

165167
if ( value === 1 ) {
166168

0 commit comments

Comments
 (0)