rayzee 11.3.0 → 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 (35) hide show
  1. package/README.md +33 -5
  2. package/dist/{ArchiveImporter-D735xX-4.js → ArchiveImporter-Cgyx5AF7.js} +2 -2
  3. package/dist/{BidirectionalIntegrator-M89c0AlP.js → BidirectionalIntegrator-BKF-cwH2.js} +2 -2
  4. package/dist/{NeuralRetouch-DiBH63kz.js → NeuralRetouch-C3Q2XqbF.js} +4 -3
  5. package/dist/{NeuralSuperRes-CZNQP13W.js → NeuralSuperRes-DV5TtURP.js} +11 -5
  6. package/dist/{PathTracer-BXCCVrPK.js → PathTracer-D3MvEaZK.js} +19 -12
  7. package/dist/{PhysicalSky-DqmaS0lb.js → PhysicalSky-CY4jiz6a.js} +1 -1
  8. package/dist/{RayzeeRenderer-DUSMFhmc.js → RayzeeRenderer-D23m6NqG.js} +313 -281
  9. package/dist/{ToneMapGPU-BOjpul7A.js → ToneMapGPU-CTDBvmmS.js} +31 -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 +1343 -858
  15. package/dist/rayzee.umd.js +124 -113
  16. package/dist/{sceneCachePolicy-BAib5fCp.js → sceneCachePolicy-AKOEu2lf.js} +1 -1
  17. package/package.json +1 -1
  18. package/src/EngineDefaults.js +2 -2
  19. package/src/Passes/AIUpscaler.js +2 -0
  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 +30 -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 +546 -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 +11 -15
  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,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-D735xX-4.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-M89c0AlP.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-DqmaS0lb.js";
1
+ import { t as e } from "../PhysicalSky-CY4jiz6a.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-D23m6NqG.js";
3
+ import { ut as a, wt as o } from "./PathTracer-D3MvEaZK.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-AKOEu2lf.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";