Просмотр исходного кода

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 4 дней назад
Родитель
Сommit
cfd87abb6e
1 измененных файлов с 6 добавлено и 1 удалено
  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 ) ) );
 
 				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 alpha = validHistory.select( adaptiveAlpha, float( 1.0 ) );

粤ICP备19079148号