rayzee 11.9.0 → 11.11.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 (43) hide show
  1. package/dist/{ArchiveImporter-BJxszU_k.js → ArchiveImporter-D5XOC3tN.js} +27 -12
  2. package/dist/{BidirectionalIntegrator-DWg66vAd.js → BidirectionalIntegrator-DqG0BEIz.js} +295 -295
  3. package/dist/{BufferLayout-Bzgccg1o.js → BufferLayout-BROyMqO1.js} +3 -1
  4. package/dist/{NeuralRetouch-BD9E-Yht.js → NeuralRetouch-BkxZPOYq.js} +1 -1
  5. package/dist/{NeuralSuperRes-C8Mf3tJX.js → NeuralSuperRes-a8xDtvXM.js} +1 -1
  6. package/dist/{PathTracer-DeE9UJ1n.js → PathTracer-C_gliSWI.js} +3037 -3002
  7. package/dist/{PhysicalSky-cKy75-oR.js → PhysicalSky-DWK8pS0U.js} +45 -45
  8. package/dist/{RayzeeRenderer-CzLyBA3G.js → RayzeeRenderer-B4ZehMg_.js} +40 -40
  9. package/dist/{SceneMetadata-C17UfOEp.js → SceneMetadata-Bb3iwWhh.js} +1 -1
  10. package/dist/SolarLimb-ZYl-Pwl0.js +821 -0
  11. package/dist/addons/archives.es.js +1 -1
  12. package/dist/addons/bidirectional.es.js +1 -1
  13. package/dist/addons/physical-sky.es.js +1 -1
  14. package/dist/rayzee-core.es.js +6 -6
  15. package/dist/rayzee.es.js +95 -95
  16. package/dist/rayzee.umd.js +110 -110
  17. package/dist/{sceneCachePolicy-ywbGKHD3.js → sceneCachePolicy-BHNKvrHR.js} +12 -5
  18. package/package.json +1 -1
  19. package/src/EngineDefaults.js +3 -0
  20. package/src/Processor/BufferLayout.js +7 -6
  21. package/src/Processor/GeometryExtractor.js +8 -1
  22. package/src/Processor/MaterialPacking.js +5 -8
  23. package/src/Processor/PBRT/PBRTMaterials.js +2 -0
  24. package/src/Processor/PBRT/PBRTSceneBuilder.js +4 -3
  25. package/src/Processor/SceneProcessor.js +6 -2
  26. package/src/Processor/USD/USDScene.js +17 -1
  27. package/src/Processor/utils.js +1 -156
  28. package/src/Stages/PathTracer.js +9 -0
  29. package/src/Storage/SceneGraphCodec.js +2 -0
  30. package/src/TSL/Clearcoat.js +4 -4
  31. package/src/TSL/Common.js +36 -25
  32. package/src/TSL/EmissiveSampling.js +1 -1
  33. package/src/TSL/LightsSampling.js +1 -1
  34. package/src/TSL/MaterialEvaluation.js +34 -14
  35. package/src/TSL/MaterialProperties.js +37 -1
  36. package/src/TSL/MaterialTransmission.js +3 -9
  37. package/src/TSL/PathTracerCore.js +3 -2
  38. package/src/TSL/SceneResources.js +12 -1
  39. package/src/TSL/ShadeKernel.js +63 -14
  40. package/src/TSL/Struct.js +6 -0
  41. package/src/TSL/TextureSampling.js +29 -23
  42. package/src/managers/MaterialDataManager.js +21 -1
  43. package/dist/SolarLimb-DRYy8tln.js +0 -774
@@ -1,9 +1,9 @@
1
- import { n as e } from "./BidirectionalIntegrator-DWg66vAd.js";
2
- import { A as t, T as n, at as r, n as i, r as a, v as o, x as s } from "./sceneCachePolicy-ywbGKHD3.js";
1
+ import { n as e } from "./BidirectionalIntegrator-DqG0BEIz.js";
2
+ import { A as t, T as n, at as r, n as i, r as a, v as o, x as s } from "./sceneCachePolicy-BHNKvrHR.js";
3
3
  import { n as c, r as l, t as u } from "./EngineIssues-CfJiBaNj.js";
4
4
  import { r as d } from "./shared-BGBcSxBQ.js";
5
5
  import { i as f, n as p, o as m, r as h } from "./identity-C1cLD1C0.js";
6
- import { a as g, s as _, t as v } from "./SceneMetadata-C17UfOEp.js";
6
+ import { a as g, s as _, t as v } from "./SceneMetadata-Bb3iwWhh.js";
7
7
  import { n as y, t as b } from "./ZipReader-gDSWr0I5.js";
