rayzee 7.29.0 → 7.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rayzee.es.js +3724 -3009
- package/dist/rayzee.umd.js +56 -56
- package/package.json +1 -1
- package/src/EngineDefaults.js +272 -19
- package/src/EngineIssues.js +1 -0
- package/src/PathTracerApp.js +10 -1
- package/src/Processor/GeometryExtractor.js +21 -3
- package/src/Processor/PackedRayBuffer.js +26 -5
- package/src/Processor/SceneProcessor.js +71 -24
- package/src/Processor/StorageTexturePool.js +8 -4
- package/src/Processor/TextureCreator.js +8 -9
- package/src/Processor/Workers/TexturesWorker.js +13 -14
- package/src/Processor/utils.js +0 -6
- package/src/RenderSettings.js +4 -4
- package/src/Stages/Compositor.js +1 -0
- package/src/Stages/NRD.js +1395 -0
- package/src/Stages/NormalDepth.js +8 -4
- package/src/Stages/PathTracerStage.js +4 -0
- package/src/TSL/Common.js +8 -1
- package/src/TSL/FinalWriteKernel.js +9 -4
- package/src/TSL/GenerateKernel.js +1 -1
- package/src/TSL/ShadeKernel.js +14 -2
- package/src/TSL/TextureSampling.js +3 -2
- package/src/index.js +5 -0
- package/src/managers/DenoisingManager.js +80 -21
|
@@ -19,17 +19,21 @@ import { createLogger, fmt } from '../utils/Logger.js';
|
|
|
19
19
|
|
|
20
20
|
const log = createLogger( 'gpu' );
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
// Compute-output StorageTexture at the reserved size, never resized (see above). LinearFilter is
|
|
23
|
+
// load-bearing: textureLoad codegen requires it on a StorageTexture.
|
|
24
|
+
export function createStorageTexture( type = FloatType, filter = LinearFilter ) {
|
|
23
25
|
|
|
24
26
|
const tex = new StorageTexture( MAX_STORAGE_TEXTURE_SIZE, MAX_STORAGE_TEXTURE_SIZE );
|
|
25
|
-
tex.type =
|
|
27
|
+
tex.type = type;
|
|
26
28
|
tex.format = RGBAFormat;
|
|
27
|
-
tex.minFilter =
|
|
28
|
-
tex.magFilter =
|
|
29
|
+
tex.minFilter = filter;
|
|
30
|
+
tex.magFilter = filter;
|
|
29
31
|
return tex;
|
|
30
32
|
|
|
31
33
|
}
|
|
32
34
|
|
|
35
|
+
const createWriteStorageTex = () => createStorageTexture();
|
|
36
|
+
|
|
33
37
|
export class StorageTexturePool {
|
|
34
38
|
|
|
35
39
|
constructor( width, height ) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataArrayTexture, RGBAFormat, LinearFilter, UnsignedByteType, SRGBColorSpace, LinearSRGBColorSpace, RepeatWrapping } from "three";
|
|
2
|
-
import { TEXTURE_CONSTANTS, MEMORY_CONSTANTS, DEFAULT_TEXTURE_MATRIX, MATERIAL_DATA_LAYOUT, normalizeAttenuationDistance } from '../EngineDefaults.js';
|
|
2
|
+
import { alignBucketWidth, TEXTURE_CONSTANTS, MEMORY_CONSTANTS, DEFAULT_TEXTURE_MATRIX, MATERIAL_DATA_LAYOUT, normalizeAttenuationDistance } from '../EngineDefaults.js';
|
|
3
3
|
import TexturesWorker from './Workers/TexturesWorker.js?worker&inline';
|
|
4
4
|
import { ISSUE_CODES } from '../EngineIssues.js';
|
|
5
5
|
import { linearToSRGB } from './ToneMapCPU.js';
|
|
@@ -1318,18 +1318,17 @@ export class TextureCreator {
|
|
|
1318
1318
|
|
|
1319
1319
|
}
|
|
1320
1320
|
|
|
1321
|
-
|
|
1322
|
-
|
|
1321
|
+
// Scale down proportionally only when the cap is exceeded; native res is kept below it.
|
|
1322
|
+
const longest = Math.max( maxWidth, maxHeight );
|
|
1323
|
+
if ( longest > this.maxTextureSize ) {
|
|
1323
1324
|
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
maxWidth = Math.max( 1, Math.floor( maxWidth / 2 ) );
|
|
1328
|
-
maxHeight = Math.max( 1, Math.floor( maxHeight / 2 ) );
|
|
1325
|
+
const scale = this.maxTextureSize / longest;
|
|
1326
|
+
maxWidth = Math.round( maxWidth * scale );
|
|
1327
|
+
maxHeight = Math.round( maxHeight * scale );
|
|
1329
1328
|
|
|
1330
1329
|
}
|
|
1331
1330
|
|
|
1332
|
-
return { maxWidth, maxHeight };
|
|
1331
|
+
return { maxWidth: alignBucketWidth( maxWidth, this.maxTextureSize ), maxHeight: Math.max( 1, maxHeight ) };
|
|
1333
1332
|
|
|
1334
1333
|
}
|
|
1335
1334
|
|
|
@@ -619,23 +619,22 @@ function calculateOptimalDimensions( textures, maxTextureSize ) {
|
|
|
619
619
|
|
|
620
620
|
}
|
|
621
621
|
|
|
622
|
-
//
|
|
623
|
-
|
|
624
|
-
|
|
622
|
+
// Scale down proportionally only when the cap is exceeded; native res is kept below it.
|
|
623
|
+
const cap = Math.min( maxTextureSize, MEMORY_LIMITS.MAX_TEXTURE_DIMENSION );
|
|
624
|
+
const longest = Math.max( maxWidth, maxHeight );
|
|
625
|
+
if ( longest > cap ) {
|
|
625
626
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
// Halve only while a dimension exceeds the cap (preserves native res up to the cap).
|
|
631
|
-
while ( maxWidth > maxTextureSize || maxHeight > maxTextureSize ) {
|
|
632
|
-
|
|
633
|
-
maxWidth = Math.max( 1, Math.floor( maxWidth / 2 ) );
|
|
634
|
-
maxHeight = Math.max( 1, Math.floor( maxHeight / 2 ) );
|
|
627
|
+
const scale = cap / longest;
|
|
628
|
+
maxWidth = Math.round( maxWidth * scale );
|
|
629
|
+
maxHeight = Math.round( maxHeight * scale );
|
|
635
630
|
|
|
636
631
|
}
|
|
637
632
|
|
|
638
|
-
|
|
633
|
+
// An RGBA8 row upload must be a multiple of 256 bytes, so widths land on 64 texels.
|
|
634
|
+
// Mirrors alignBucketWidth in EngineDefaults (not importable from worker context).
|
|
635
|
+
maxWidth = Math.min( cap, Math.max( 4, Math.ceil( Math.max( 1, maxWidth ) / 64 ) * 64 ) );
|
|
636
|
+
|
|
637
|
+
return { maxWidth, maxHeight: Math.max( 1, maxHeight ) };
|
|
639
638
|
|
|
640
639
|
}
|
|
641
640
|
|
|
@@ -645,7 +644,7 @@ function calculateReducedDimensions( textures, maxTextureSize ) {
|
|
|
645
644
|
const original = calculateOptimalDimensions( textures, maxTextureSize );
|
|
646
645
|
|
|
647
646
|
return {
|
|
648
|
-
maxWidth: Math.max(
|
|
647
|
+
maxWidth: Math.max( 64, Math.ceil( original.maxWidth / 128 ) * 64 ),
|
|
649
648
|
maxHeight: Math.max( 1, Math.floor( original.maxHeight / 2 ) )
|
|
650
649
|
};
|
|
651
650
|
|
package/src/Processor/utils.js
CHANGED
|
@@ -38,12 +38,6 @@ export function getDisplaySamples( pathTracerStage ) {
|
|
|
38
38
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export function getNearestPowerOf2( size ) {
|
|
42
|
-
|
|
43
|
-
return Math.pow( 2, Math.ceil( Math.log2( size ) ) );
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
41
|
export function disposeMaterial( material ) {
|
|
48
42
|
|
|
49
43
|
if ( Array.isArray( material ) ) {
|
package/src/RenderSettings.js
CHANGED
|
@@ -182,10 +182,10 @@ export class RenderSettings extends EventDispatcher {
|
|
|
182
182
|
|
|
183
183
|
if ( ! isPanorama ) return;
|
|
184
184
|
|
|
185
|
-
//
|
|
186
|
-
//
|
|
187
|
-
//
|
|
188
|
-
if ( denoisingManager?.
|
|
185
|
+
// MotionVector unprojects through projectionMatrixInverse, which is meaningless once
|
|
186
|
+
// every pixel is its own direction. Fall back to the spatial-only denoiser rather
|
|
187
|
+
// than leaving no strategy.
|
|
188
|
+
if ( denoisingManager?.requiresMotionVectors ) denoisingManager.setDenoiserStrategy( 'edgeaware' );
|
|
189
189
|
// Auto-focus raycasts via Raycaster.setFromCamera, which only knows the frustum.
|
|
190
190
|
cameraManager?.setAutoFocusMode( 'manual' );
|
|
191
191
|
|
package/src/Stages/Compositor.js
CHANGED
|
@@ -70,6 +70,7 @@ export class Compositor extends RenderStage {
|
|
|
70
70
|
|| context.getTexture( 'edgeFiltering:output' )
|
|
71
71
|
|| context.getTexture( 'bilateralFiltering:output' )
|
|
72
72
|
|| context.getTexture( 'asvgf:output' )
|
|
73
|
+
|| context.getTexture( 'nrd:output' )
|
|
73
74
|
|| context.getTexture( 'pathtracer:color' );
|
|
74
75
|
|
|
75
76
|
}
|