rayzee 11.2.1 → 11.4.0

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.
Files changed (76) hide show
  1. package/README.md +91 -34
  2. package/dist/ArchiveImporter-Cgyx5AF7.js +7860 -0
  3. package/dist/BidirectionalIntegrator-BKF-cwH2.js +954 -0
  4. package/dist/{BufferLayout-D_IBo2ci.js → BufferLayout-xPRH9jYD.js} +41 -5
  5. package/dist/{NeuralRetouch-Cr-otSW8.js → NeuralRetouch-C3Q2XqbF.js} +4 -3
  6. package/dist/{NeuralSuperRes-B7E3_M0t.js → NeuralSuperRes-DV5TtURP.js} +11 -5
  7. package/dist/{PathTracer-D6nbknj5.js → PathTracer-D3MvEaZK.js} +4384 -4618
  8. package/dist/{PhysicalSky-Dq5VSiCQ.js → PhysicalSky-CY4jiz6a.js} +2 -2
  9. package/dist/{RayzeeRenderer-DbjqO6v-.js → RayzeeRenderer-D23m6NqG.js} +486 -391
  10. package/dist/SolarLimb-bZE6y63S.js +762 -0
  11. package/dist/{ToneMapGPU-BOjpul7A.js → ToneMapGPU-CTDBvmmS.js} +31 -22
  12. package/dist/addons/archives.es.js +1 -1
  13. package/dist/addons/bidirectional.es.js +1 -1
  14. package/dist/addons/physical-sky.es.js +1 -1
  15. package/dist/rayzee-core.es.js +7 -7
  16. package/dist/rayzee.es.js +1327 -838
  17. package/dist/rayzee.umd.js +146 -134
  18. package/dist/sceneCachePolicy-AKOEu2lf.js +1602 -0
  19. package/package.json +1 -1
  20. package/src/EngineDefaults.js +2 -2
  21. package/src/Passes/AIUpscaler.js +2 -0
  22. package/src/PathTracerApp.js +126 -19
  23. package/src/Pipeline/CompletionTracker.js +7 -3
  24. package/src/Processor/ArchiveImporter.js +173 -94
  25. package/src/Processor/ArchiveReader.js +20 -23
  26. package/src/Processor/AssetLoader.js +48 -1
  27. package/src/Processor/BVHRefitter.js +109 -13
  28. package/src/Processor/BufferLayout.js +115 -0
  29. package/src/Processor/ChunkedRecords.js +3 -2
  30. package/src/Processor/EmissiveTriangleBuilder.js +6 -6
  31. package/src/Processor/GeometryExtractor.js +189 -79
  32. package/src/Processor/HostMemory.js +39 -9
  33. package/src/Processor/InstanceTable.js +714 -42
  34. package/src/Processor/PBRT/PBRTCurves.js +224 -6
  35. package/src/Processor/PBRT/PBRTMaterials.js +3 -0
  36. package/src/Processor/PBRT/PBRTSceneBuilder.js +82 -25
  37. package/src/Processor/PackedRayBuffer.js +5 -2
  38. package/src/Processor/SceneProcessor.js +747 -141
  39. package/src/Processor/TLASBuilder.js +32 -17
  40. package/src/Processor/ToneMapCPU.js +16 -4
  41. package/src/Processor/ToneMapGPU.js +30 -14
  42. package/src/Processor/USD/USDLayer.js +1149 -0
  43. package/src/Processor/USD/USDScene.js +1655 -0
  44. package/src/Processor/USD/USDStage.js +682 -0
  45. package/src/Processor/USD/USDText.js +674 -0
  46. package/src/Processor/USD/index.js +138 -0
  47. package/src/Processor/Workers/BVHRefitWorker.js +3 -3
  48. package/src/RayzeeRenderer.js +221 -33
  49. package/src/RenderSettings.js +4 -2
  50. package/src/Stages/AutoExposure.js +484 -494
  51. package/src/Stages/Compositor.js +27 -6
  52. package/src/Stages/LocalExposure.js +546 -0
  53. package/src/Stages/NormalDepth.js +7 -12
  54. package/src/Stages/PathTracer.js +18 -21
  55. package/src/Stages/PathTracerStage.js +282 -103
  56. package/src/Storage/GeometrySpill.js +46 -14
  57. package/src/Storage/SceneGraphCodec.js +17 -3
  58. package/src/Storage/SpillStore.js +9 -0
  59. package/src/TSL/BVHTraversal.js +183 -7
  60. package/src/TSL/Common.js +57 -13
  61. package/src/TSL/ShadeKernel.js +3 -2
  62. package/src/TSL/TextureSampling.js +11 -8
  63. package/src/TSL/patches.js +84 -0
  64. package/src/index.js +1 -0
  65. package/src/integrators/BidirectionalIntegrator.js +20 -2
  66. package/src/managers/DenoisingManager.js +15 -19
  67. package/src/managers/InteractionManager.js +19 -6
  68. package/src/managers/MaterialDataManager.js +22 -5
  69. package/src/managers/UniformManager.js +3 -0
  70. package/src/managers/VideoRenderManager.js +30 -4
  71. package/src/neural/NeuralRetouch.js +1 -0
  72. package/src/neural/NeuralSuperRes.js +6 -1
  73. package/dist/ArchiveImporter-D_x863yu.js +0 -5198
  74. package/dist/BidirectionalIntegrator-DmkxxEOR.js +0 -946
  75. package/dist/SolarLimb-CPaeZVwz.js +0 -721
  76. package/dist/sceneCachePolicy-C4-4qwt6.js +0 -485