8
8
  import { AnimationClip as x, BooleanKeyframeTrack as S, BoxGeometry as C, BufferAttribute as w, BufferGeometry as T, CapsuleGeometry as ee, ClampToEdgeWrapping as E, Color as D, ConeGeometry as te, CylinderGeometry as ne, DataTexture as O, DirectionalLight as re, DoubleSide as k, EquirectangularReflectionMapping as ie, Euler as ae, Float32BufferAttribute as A, FloatType as oe, FrontSide as se, Group as ce, InstancedBufferAttribute as le, InstancedMesh as ue, LinearFilter as de, LoadingManager as fe, MaterialLoader as pe, Matrix4 as j, Mesh as me, MeshPhysicalMaterial as M, MirroredRepeatWrapping as he, NoColorSpace as ge, NumberKeyframeTrack as _e, Object3D as ve, OrthographicCamera as ye, PerspectiveCamera as be, PlaneGeometry as xe, PointLight as Se, Quaternion as Ce, QuaternionKeyframeTrack as we, RGBAFormat as Te, RectAreaLight as Ee, RepeatWrapping as De, SRGBColorSpace as N, SphereGeometry as Oe, SpotLight as ke, Texture as Ae, Uint32BufferAttribute as P, Vector3 as F, VectorKeyframeTrack as je } from "three";
9
9
  import { HDRLoader as Me } from "three/addons/loaders/HDRLoader.js";
@@ -529,7 +529,7 @@ function Mt(e, t) {
529
529
  r.g,
530
530
  r.b
531
531
  ]);
532
- e.ior !== void 0 && (n.exactIor = e.ior), e.diffuseTransmission !== void 0 && (n.diffuseTransmission = e.diffuseTransmission);
532
+ e.ior !== void 0 && (n.exactIor = e.ior), e.diffuseTransmission !== void 0 && (n.diffuseTransmission = e.diffuseTransmission), e.diffuseRoughness !== void 0 && (n.diffuseRoughness = e.diffuseRoughness);
533
533
  for (let t of ht) e[t]?.isTexture && ((n.engineTextures ??= {})[t] = e[t].uuid);
534
534
  return n;
535
535
  }
@@ -659,7 +659,7 @@ async function Vt(e, t, { loadTexture: n }) {
659
659
  for (let t of e.materials) {
660
660
  let e = s.parse(t);
661
661
  for (let [n, r] of Object.entries(t.exactColors ?? {})) n === "diffuseTransmissionColor" && (e[n] = new D()), e[n]?.setRGB(r[0], r[1], r[2]);
662
- t.exactIor !== void 0 && (e.ior = t.exactIor), t.diffuseTransmission !== void 0 && (e.diffuseTransmission = t.diffuseTransmission);
662
+ t.exactIor !== void 0 && (e.ior = t.exactIor), t.diffuseTransmission !== void 0 && (e.diffuseTransmission = t.diffuseTransmission), t.diffuseRoughness !== void 0 && (e.diffuseRoughness = t.diffuseRoughness);
663
663
  for (let [n, r] of Object.entries(t.engineTextures ?? {})) o[r] && (e[n] = o[r]);
664
664
  c[t.uuid] = e;
665
665
  }
@@ -2463,7 +2463,7 @@ async function $n(e, t) {
2463
2463
  break;
2464
2464
  }
2465
2465
  let s = K(r, "normalmap", null);
2466
- return s && t.resolveNormalMap && (i.normalMap = await t.resolveNormalMap(s)), i.roughness = Math.max(0, Math.min(1, i.roughness)), i;
2466
+ return s && t.resolveNormalMap && (i.normalMap = await t.resolveNormalMap(s)), i.clearcoat > 0 && i.normalMap && (i.clearcoatNormalMap = i.normalMap), i.roughness = Math.max(0, Math.min(1, i.roughness)), i;
2467
2467
  }
2468
2468
  //#endregion
2469
2469
  //#region src/Processor/PBRT/PBRTTextureBake.js
