@zephyr3d/scene 0.9.26 → 0.9.27

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 (95) hide show
  1. package/dist/animation/animationset.js +92 -30
  2. package/dist/animation/animationset.js.map +1 -1
  3. package/dist/animation/joint_dynamics/convex_collider.js +320 -0
  4. package/dist/animation/joint_dynamics/convex_collider.js.map +1 -0
  5. package/dist/animation/skeleton.js +21 -1
  6. package/dist/animation/skeleton.js.map +1 -1
  7. package/dist/asset/model.js +6 -2
  8. package/dist/asset/model.js.map +1 -1
  9. package/dist/camera/camera.js +75 -23
  10. package/dist/camera/camera.js.map +1 -1
  11. package/dist/index.d.ts +4764 -3600
  12. package/dist/index.js +2 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/material/hairstrand.js +235 -235
  15. package/dist/material/hairstrand.js.map +1 -1
  16. package/dist/material/material.js +296 -296
  17. package/dist/material/material.js.map +1 -1
  18. package/dist/material/mixins/lit.js +33 -1
  19. package/dist/material/mixins/lit.js.map +1 -1
  20. package/dist/material/shader/helper.js +404 -3
  21. package/dist/material/shader/helper.js.map +1 -1
  22. package/dist/material/water.js +2057 -72
  23. package/dist/material/water.js.map +1 -1
  24. package/dist/posteffect/motionblur.js +663 -58
  25. package/dist/posteffect/motionblur.js.map +1 -1
  26. package/dist/posteffect/posteffect.js +12 -1
  27. package/dist/posteffect/posteffect.js.map +1 -1
  28. package/dist/posteffect/sao.js +46 -44
  29. package/dist/posteffect/sao.js.map +1 -1
  30. package/dist/posteffect/sss.js +30 -2
  31. package/dist/posteffect/sss.js.map +1 -1
  32. package/dist/render/abuffer_oit.js +37 -37
  33. package/dist/render/abuffer_oit.js.map +1 -1
  34. package/dist/render/clipmap.js +156 -5
  35. package/dist/render/clipmap.js.map +1 -1
  36. package/dist/render/cull_visitor.js +1 -0
  37. package/dist/render/cull_visitor.js.map +1 -1
  38. package/dist/render/dualdepthpeeling_oit.js +49 -49
  39. package/dist/render/dualdepthpeeling_oit.js.map +1 -1
  40. package/dist/render/fbm_wavegenerator.js +3 -3
  41. package/dist/render/fbm_wavegenerator.js.map +1 -1
  42. package/dist/render/fft_wavegenerator.js +57 -15
  43. package/dist/render/fft_wavegenerator.js.map +1 -1
  44. package/dist/render/gerstner_wavegenerator.js +127 -20
  45. package/dist/render/gerstner_wavegenerator.js.map +1 -1
  46. package/dist/render/hzb.js +80 -22
  47. package/dist/render/hzb.js.map +1 -1
  48. package/dist/render/lightpass.js +6 -3
  49. package/dist/render/lightpass.js.map +1 -1
  50. package/dist/render/oit.js +11 -11
  51. package/dist/render/oit.js.map +1 -1
  52. package/dist/render/render_queue.js +36 -0
  53. package/dist/render/render_queue.js.map +1 -1
  54. package/dist/render/renderer.js +4 -0
  55. package/dist/render/renderer.js.map +1 -1
  56. package/dist/render/rendergraph/blackboard.js +1 -0
  57. package/dist/render/rendergraph/blackboard.js.map +1 -1
  58. package/dist/render/rendergraph/forward_plus_builder.js +318 -9
  59. package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
  60. package/dist/render/rendergraph/frame_resource_requirements.js +1 -0
  61. package/dist/render/rendergraph/frame_resource_requirements.js.map +1 -1
  62. package/dist/render/rendergraph/history_resources.js +8 -1
  63. package/dist/render/rendergraph/history_resources.js.map +1 -1
  64. package/dist/render/underwater.js +624 -0
  65. package/dist/render/underwater.js.map +1 -0
  66. package/dist/render/water_caustics.js +1380 -0
  67. package/dist/render/water_caustics.js.map +1 -0
  68. package/dist/render/weightedblended_oit.js +33 -33
  69. package/dist/render/weightedblended_oit.js.map +1 -1
  70. package/dist/scene/water.js +540 -4
  71. package/dist/scene/water.js.map +1 -1
  72. package/dist/shaders/water.js +22 -19
  73. package/dist/shaders/water.js.map +1 -1
  74. package/dist/shaders/water_medium.js +56 -0
  75. package/dist/shaders/water_medium.js.map +1 -0
  76. package/dist/shadow/shadow_region.js +49 -49
  77. package/dist/shadow/shadow_region.js.map +1 -1
  78. package/dist/utility/serialization/manager.js +3 -1
  79. package/dist/utility/serialization/manager.js.map +1 -1
  80. package/dist/utility/serialization/scene/animation.js +31 -2
  81. package/dist/utility/serialization/scene/animation.js.map +1 -1
  82. package/dist/utility/serialization/scene/camera.js +53 -25
  83. package/dist/utility/serialization/scene/camera.js.map +1 -1
  84. package/dist/utility/serialization/scene/light.js.map +1 -1
  85. package/dist/utility/serialization/scene/water.js +1101 -21
  86. package/dist/utility/serialization/scene/water.js.map +1 -1
  87. package/dist/utility/shprojector.js +87 -87
  88. package/dist/utility/shprojector.js.map +1 -1
  89. package/package.json +1 -1
  90. package/dist/render/rendergraph/frame_graph_context.js +0 -41
  91. package/dist/render/rendergraph/frame_graph_context.js.map +0 -1
  92. package/dist/shaders/ssgi.js +0 -63
  93. package/dist/shaders/ssgi.js.map +0 -1
  94. package/dist/shaders/ssgi_reprojection.js +0 -118
  95. package/dist/shaders/ssgi_reprojection.js.map +0 -1
