Переглянути джерело

SSGINode: Add resolutionScale.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mr.doob 6 днів тому
батько
коміт
d874d752c1
1 змінених файлів з 13 додано та 0 видалено
  1. 13 0
      examples/jsm/tsl/display/SSGINode.js

+ 13 - 0
examples/jsm/tsl/display/SSGINode.js

@@ -98,6 +98,16 @@ class SSGINode extends TempNode {
 		 */
 		this.noiseNode = null;
 
+		/**
+		 * The resolution scale. By default the effect is rendered in full resolution
+		 * for best quality but a value of `0.5` is an effective way of improving
+		 * performance, especially when the result is denoised and upsampled anyway.
+		 *
+		 * @type {number}
+		 * @default 1
+		 */
+		this.resolutionScale = 1;
+
 		/**
 		 * The `updateBeforeType` is set to `NodeUpdateType.FRAME` since the node renders
 		 * its effect once per frame in `updateBefore()`.
@@ -328,6 +338,9 @@ class SSGINode extends TempNode {
 	 */
 	setSize( width, height ) {
 
+		width = Math.round( width * this.resolutionScale );
+		height = Math.round( height * this.resolutionScale );
+
 		this._resolution.value.set( width, height );
 		this._ssgiRenderTarget.setSize( width, height );
 

粤ICP备19079148号