@@ -22,7 +22,7 @@ var a = {
22
22
  }, s = {
23
23
  rgba8: 4,
24
24
  planar: 16
25
- }, c = (e, t, n) => `
25
+ }, c = (e, t, n, r) => `
26
26
  struct Params {
27
27
  width: u32,
28
28
  height: u32,
@@ -38,6 +38,7 @@ ${a[t]}
38
38
 
39
39
  ${e}
40
40
  ${o[n]}
41
+ ${r ?? ""}
41
42
 
42
43
  @compute @workgroup_size(8, 8)
43
44
  fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
@@ -47,25 +48,29 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
47
48
  if ( params.flipY == 1u ) { srcY = params.height - 1u - gid.y; }
48
49
 
49
50
  let linear = rayzee_source( gid.x, srcY );
50
- rayzee_store( gid.y * params.width + gid.x, linear, rayzee_tone_map( linear.rgb, params.mode, params.exposure, params.saturation ) );
51
+ let uv = vec2<f32>( ( f32( gid.x ) + 0.5 ) / f32( params.width ), ( f32( gid.y ) + 0.5 ) / f32( params.height ) );
52
+ let rgb = linear.rgb${r ? " * rayzee_gain( uv, linear.rgb, params.exposure )" : ""};
53
+ rayzee_store( gid.y * params.width + gid.x, linear, rayzee_tone_map( rgb, params.mode, params.exposure, params.saturation ) );
51
54
  }