@@ -124,6 +124,7 @@ const SSS_QUALITY_PRESET_SETTINGS = {
124
124
  /** @internal Render path selection for scene renderer. */ _renderPath;
125
125
  /** @internal Whether command buffers may be reused for optimization. */ _commandBufferReuse;
126
126
  /** @internal Hi-Z acceleration enable (primarily for SSR). */ _HiZ;
127
+ _HiZNearest;
127
128
  /** @internal Screen-space shadow mask enable (Forward+ deferred shadows). */ _screenSpaceShadowMask;
128
129
  /** @internal If true, a float point backbuffer will be used. The default value is true */ _HDR;
129
130
  /** @internal Tonemap enable flag (via post effect). */ _toneMap;
@@ -137,6 +138,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
137
138
  /** @internal Motion blur enable flag (via post effect). */ _motionBlur;
138
139
  /** @internal Motion blur post effect reference. */ _postEffectMotionBlur;
139
140
  /** @internal Motion blur strength. */ _motionBlurStrength;
141
+ /** @internal Motion blur shutter bias. */ _motionBlurShutterBias;
142
+ /** @internal Motion blur maximum streak length in pixels. */ _motionBlurMaxLength;
140
143
  /** @internal Bloom enable flag (via post effect). */ _bloom;
141
144
  /** @internal Bloom post effect reference. */ _postEffectBloom;
142
145
  /** @internal Bloom downsample level cap. */ _bloomMaxDownsampleLevels;
@@ -212,10 +215,9 @@ const SSS_QUALITY_PRESET_SETTINGS = {
212
215
  _skinSSSScatterTint;
213
216
  /** @internal SSAO enable flag (via post effect). */ _SSAO;
214
217
  /** @internal SSAO post effect reference. */ _postEffectSSAO;
215
- /** @internal SSAO scale (sampling radius multiplier). */ _SSAOScale;
218
+ /** @internal SSAO scale (sampling radius multiplier). */ _SSAOOcclusionRadius;
216
219
  /** @internal SSAO bias (self-shadowing reduction). */ _SSAOBias;
217
- /** @internal SSAO sample radius. */ _SSAORadius;
218
- /** @internal SSAO intensity. */ _SSAOIntensity;
220
+ /** @internal SSAO sample radius. */ /** @internal SSAO intensity. */ _SSAOIntensity;
219
221
  /** @internal SSAO blur depth cutoff. */ _SSAOBlurDepthCutoff;
220
222
  /** @internal Pending GPU-pick promise (one-shot). */ _pickResultPromise;
221
223
  /** @internal Resolver for the pending pick promise. */ _pickResultResolve;
@@ -270,6 +272,7 @@ const SSS_QUALITY_PRESET_SETTINGS = {
270
272
  this._screenAdapter = new ScreenAdapter();
271
273
  this._adapted = false;
272
274
  this._HiZ = false;
275
+ this._HiZNearest = false;
273
276
  this._screenSpaceShadowMask = true;
274
277
  this._HDR = true;
275
278
  this._toneMap = true;
@@ -283,6 +286,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
283
286
  this._motionBlur = false;
284
287
  this._postEffectMotionBlur = new DRef();
285
288
  this._motionBlurStrength = 1;
289
+ this._motionBlurShutterBias = 0.5;
290
+ this._motionBlurMaxLength = 40;
286
291
  this._bloom = false;
287
292
  this._postEffectBloom = new DRef();
288
293
  this._bloomMaxDownsampleLevels = 4;
@@ -369,10 +374,9 @@ const SSS_QUALITY_PRESET_SETTINGS = {
369
374
  this._skinSSSScatterTint = new Vector4(1, 1, 1, 1);
370
375
  this._SSAO = false;
371
376
  this._postEffectSSAO = new DRef();
372
- this._SSAOScale = 10;
373
- this._SSAOBias = 1;
374
- this._SSAOIntensity = 0.025;
375
- this._SSAORadius = 100;
377
+ this._SSAOOcclusionRadius = 0.25;
378
+ this._SSAOBias = 0.05;
379
+ this._SSAOIntensity = 1;
376
380
  this._SSAOBlurDepthCutoff = 2;
377
381
  this._pickResult = null;
378
382
  this._commandBufferReuse = true;
@@ -443,6 +447,24 @@ const SSS_QUALITY_PRESET_SETTINGS = {
443
447
  this._HiZ = !!val;
444
448
  }
445
449
  /**
450
+ * Whether the Hi-Z pyramid carries its nearest-depth channel.
451
+ *
452
+ * The pyramid's own channel answers "what is the farthest thing in this screen
453
+ * region", which is what occlusion and ray marching want; this one answers
454
+ * "what is the nearest", which is what a proximity query wants. It doubles the
455
+ * pyramid's bandwidth, so it is off unless something asks for it.
456
+ *
457
+ * Materials that query it - water's shoreline foam - turn it on by themselves,
458
+ * the way a transmissive material turns on the scene colour copy, so this only
459
+ * has to be set to force the channel on for something the renderer cannot see
460
+ * coming. Ignored on WebGL1, which has no pyramid at all.
461
+ */ get HiZNearest() {
462
+ return this._HiZNearest;
463
+ }
464
+ set HiZNearest(val) {
465
+ this._HiZNearest = !!val;
466
+ }
467
+ /**
446
468
  * Whether the screen-space shadow mask is enabled.
447
469
  *
448
470
  * When enabled, shadow-casting lights are lit through the clustered pass and
@@ -499,6 +521,38 @@ const SSS_QUALITY_PRESET_SETTINGS = {
499
521
  }
500
522
  }
501
523
  /**
524
+ * How much of the motion blur streak lies ahead of where an object is now,
525
+ * as a fraction of its length. 0 trails the streak fully behind the object,
526
+ * 0.5 (the default) centres it. See {@link MotionBlur.shutterBias}.
527
+ */ get motionBlurShutterBias() {
528
+ return this._motionBlurShutterBias;
529
+ }
530
+ set motionBlurShutterBias(val) {
531
+ this._motionBlurShutterBias = val;
532
+ if (this._postEffectMotionBlur.get()) {
533
+ this._postEffectMotionBlur.get().shutterBias = val;
534
+ // The effect clamps; read it back so the camera and the effect cannot
535
+ // disagree about what was actually applied.
536
+ this._motionBlurShutterBias = this._postEffectMotionBlur.get().shutterBias;
537
+ }
538
+ }
539
+ /**
540
+ * Longest motion blur streak, in pixels at render resolution. This is the
541
+ * ceiling {@link Camera.motionBlurStrength} runs into; raising it costs
542
+ * samples in proportion. See {@link MotionBlur.maxBlurLength}.
543
+ */ get motionBlurMaxLength() {
544
+ return this._motionBlurMaxLength;
545
+ }
546
+ set motionBlurMaxLength(val) {
547
+ this._motionBlurMaxLength = val;
548
+ if (this._postEffectMotionBlur.get()) {
549
+ this._postEffectMotionBlur.get().maxBlurLength = val;
550
+ // The effect clamps; read it back so the camera and the effect cannot
551
+ // disagree about what was actually applied.
552
+ this._motionBlurMaxLength = this._postEffectMotionBlur.get().maxBlurLength;
553
+ }
554
+ }
555
+ /**
502
556
  * Gets whether Bloom is enabled.
503
557
  */ get bloom() {
504
558
  return this._postEffectBloom.get().enabled;
@@ -1242,13 +1296,19 @@ const SSS_QUALITY_PRESET_SETTINGS = {
1242
1296
  set SSAO(val) {
1243
1297
  this._postEffectSSAO.get().enabled = !!val;
1244
1298
  }
1245
- /** SSAO scale */ get SSAOScale() {
1246
- return this._SSAOScale;
1299
+ /**
1300
+ * SSAO occlusion radius, in world units (metres).
1301
+ *
1302
+ * @remarks
1303
+ * Replaces the old `SSAOScale`, which was a far-plane-relative multiplier and
1304
+ * carried no physical meaning.
1305
+ */ get SSAOOcclusionRadius() {
1306
+ return this._SSAOOcclusionRadius;
1247
1307
  }
1248
- set SSAOScale(val) {
1249
- this._SSAOScale = val;
1308
+ set SSAOOcclusionRadius(val) {
1309
+ this._SSAOOcclusionRadius = val;
1250
1310
  if (this._postEffectSSAO.get()) {
1251
- this._postEffectSSAO.get().scale = val;
1311
+ this._postEffectSSAO.get().occlusionRadius = val;
1252
1312
  }
1253
1313
  }
1254
1314
  /** SSAO bias */ get SSAOBias() {
@@ -1260,15 +1320,6 @@ const SSS_QUALITY_PRESET_SETTINGS = {
1260
1320
  this._postEffectSSAO.get().bias = val;
1261
1321
  }
1262
1322
  }
1263
- /** SSAO radius */ get SSAORadius() {
1264
- return this._SSAORadius;
1265
- }
1266
- set SSAORadius(val) {
1267
- this._SSAORadius = val;
1268
- if (this._postEffectSSAO.get()) {
1269
- this._postEffectSSAO.get().radius = val;
1270
- }
1271
- }
1272
1323
  /** SSAO intensity */ get SSAOIntensity() {
1273
1324
  return this._SSAOIntensity;
1274
1325
  }
@@ -1708,9 +1759,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
1708
1759
  if (!this._postEffectSSAO.get()) {
1709
1760
  const ssao = new SAO();
1710
1761
  ssao.enabled = false;
1711
- ssao.scale = this._SSAOScale;
1762
+ ssao.occlusionRadius = this._SSAOOcclusionRadius;
1712
1763
  ssao.bias = this._SSAOBias;
1713
- ssao.radius = this._SSAORadius;
1714
1764
  ssao.intensity = this._SSAOIntensity;
1715
1765
  ssao.blurDepthCutoff = this._SSAOBlurDepthCutoff;
1716
1766
  this._postEffectSSAO.set(ssao);
@@ -1742,6 +1792,8 @@ const SSS_QUALITY_PRESET_SETTINGS = {
1742
1792
  const motionBlur = new MotionBlur();
1743
1793
  motionBlur.enabled = false;
1744
1794
  motionBlur.strength = this._motionBlurStrength;
1795
+ motionBlur.shutterBias = this._motionBlurShutterBias;
1796
+ motionBlur.maxBlurLength = this._motionBlurMaxLength;
1745
1797
  this._postEffectMotionBlur.set(motionBlur);
1746
1798
  this._compositor.appendPostEffect(motionBlur);
1747
1799
  }