Procházet zdrojové kódy

SVGFNode: Raise the luminance floor of the temporal gradient.

A relative gradient over near-zero luminances treats sub-noise changes
in dark regions as signal change and keeps rejecting history there.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mr.doob před 5 dny
rodič
revize
cfd87abb6e
1 změnil soubory, kde provedl 6 přidání a 1 odebrání
  1. 6 1
      examples/jsm/tsl/display/SVGFNode.js

+ 6 - 1
examples/jsm/tsl/display/SVGFNode.js

@@ -531,7 +531,12 @@ class SVGFNode extends TempNode {
 				current.rgb.mulAssign( currentLuma.greaterThan( maxLuma ).select( maxLuma.div( currentLuma ), float( 1.0 ) ) );
 				current.rgb.mulAssign( currentLuma.greaterThan( maxLuma ).select( maxLuma.div( currentLuma ), float( 1.0 ) ) );
 
 
 				const historyLuma = luminance( history.rgb );
 				const historyLuma = luminance( history.rgb );
-				const gradient = abs( blurredLuma.sub( historyLuma ) ).div( max( blurredLuma, historyLuma ).add( 0.01 ) );
+
+				// the luminance floor in the denominator keeps the relative gradient from amplifying
+				// sub-noise changes in dark regions, where it would otherwise keep rejecting history
+				// and let the raw noise blink through
+
+				const gradient = abs( blurredLuma.sub( historyLuma ) ).div( max( blurredLuma, historyLuma ).add( 0.25 ) );
 				const adaptiveAlpha = max( this.temporalAlpha, gradient.sub( 0.1 ).mul( this.antiGhosting ).clamp() );
 				const adaptiveAlpha = max( this.temporalAlpha, gradient.sub( 0.1 ).mul( this.antiGhosting ).clamp() );
 
 
 				const alpha = validHistory.select( adaptiveAlpha, float( 1.0 ) );
 				const alpha = validHistory.select( adaptiveAlpha, float( 1.0 ) );

粤ICP备19079148号