52
55
  `, l = 32, u = class {
53
56
  constructor(e, t = "rayzee:tonemap", { input: n = "packed", output: r = "rgba8" } = {}) {
54
- this.device = e, this.label = t, this.input = n, this.output = r, this.width = 0, this.height = 0, this._pipeline = null, this._storage = null, this._map = null, this._params = null, this._paramData = new ArrayBuffer(l), this._paramU32 = new Uint32Array(this._paramData), this._paramF32 = new Float32Array(this._paramData), this._shaderVersion = -1, this._bindings = [], this._tables = /* @__PURE__ */ new Map(), this.disposed = !1;
57
+ this.device = e, this.label = t, this.input = n, this.output = r, this.width = 0, this.height = 0, this._pipelines = /* @__PURE__ */ new Map(), this._storage = null, this._map = null, this._params = null, this._paramData = new ArrayBuffer(l), this._paramU32 = new Uint32Array(this._paramData), this._paramF32 = new Float32Array(this._paramData), this._shaderVersion = -1, this._bindings = [], this._tables = /* @__PURE__ */ new Map(), this.disposed = !1;
55
58
  }
56
- _ensurePipeline() {
57
- let { wgsl: e, bindings: t, version: n } = i();
58
- this._pipeline && this._shaderVersion === n || (this._bindings = t, this._shaderVersion = n, this._pipeline = this.device.createComputePipeline({
59
+ _ensurePipeline(e = null) {
60
+ let { wgsl: t, bindings: n, version: r } = i();
61
+ this._shaderVersion !== r && (this._pipelines.clear(), this._bindings = n, this._shaderVersion = r);
62
+ let a = e?.key ?? "", o = this._pipelines.get(a);
63
+ return o || (o = this.device.createComputePipeline({
59
64
  label: this.label,
60
65
  layout: "auto",
61
66
  compute: {
62
67
  module: this.device.createShaderModule({
63
68
  label: this.label,
64
- code: c(e, this.input, this.output)
69
+ code: c(t, this.input, this.output, e?.wgsl)
65
70
  }),
66
71
  entryPoint: "main"
67
72
  }
68
- }));
73
+ }), this._pipelines.set(a, o), o);
69
74
  }
70
75
  _ensureTables() {
71
76
  let e = /* @__PURE__ */ new Set();
@@ -125,24 +130,25 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
125
130
  async toPlanar(e, t) {
126
131
  return new Float32Array(await this._run(e, t));
127
132
  }
128
- async _run(e, { exposure: t = 1, toneMapping: n = 0, saturation: r = 1, flipY: i = !1, preserveAlpha: a = !1 } = {}) {
133
+ async _run(e, { exposure: t = 1, toneMapping: n = 0, saturation: r = 1, flipY: i = !1, preserveAlpha: a = !1, gain: o = null } = {}) {
129
134
  if (this.disposed) throw Error("PackedToneMapper: disposed");
130
135
  if (!this._storage) throw Error("PackedToneMapper: call ensureSize() first");
131
- this._ensurePipeline(), this._ensureTables();
132
- let { width: o, height: c } = this, l = o * c * s[this.output];
133
- this._paramU32[0] = o, this._paramU32[1] = c, this._paramU32[2] = n >>> 0, this._paramU32[3] = +!!i, this._paramF32[4] = t, this._paramF32[5] = r, this._paramU32[6] = +!!a, this.device.queue.writeBuffer(this._params, 0, this._paramData);
134
- let u = [...this._tables.entries()].map(([e, t]) => ({
136
+ let c = this._ensurePipeline(o);
137
+ this._ensureTables();
138
+ let { width: l, height: u } = this, d = l * u * s[this.output];
139
+ this._paramU32[0] = l, this._paramU32[1] = u, this._paramU32[2] = n >>> 0, this._paramU32[3] = +!!i, this._paramF32[4] = t, this._paramF32[5] = r, this._paramU32[6] = +!!a, this.device.queue.writeBuffer(this._params, 0, this._paramData);
140
+ let f = [...this._tables.entries()].map(([e, t]) => ({
135
141
  binding: e,
136
142
  resource: t.view
137
- })), d = this.device.createBindGroup({
138
- layout: this._pipeline.getBindGroupLayout(0),
143
+ })), p = this.device.createBindGroup({
144
+ layout: c.getBindGroupLayout(0),
139
145
  entries: [
140
- ...u,
146
+ ...f,
141
147
  {
142
148
  binding: 0,
143
149
  resource: this.input === "texture" ? e.createView() : {
144
150
  buffer: e,
145
- size: o * c * 8
151
+ size: l * u * 8
146
152
  }
147
153
  },
148
154
  {
@@ -154,10 +160,13 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
154
160
  resource: { buffer: this._params }
155
161
  }
156
162
  ]
157
- }), f = this.device.createCommandEncoder({ label: this.label }), p = f.beginComputePass();
158
- p.setPipeline(this._pipeline), p.setBindGroup(0, d), p.dispatchWorkgroups(Math.ceil(o / 8), Math.ceil(c / 8)), p.end(), f.copyBufferToBuffer(this._storage, 0, this._map, 0, l), this.device.queue.submit([f.finish()]), await this._map.mapAsync(GPUMapMode.READ);
159
- let m = this._map.getMappedRange().slice(0);
160
- return this._map.unmap(), m;
163
+ }), m = this.device.createCommandEncoder({ label: this.label }), h = m.beginComputePass();
164
+ h.setPipeline(c), h.setBindGroup(0, p), o && h.setBindGroup(1, this.device.createBindGroup({
165
+ layout: c.getBindGroupLayout(1),
166
+ entries: o.entries
167
+ })), h.dispatchWorkgroups(Math.ceil(l / 8), Math.ceil(u / 8)), h.end(), m.copyBufferToBuffer(this._storage, 0, this._map, 0, d), this.device.queue.submit([m.finish()]), await this._map.mapAsync(GPUMapMode.READ);
168
+ let g = this._map.getMappedRange().slice(0);
169
+ return this._map.unmap(), g;
161
170
  }
162
171
  release() {
163
172
  this._releaseBuffers(), this.width = this.height = 0;
@@ -169,7 +178,7 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
169
178
  if (!this.disposed) {
170
179
  this.disposed = !0, this._releaseBuffers();
171
180
  for (let e of this._tables.values()) e.texture.destroy();
172
- this._tables.clear(), this._pipeline = null;
181
+ this._tables.clear(), this._pipelines.clear();
173
182
  }
174
183
  }
175
184
  };
@@ -1,3 +1,3 @@
1
1
  import { n as e, t } from "../ZipReader-gDSWr0I5.js";
2
- import { n, t as r } from "../ArchiveImporter-D_x863yu.js";
2
+ import { n, t as r } from "../ArchiveImporter-Cgyx5AF7.js";
3
3
  export { r as ARCHIVE_ELEMENT_PROMPT_BYTES, n as ArchiveImporter, t as openZip, e as readZipDirectory };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../BidirectionalIntegrator-DmkxxEOR.js";
1
+ import { t as e } from "../BidirectionalIntegrator-BKF-cwH2.js";
2
2
  export { e as BidirectionalIntegrator };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../PhysicalSky-Dq5VSiCQ.js";
1
+ import { t as e } from "../PhysicalSky-CY4jiz6a.js";
2
2
  export { e as PhysicalSky };
@@ -1,12 +1,12 @@
1
- import "./SolarLimb-CPaeZVwz.js";
2
- import { a as e, n as t, o as n, r, t as i } from "./RayzeeRenderer-DbjqO6v-.js";
3
- import { Mt as a, St as o, ut as s, wt as c } from "./PathTracer-D6nbknj5.js";
4
- import { n as l, t as u } from "./EngineEvents-Ci8dVWCP.js";
5
- import { _ as d, r as f, y as p } from "./sceneCachePolicy-C4-4qwt6.js";
1
+ import "./SolarLimb-bZE6y63S.js";
2
+ import { a as e, n as t, o as n, r, t as i } from "./RayzeeRenderer-D23m6NqG.js";
3
+ import { ut as a, wt as o } from "./PathTracer-D3MvEaZK.js";
4
+ import { n as s, t as c } from "./EngineEvents-Ci8dVWCP.js";
5
+ import { G as l, q as u, r as d, x as f, y as p } from "./sceneCachePolicy-AKOEu2lf.js";
6
6
  import { i as m, n as h, r as g, t as _ } from "./Logger-dDDGj9Av.js";
7
- import { s as v } from "./BufferLayout-D_IBo2ci.js";
7
+ import { f as v } from "./BufferLayout-xPRH9jYD.js";
8
8
  import { i as y, n as b, r as x, t as S } from "./EngineIssues-CIZnXHsF.js";
9
9
  import { n as C, t as w } from "./AssetConfig-DSEntE65.js";
10
10
  import { d as T, p as E, t as D, u as O } from "./ViewTransforms-CYN7bq2w.js";
11
11
  import { a as k, r as A } from "./SceneMetadata-D2Sh-0e-.js";
12
- export { A as ARCHIVE_FORMATS, D as DEFAULT_VIEW, o as ENGINE_DEFAULTS, u as EngineEvents, S as EngineIssueError, b as ISSUE_CODES, x as ISSUE_SEVERITY, y as IssueLog, l as LEGACY_EVENT_NAMES, _ as LOG_LEVELS, r as LightManager, h as Logger, c as MATERIAL_DEFAULTS, a as MAX_RESERVABLE_RENDER_SIZE, i as RayzeeRenderer, e as RenderSettings, n as SETTING_SOURCE, s as SKY_DEFAULTS, v as TRIANGLE_DATA_LAYOUT, f as VERSION, w as configureAssets, d as configurePlatform, g as createLogger, t as describeAdapter, m as fmt, C as getAssetConfig, p as getPlatform, O as getViewTransform, T as listViewTransforms, k as localFolder, E as onRegistryChange };
12
+ export { A as ARCHIVE_FORMATS, D as DEFAULT_VIEW, l as ENGINE_DEFAULTS, c as EngineEvents, S as EngineIssueError, b as ISSUE_CODES, x as ISSUE_SEVERITY, y as IssueLog, s as LEGACY_EVENT_NAMES, _ as LOG_LEVELS, r as LightManager, h as Logger, u as MATERIAL_DEFAULTS, o as MAX_RESERVABLE_RENDER_SIZE, i as RayzeeRenderer, e as RenderSettings, n as SETTING_SOURCE, a as SKY_DEFAULTS, v as TRIANGLE_DATA_LAYOUT, d as VERSION, w as configureAssets, p as configurePlatform, g as createLogger, t as describeAdapter, m as fmt, C as getAssetConfig, f as getPlatform, O as getViewTransform, T as listViewTransforms, k as localFolder, E as onRegistryChange };