rayzee 11.3.0 → 11.5.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 (35) hide show
  1. package/README.md +33 -5
  2. package/dist/{ArchiveImporter-D735xX-4.js → ArchiveImporter-29Nl1567.js} +2 -2
  3. package/dist/{BidirectionalIntegrator-M89c0AlP.js → BidirectionalIntegrator-CJay8tXK.js} +2 -2
  4. package/dist/{NeuralRetouch-DiBH63kz.js → NeuralRetouch-KqGVPV7u.js} +4 -3
  5. package/dist/{NeuralSuperRes-CZNQP13W.js → NeuralSuperRes-BHxhYzlD.js} +11 -5
  6. package/dist/{PathTracer-BXCCVrPK.js → PathTracer-Cldt0mXi.js} +19 -12
  7. package/dist/{PhysicalSky-DqmaS0lb.js → PhysicalSky-CUWrTcmT.js} +1 -1
  8. package/dist/{RayzeeRenderer-DUSMFhmc.js → RayzeeRenderer-Dd-Dit0v.js} +313 -281
  9. package/dist/{ToneMapGPU-BOjpul7A.js → ToneMapGPU-sAs8wdgI.js} +44 -22
  10. package/dist/addons/archives.es.js +1 -1
  11. package/dist/addons/bidirectional.es.js +1 -1
  12. package/dist/addons/physical-sky.es.js +1 -1
  13. package/dist/rayzee-core.es.js +3 -3
  14. package/dist/rayzee.es.js +1428 -902
  15. package/dist/rayzee.umd.js +124 -113
  16. package/dist/{sceneCachePolicy-BAib5fCp.js → sceneCachePolicy--ta6moJu.js} +1 -1
  17. package/package.json +1 -1
  18. package/src/EngineDefaults.js +2 -2
  19. package/src/Passes/AIUpscaler.js +17 -12
  20. package/src/PathTracerApp.js +122 -16
  21. package/src/Pipeline/CompletionTracker.js +7 -3
  22. package/src/Processor/ToneMapCPU.js +16 -4
  23. package/src/Processor/ToneMapGPU.js +49 -14
  24. package/src/RayzeeRenderer.js +54 -7
  25. package/src/RenderSettings.js +4 -2
  26. package/src/Stages/AutoExposure.js +484 -494
  27. package/src/Stages/Compositor.js +27 -6
  28. package/src/Stages/LocalExposure.js +569 -0
  29. package/src/Stages/PathTracer.js +6 -4
  30. package/src/Stages/PathTracerStage.js +9 -7
  31. package/src/index.js +1 -0
  32. package/src/managers/DenoisingManager.js +93 -34
  33. package/src/managers/VideoRenderManager.js +30 -4
  34. package/src/neural/NeuralRetouch.js +1 -0
  35. package/src/neural/NeuralSuperRes.js +6 -1
@@ -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,38 @@ 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, t = {}) {
134
+ let n = t.gain;
135
+ if (!n?.device || n.device === this.device) return this._dispatch(e, t);
136
+ let r = await n.copyTo(this.device);
137
+ try {
138
+ return await this._dispatch(e, {
139
+ ...t,
140
+ gain: r
141
+ });
142
+ } finally {
143
+ r.destroy();
144
+ }
145
+ }
146
+ async _dispatch(e, { exposure: t = 1, toneMapping: n = 0, saturation: r = 1, flipY: i = !1, preserveAlpha: a = !1, gain: o = null } = {}) {
129
147
  if (this.disposed) throw Error("PackedToneMapper: disposed");
130
148
  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]) => ({
149
+ let c = this._ensurePipeline(o);
150
+ this._ensureTables();
151
+ let { width: l, height: u } = this, d = l * u * s[this.output];
152
+ 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);
153
+ let f = [...this._tables.entries()].map(([e, t]) => ({
135
154
  binding: e,
136
155
  resource: t.view
137
- })), d = this.device.createBindGroup({
138
- layout: this._pipeline.getBindGroupLayout(0),
156
+ })), p = this.device.createBindGroup({
157
+ layout: c.getBindGroupLayout(0),
139
158
  entries: [
140
- ...u,
159
+ ...f,
141
160
  {
142
161
  binding: 0,
143
162
  resource: this.input === "texture" ? e.createView() : {
144
163
  buffer: e,
145
- size: o * c * 8
164
+ size: l * u * 8
146
165
  }
147
166
  },
148
167
  {
@@ -154,10 +173,13 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
154
173
  resource: { buffer: this._params }
155
174
  }
156
175
  ]
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;
176
+ }), m = this.device.createCommandEncoder({ label: this.label }), h = m.beginComputePass();
177
+ h.setPipeline(c), h.setBindGroup(0, p), o && h.setBindGroup(1, this.device.createBindGroup({
178
+ layout: c.getBindGroupLayout(1),
179
+ entries: o.entries
180
+ })), 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);
181
+ let g = this._map.getMappedRange().slice(0);
182
+ return this._map.unmap(), g;
161
183
  }
162
184
  release() {
163
185
  this._releaseBuffers(), this.width = this.height = 0;
@@ -169,7 +191,7 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
169
191
  if (!this.disposed) {
170
192
  this.disposed = !0, this._releaseBuffers();
171
193
  for (let e of this._tables.values()) e.texture.destroy();
172
- this._tables.clear(), this._pipeline = null;
194
+ this._tables.clear(), this._pipelines.clear();
173
195
  }
174
196
  }
175
197
  };
@@ -1,3 +1,3 @@
1
1
  import { n as e, t } from "../ZipReader-gDSWr0I5.js";
2
- import { n, t as r } from "../ArchiveImporter-D735xX-4.js";
2
+ import { n, t as r } from "../ArchiveImporter-29Nl1567.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-M89c0AlP.js";
1
+ import { t as e } from "../BidirectionalIntegrator-CJay8tXK.js";
2
2
  export { e as BidirectionalIntegrator };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../PhysicalSky-DqmaS0lb.js";
1
+ import { t as e } from "../PhysicalSky-CUWrTcmT.js";
2
2
  export { e as PhysicalSky };
@@ -1,8 +1,8 @@
1
1
  import "./SolarLimb-bZE6y63S.js";
2
- import { a as e, n as t, o as n, r, t as i } from "./RayzeeRenderer-DUSMFhmc.js";
3
- import { ut as a, wt as o } from "./PathTracer-BXCCVrPK.js";
2
+ import { a as e, n as t, o as n, r, t as i } from "./RayzeeRenderer-Dd-Dit0v.js";
3
+ import { ut as a, wt as o } from "./PathTracer-Cldt0mXi.js";
4
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-BAib5fCp.js";
5
+ import { G as l, q as u, r as d, x as f, y as p } from "./sceneCachePolicy--ta6moJu.js";
6
6
  import { i as m, n as h, r as g, t as _ } from "./Logger-dDDGj9Av.js";
7
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";