rayzee 9.1.0 → 9.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayzee",
3
- "version": "9.1.0",
3
+ "version": "9.1.2",
4
4
  "type": "module",
5
5
  "description": "Real-time WebGPU path tracing engine built on Three.js",
6
6
  "main": "dist/rayzee.umd.js",
@@ -302,9 +302,8 @@ function tokenize( text ) {
302
302
  function remainderAfterTokens( text, count ) {
303
303
 
304
304
  const re = /\S+/g;
305
- let m;
306
305
  let n = 0;
307
- while ( ( m = re.exec( text ) ) !== null ) {
306
+ while ( re.exec( text ) !== null ) {
308
307
 
309
308
  n ++;
310
309
  if ( n === count ) return text.slice( re.lastIndex );
@@ -163,7 +163,10 @@ export class KernelManager {
163
163
 
164
164
  const node = this.kernels.get( name );
165
165
  if ( ! node ) return;
166
- node.dispatchSize = [ Math.ceil( count / node.workgroupSize[ 0 ] ), 1, 1 ];
166
+ const groups = Math.ceil( count / node.workgroupSize[ 0 ] );
167
+ // Past the per-dimension limit the grid spills into rows; instanceIndex folds them back in.
168
+ const max = this.renderer?.backend?.device?.limits.maxComputeWorkgroupsPerDimension ?? 65535;
169
+ node.dispatchSize = groups > max ? [ max, Math.ceil( groups / max ), 1 ] : [ groups, 1, 1 ];
167
170
 
168
171
  }
169
172
 
@@ -18,7 +18,7 @@ import { createLogger, fmt, workerLogLevel } from '../utils/Logger.js';
18
18
  import { SRGBColorSpace } from 'three';
19
19
  import {
20
20
  TRIANGLE_DATA_LAYOUT, TEXTURE_CONSTANTS, getTextureBucketId, packTextureIndex, planTextureBuckets,
21
- packNormalOct, BVH_LEAF_MARKERS, BVH_FOLDED_FIRST_LIMIT, assertBVHIndexFits, bvhIndexView, TLAS_PLACEMENT_MASK, TRI_MATERIAL_MASK } from '../EngineDefaults.js';
21
+ packNormalOct, BVH_LEAF_MARKERS, BVH_FOLDED_FIRST_LIMIT, assertBVHIndexFits, TLAS_PLACEMENT_MASK, TRI_MATERIAL_MASK } from '../EngineDefaults.js';
22
22
  import { ISSUE_CODES } from '../EngineIssues.js';
23
23
  import { BLAS_CACHE_FORMAT, openBLASCache, saveBLASCache, templateChecksums, readNodesInto, readOrder } from '../Storage/BLASCache.js';
24
24
  import { sharedStorage } from '../Storage/shared.js';
@@ -3542,7 +3542,6 @@ export class SceneProcessor {
3542
3542
  _refitTLAS() {
3543
3543
 
3544
3544
  const tlasNodeCount = this.instanceTable.tlasNodeCount;
3545
- const FPN = 16;
3546
3545
 
3547
3546
  // Grow-only bounds buffer for TLAS refit
3548
3547
  if ( ! this._tlasBounds || this._tlasBounds.length < tlasNodeCount * 6 ) {
@@ -299,7 +299,7 @@ export class PathTracer extends PathTracerStage {
299
299
 
300
300
  }
301
301
 
302
- this._updateAccumulationUniforms( frameValue, renderMode );
302
+ this._updateAccumulationUniforms( frameValue );
303
303
  const auxMixes = this._updateAuxAccumulationUniforms( frameValue );
304
304
  this.frame.value = frameValue;
305
305
  this.seedFrame.value = this._seedTick ++;
@@ -1406,9 +1406,8 @@ export class PathTracerStage extends RenderStage {
1406
1406
  /**
1407
1407
  * Update accumulation uniforms
1408
1408
  * @param {number} frameValue
1409
- * @param {number} renderMode
1410
1409
  */
1411
- _updateAccumulationUniforms( frameValue, renderMode ) {
1410
+ _updateAccumulationUniforms( frameValue ) {
1412
1411
 
1413
1412
  const currentInteractionMode = this.cameraOptimizer?.isInInteractionMode() ?? false;
1414
1413
  this.lastInteractionModeState = currentInteractionMode;
@@ -552,7 +552,7 @@ export const sampleEmissiveTriangle = Fn( ( [
552
552
 
553
553
  export const calculateEmissiveTriangleContributionDebug = Fn( ( [
554
554
  hitPoint, normal, geomNormal, viewDir, material,
555
- bounceIndex, rngState,
555
+ _bounceIndex, rngState,
556
556
  pixelCoord, resolution, frame, dimBase,
557
557
  emissiveBoost,
558
558
  emissiveTriangleBuffer, emissiveVec4Offset, emissiveTriangleCount, emissiveTotalPower,
@@ -12,7 +12,7 @@
12
12
 
13
13
  import {
14
14
  Fn, float, vec2, vec3, vec4, int, uint,
15
- If, select, instanceIndex, atomicLoad,
15
+ If, instanceIndex, atomicLoad,
16
16
  localId, workgroupId,
17
17
  } from 'three/tsl';
18
18
 
@@ -44,7 +44,6 @@ export function buildGenerateKernel( params ) {
44
44
  renderWidth,
45
45
  chunkRowBase, chunkRows, // row band offset (global first row) + row count for this chunk
46
46
  transmissiveBounces, // per-ray refraction budget (megakernel parity: PathTracerCore.js:606)
47
- transparentBackground, // alpha inits to 1 here (megakernel parity: PathTracerCore.js:554) — env-escape-without-opaque zeroes it in Shade
48
47
  auxGBufferEnabled, // live uniform: 1 = init the per-pixel G-buffer (denoiser on), 0 = skip it
49
48
  // listDriven: 1D dispatch over the active-pixel list (activeIndicesRO[tid] = LOCAL slot) instead of 2D.
50
49
  listDriven = false, activeIndicesRO = null, counters = null,
@@ -10,11 +10,11 @@ import {
10
10
  If, Loop, normalize, max, min, exp, log, clamp, dot, length, select, smoothstep, acos,
11
11
  instanceIndex,
12
12
  sampler,
13
- atomicAdd, atomicLoad, atomicStore, uintBitsToFloat,
13
+ atomicLoad, atomicStore,
14
14
  Return,
15
15
  } from 'three/tsl';
16
16
 
17
- import { sampleEnvironment, sampleEquirectProbability, sampleEquirect, groundProjectedEnvDir } from './Environment.js';
17
+ import { sampleEnvironment, sampleEquirect, groundProjectedEnvDir } from './Environment.js';
18
18
  import { getMaterial, powerHeuristic, balanceHeuristic, classifyMaterial, REC709_LUMINANCE_COEFFICIENTS, PI_INV, EPSILON, diffuseGroundMaterial, offsetRayOrigin, SHADOW_END } from './Common.js';
19
19
  import { cosineWeightedSample } from './MaterialSampling.js';
20
20
  import { sampleAllMaterialTextures, processAnisotropyMap, applyExtensionMaps, getTransformedUV, triangleUVTangent } from './TextureSampling.js';
@@ -107,7 +107,7 @@ export function buildShadeKernel( params ) {
107
107
  accumFrame,
108
108
  chunkRowBase, // chunked path pool: global pixel = chunkRowBase·W + localSlot (rayID). See spec.
109
109
  emissiveTriangleCount, emissiveVec4Offset, emissiveTotalPower,
110
- emissiveBoost, totalTriangleCount, enableEmissiveTriangleSampling,
110
+ emissiveBoost, enableEmissiveTriangleSampling,
111
111
  lightBVHNodeCount, reverseMapVec4Offset,
112
112
  maxRayCount,
113
113
  // Aux G-buffer (normal/depth/albedo + surface ID) feeds only the denoiser/OIDN MRT. Gated by a
@@ -1297,7 +1297,7 @@ export class DenoisingManager extends EventDispatcher {
1297
1297
 
1298
1298
  }
1299
1299
 
1300
- onRenderComplete( { isStillComplete, context } ) {
1300
+ onRenderComplete( { isStillComplete } ) {
1301
1301
 
1302
1302
  // Remove any stale completion-chain listener from a previous render cycle
1303
1303
  this._cleanupCompletionListener();