@@ -3264,7 +3264,8 @@ var pi = [
3264
3264
  "map",
3265
3265
  "roughnessMap",
3266
3266
  "clearcoatRoughnessMap",
3267
- "normalMap"
3267
+ "normalMap",
3268
+ "clearcoatNormalMap"
3268
3269
  ], mi = {
3269
3270
  roughnessMap: "roughness",
3270
3271
  clearcoatRoughnessMap: "clearcoatRoughness"
@@ -4059,7 +4060,7 @@ var Ii = class {
4059
4060
  return u.attenuationDistance = 1 / l, u.attenuationColor.setRGB(...c.map((e) => Math.exp(-e / l))), this._dedupeMaterial(u);
4060
4061
  }
4061
4062
  _dedupeMaterial(e) {
4062
- let t = e.color, n = e.emissive, r = `${t.r},${t.g},${t.b}|${n.r},${n.g},${n.b}|${e.emissiveIntensity}|${e.map ? e.map.uuid : "-"}|${e.roughness}|${e.roughnessMap?.uuid ?? "-"}|${e.metalness}|${e.transmission}|${e.ior}|${e.thickness}|${e.clearcoat}|${e.clearcoatRoughness}|${e.clearcoatRoughnessMap?.uuid ?? "-"}|${e.opacity}|${e.side}|${e.normalMap ? e.normalMap.uuid : "-"}|${e.attenuationDistance}|${e.attenuationColor.toArray()}|${e.specularIntensity}|${e.diffuseTransmission ?? 0}|${e.diffuseTransmissionColor?.toArray() ?? "-"}|${e.subsurface ?? 0}|${e.subsurfaceColor?.toArray() ?? "-"}|${e.subsurfaceRadius ?? "-"}|${e.subsurfaceAnisotropy ?? 0}`;
4063
+ let t = e.color, n = e.emissive, r = `${t.r},${t.g},${t.b}|${n.r},${n.g},${n.b}|${e.emissiveIntensity}|${e.map ? e.map.uuid : "-"}|${e.roughness}|${e.roughnessMap?.uuid ?? "-"}|${e.metalness}|${e.transmission}|${e.ior}|${e.thickness}|${e.clearcoat}|${e.clearcoatRoughness}|${e.clearcoatRoughnessMap?.uuid ?? "-"}|${e.opacity}|${e.side}|${e.normalMap ? e.normalMap.uuid : "-"}|${e.attenuationDistance}|${e.attenuationColor.toArray()}|${e.specularIntensity}|${e.diffuseTransmission ?? 0}|${e.diffuseTransmissionColor?.toArray() ?? "-"}|${e.subsurface ?? 0}|${e.subsurfaceColor?.toArray() ?? "-"}|${e.subsurfaceRadius ?? "-"}|${e.subsurfaceAnisotropy ?? 0}|${e.diffuseRoughness ?? 0}`;
4063
4064
  return this._materialBySignature.get(r) || (this._materialBySignature.set(r, e), e);
4064
4065
  }
4065
4066
  _poweredMaterial(e, t, n) {
@@ -7610,6 +7611,9 @@ var as = class {
7610
7611
  uvSet: "st"
7611
7612
  };
7612
7613
  }
7614
+ mtlxDiffuseRoughness(e) {
7615
+ return e?.texture && this.warnOnce("mtlx:diffuseroughness", "MaterialX diffuse roughness from a texture is not read"), Z(e?.value) ? e.value : 0;
7616
+ }
7613
7617
  async openPbrSurface(e) {
7614
7618
  let t = (t) => this.term(e, t), n = async (e, n) => {
7615
7619
  let r = (await t(e))?.value;
@@ -7617,7 +7621,7 @@ var as = class {
7617
7621
  }, r = new M({ side: k }), i = this.mtlxSurfaceOf(r);
7618
7622
  r.color.setRGB(.8, .8, .8), await this.mtlxWeighted(r, "color", await t("base_color"), await n("base_weight", 1), i, "map"), r.metalness = 0, await this.applyScalar(r, "metalness", await t("base_metalness"), i, "metalnessMap", "b"), r.roughness = .3, await this.applyScalar(r, "roughness", await t("specular_roughness"), i, "roughnessMap", "g"), r.specularIntensity = Math.min(1, await n("specular_weight", 1));
7619
7623
  let a = (await t("specular_color"))?.value;
7620
- Array.isArray(a) && r.specularColor.setRGB(a[0], a[1], a[2]), r.ior = await n("specular_ior", 1.5), r.anisotropy = await n("specular_roughness_anisotropy", 0);
7624
+ Array.isArray(a) && r.specularColor.setRGB(a[0], a[1], a[2]), r.ior = await n("specular_ior", 1.5), r.anisotropy = await n("specular_roughness_anisotropy", 0), r.diffuseRoughness = this.mtlxDiffuseRoughness(await t("base_diffuse_roughness"));
7621
7625
  let o = await n("transmission_weight", 0);
7622
7626
  if (o > 0) {
7623
7627
  r.transmission = o;
@@ -7660,7 +7664,7 @@ var as = class {
7660
7664
  }, r = new M({ side: k }), i = this.mtlxSurfaceOf(r);
7661
7665
  r.color.setRGB(.8, .8, .8), await this.mtlxWeighted(r, "color", await t("base_color"), await n("base", 1), i, "map"), r.metalness = 0, await this.applyScalar(r, "metalness", await t("metalness"), i, "metalnessMap", "b"), r.roughness = .2, await this.applyScalar(r, "roughness", await t("specular_roughness"), i, "roughnessMap", "g"), r.specularIntensity = Math.min(1, await n("specular", 1));
7662
7666
  let a = (await t("specular_color"))?.value;
7663
- Array.isArray(a) && r.specularColor.setRGB(a[0], a[1], a[2]), r.ior = await n("specular_IOR", 1.5), r.anisotropy = await n("specular_anisotropy", 0), r.anisotropyRotation = await n("specular_rotation", 0) * Math.PI * 2;
7667
+ Array.isArray(a) && r.specularColor.setRGB(a[0], a[1], a[2]), r.ior = await n("specular_IOR", 1.5), r.anisotropy = await n("specular_anisotropy", 0), r.anisotropyRotation = await n("specular_rotation", 0) * Math.PI * 2, r.diffuseRoughness = this.mtlxDiffuseRoughness(await t("diffuse_roughness"));
7664
7668
  let o = await n("transmission", 0);
7665
7669
  if (o > 0) {
7666
7670
  r.transmission = o;
@@ -7747,6 +7751,8 @@ var as = class {
7747
7751
  for (let n = 0; n < 3; n++) s[n] += (Z(e) ? e : e[n]) * t.w / o;
7748
7752
  }
7749
7753
  n && n.w / o >= .5 ? (await this.applyColor(r, "color", n.color, i, "map"), e.some((e) => e !== n && e.w > 0) && this.warnOnce("mtlx:lobecolor", "MaterialX lobes of different colours over a texture are read as the texture")) : r.color.setRGB(s[0], s[1], s[2]), r.metalness = a(["conductor"]) / o, r.transmission = a(["transmission"]) / o;
7754
+ let c = t.filter((e) => e.kind === "diffuse" && e.w > 0), l = a(["diffuse"]);
7755
+ l > 0 && (r.diffuseRoughness = c.reduce((e, t) => e + t.roughness * t.w, 0) / l);
7750
7756
  } else r.color.setRGB(0, 0, 0);
7751
7757
  let s = t.filter((e) => [
7752
7758
  "conductor",
@@ -7806,12 +7812,21 @@ var as = class {
7806
7812
  }, u = n * await l("weight", 1);
7807
7813
  switch (X(o)) {
7808
7814
  case "oren_nayar_diffuse_bsdf":
7815
+ r.push({
7816
+ kind: "diffuse",
7817
+ w: u,
7818
+ color: await c("color"),
7819
+ normal: await c("normal"),
7820
+ roughness: this.mtlxDiffuseRoughness(await c("roughness"))
7821
+ });
7822
+ return;
7809
7823
  case "burley_diffuse_bsdf":
7810
7824
  r.push({
7811
7825
  kind: "diffuse",
7812
7826
  w: u,
7813
7827
  color: await c("color"),
7814
- normal: await c("normal")
7828
+ normal: await c("normal"),
7829
+ roughness: 0
7815
7830
  });
7816
7831
  return;
7817
7832
  case "conductor_bsdf": {
@@ -8462,7 +8477,7 @@ var fs = /* @__PURE__ */ e({
8462
8477
  curveSides: i.curveSides,
8463
8478
  curveTolerance: i.curveTolerance,
8464
8479
  instanceIncludes: i.instanceIncludes
8465
- }, m = o?.archiveId ? this.loader._keyed(`pbrt:2.13:${a}`, `${o.archiveId}|${n ?? ""}|${[...o.elements ?? []].sort().join(",")}|${JSON.stringify(p)}`) : null, h = m ? await this._loadStoredGraph(m, o, {
8480
+ }, m = o?.archiveId ? this.loader._keyed(`pbrt:2.14:${a}`, `${o.archiveId}|${n ?? ""}|${[...o.elements ?? []].sort().join(",")}|${JSON.stringify(p)}`) : null, h = m ? await this._loadStoredGraph(m, o, {
8466
8481
  imageFromBytes: u,
8467
8482
  envFromBytes: d
8468
8483
  }) : null, g = h ?? await ga({