reze-engine 0.69.9 → 0.70.1

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 (40) hide show
  1. package/dist/camera-mount.d.ts +57 -0
  2. package/dist/camera-mount.d.ts.map +1 -0
  3. package/dist/camera-mount.js +249 -0
  4. package/dist/camera.d.ts +11 -0
  5. package/dist/camera.d.ts.map +1 -1
  6. package/dist/camera.js +31 -7
  7. package/dist/engine.d.ts +94 -2
  8. package/dist/engine.d.ts.map +1 -1
  9. package/dist/engine.js +409 -18
  10. package/dist/index.d.ts +3 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/model.d.ts +35 -0
  13. package/dist/model.d.ts.map +1 -1
  14. package/dist/model.js +170 -0
  15. package/dist/shaders/cast-api.d.ts +2 -2
  16. package/dist/shaders/cast-api.d.ts.map +1 -1
  17. package/dist/shaders/cast-api.js +2 -2
  18. package/dist/shaders/cast-layout.d.ts +3 -1
  19. package/dist/shaders/cast-layout.d.ts.map +1 -1
  20. package/dist/shaders/cast-layout.js +3 -1
  21. package/dist/shaders/passes/composite.d.ts +1 -1
  22. package/dist/shaders/passes/composite.d.ts.map +1 -1
  23. package/dist/shaders/passes/composite.js +9 -2
  24. package/dist/shaders/passes/cull.d.ts +1 -1
  25. package/dist/shaders/passes/cull.d.ts.map +1 -1
  26. package/dist/shaders/passes/cull.js +4 -1
  27. package/dist/shaders/passes/motion-blur.d.ts +35 -0
  28. package/dist/shaders/passes/motion-blur.d.ts.map +1 -0
  29. package/dist/shaders/passes/motion-blur.js +166 -0
  30. package/package.json +1 -1
  31. package/src/camera-mount.ts +281 -0
  32. package/src/camera.ts +27 -4
  33. package/src/engine.ts +429 -20
  34. package/src/index.ts +3 -1
  35. package/src/model.ts +193 -0
  36. package/src/shaders/cast-api.ts +9 -2
  37. package/src/shaders/cast-layout.ts +3 -1
  38. package/src/shaders/passes/composite.ts +9 -3
  39. package/src/shaders/passes/cull.ts +4 -1
  40. package/src/shaders/passes/motion-blur.ts +171 -0
package/dist/engine.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Camera } from "./camera";
2
+ import { CameraMount, headMaterials } from "./camera-mount";
2
3
  import { EFFECT_SUBJECT_VEC4S } from "./shaders/cast-layout";
3
4
  import { decodeDds, isDds } from "./dds-loader";
4
5
  import { Mat4, Quat, Vec3 } from "./math";
@@ -49,6 +50,7 @@ import { boneOverlay, boneMarkerPositions, buildOverlayShapes, jointOverlay, lin
49
50
  import { BLOOM_BLUR_H_SHADER_WGSL, BLOOM_BLUR_V_SHADER_WGSL, BLOOM_PREFILTER_SHADER_WGSL, BLOOM_UPSAMPLE_SHADER_WGSL, } from "./shaders/passes/bloom";
50
51
  import { buildCompositeShader, EFFECT_SCENE_API, buildFieldShader, EFFECT_ANCHORS, EFFECT_SUBJECTS, EFFECT_TRAIL_BASE, EFFECT_TRAIL_SAMPLES, } from "./shaders/passes/composite";
51
52
  import { SUBSURFACE_WGSL, SSS_SPIKE } from "./shaders/passes/subsurface";
53
+ import { EFFECT_SUBJECTS_ALL } from "./shaders/cast-layout";
52
54
  import { buildParticleComputeShader, buildParticleRenderShader, PARTICLE_LIGHT_BINDING, PARTICLE_POINTS_BINDING, PARTICLE_TEXTURE_BINDING, PARTICLE_TEXTURE_SAMPLER_BINDING, particleEntryPoints, PARTICLE_INDIRECT_BINDING, PARTICLE_INDIRECT_BYTES, PARTICLE_INDIRECT_DRAW_OFFSET, PARTICLE_STRIDE, } from "./shaders/passes/particles";
53
55
  import { MAX_EFFECT_POINTS, POINTS_FLOATS } from "./shaders/points-api";
54
56
  import { bonesWithPrefix, pointsData, writeBonePoint } from "./effect-points";
@@ -70,6 +72,7 @@ import { STOCKINGS_GRAPH } from "./graph/presets/stockings";
70
72
  import { METAL_GRAPH } from "./graph/presets/metal";
71
73
  import { CLOTH_SMOOTH_GRAPH } from "./graph/presets/cloth_smooth";
72
74
  import { CLOTH_ROUGH_GRAPH } from "./graph/presets/cloth_rough";
75
+ import { MOTION_BLUR_UNIFORM_FLOATS, MOTION_BLUR_WGSL, MOTION_VELOCITY_FORMAT, motionVelocityWgsl, } from "./shaders/passes/motion-blur";
73
76
  /** Grow sphere `s` (x, y, z, radius; radius 0 = empty) to hold another: the
74
77
  * standard union, keeping the larger if one contains the other, else growing
75
78
  * along the line between the centres. */
@@ -1406,6 +1409,8 @@ export class Engine {
1406
1409
  this.cameraFollowYaw = 0;
1407
1410
  this.cameraFollowPitch = 0;
1408
1411
  this.cameraTargetOffset = new Vec3(0, 0, 0);
1412
+ /** The camera on a bone (setCameraMount), and whose rig it rides. */
1413
+ this.cameraMount = null;
1409
1414
  this.lastFrameTime = performance.now();
1410
1415
  this.frameIntervals = new Float32Array(Engine.STATS_WINDOW);
1411
1416
  this.frameIntervalWrite = 0;
@@ -1820,6 +1825,29 @@ export class Engine {
1820
1825
  this.gizmoDrag = null;
1821
1826
  this.camera?.setInputLocked(false);
1822
1827
  };
1828
+ /** See setTimeScale. */
1829
+ this.timeScale = 1;
1830
+ // ─── Motion blur (shaders/passes/motion-blur.ts) ───────────────────────
1831
+ this.motionBlur = null;
1832
+ this.mbVelocityPipeline = null;
1833
+ this.mbVelocityPending = false;
1834
+ this.mbGatherPipeline = null;
1835
+ this.mbFrameLayout = null;
1836
+ this.mbInstanceLayout = null;
1837
+ this.mbFrameBindGroup = null;
1838
+ this.mbPrevCameraBuffer = null;
1839
+ this.mbUniformBuffer = null;
1840
+ this.mbUniformData = new Float32Array(MOTION_BLUR_UNIFORM_FLOATS);
1841
+ this.mbVelocityMs = null;
1842
+ this.mbVelocity = null;
1843
+ this.mbScratch = null;
1844
+ this.mbGatherBindGroup = null;
1845
+ this.mbGatherDepthView = null;
1846
+ this.mbSampler = null;
1847
+ /** Last frame's camera view-projection, or null after a cut or on the first frame. */
1848
+ this.mbPrevViewProj = null;
1849
+ /** Per model: last frame's skin matrices on the GPU, and the CPU copy they came from. */
1850
+ this.mbInstances = new WeakMap();
1823
1851
  /** Models this wrote a dissolve onto last frame, so one nothing asks for any
1824
1852
  * more comes back whole instead of holding wherever it was left. */
1825
1853
  this.dissolveTouched = new Set();
@@ -3381,7 +3409,7 @@ export class Engine {
3381
3409
  continue;
3382
3410
  }
3383
3411
  e.distVariant = this.castDistanceVariants.length;
3384
- const data = new Float32Array([0xf, 0, 0, 0]);
3412
+ const data = new Float32Array([EFFECT_SUBJECTS_ALL, 0, 0, 0]);
3385
3413
  const uniform = device.createBuffer({
3386
3414
  label: `cast distance seeds (${key})`,
3387
3415
  size: data.byteLength,
@@ -3396,9 +3424,9 @@ export class Engine {
3396
3424
  });
3397
3425
  this.castDistanceVariants.push({
3398
3426
  subjects: e.subjects,
3399
- // 0xf is what the buffer above was written with; the first frame's
3427
+ // EFFECT_SUBJECTS_ALL is what the buffer above was written with; the first frame's
3400
3428
  // updateSubjectMasks narrows it to the live cast.
3401
- mask: 0xf,
3429
+ mask: EFFECT_SUBJECTS_ALL,
3402
3430
  uniform,
3403
3431
  data,
3404
3432
  seedBind: device.createBindGroup({
@@ -4429,7 +4457,7 @@ export class Engine {
4429
4457
  // effect did before it could be aimed. A host narrows it afterwards, the
4430
4458
  // way it sets influence and a schedule.
4431
4459
  subjects: null,
4432
- subjectMask: 0xf,
4460
+ subjectMask: EFFECT_SUBJECTS_ALL,
4433
4461
  subjectCount: 0,
4434
4462
  distVariant: 0,
4435
4463
  anchors,
@@ -8291,7 +8319,8 @@ export class Engine {
8291
8319
  label: "HDR resolve target",
8292
8320
  size: [width, height],
8293
8321
  format: this.hdrFormat,
8294
- usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
8322
+ // COPY_DST: motion blur writes its gather back here.
8323
+ usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST,
8295
8324
  });
8296
8325
  // The id attachment. Multisampled like the rest of the pass, and with NO
8297
8326
  // resolve texture beside it: resolving averages, and the average of two
@@ -9351,6 +9380,67 @@ export class Engine {
9351
9380
  o.x = ox * c + o.z * sn;
9352
9381
  o.z = -ox * sn + o.z * c;
9353
9382
  }
9383
+ /**
9384
+ * The camera on a bone: through her eyes ("pov", on 頭) or held in her hand
9385
+ * and aimed back at her face ("selfie", on a wrist). See camera-mount.ts.
9386
+ *
9387
+ * Placed every frame after her pose and physics, before the camera is
9388
+ * written, so it never trails her and an export renders what the editor
9389
+ * showed. Outranks the orbit and the follow — which stay as they were
9390
+ * underneath, and come back when the mount goes — but not a camera VMD or
9391
+ * setCameraPose. In POV her head (hair, face, eyes: the materials skinned
9392
+ * mostly to 頭 and below) leaves the camera, and only the camera: her shadow
9393
+ * and her mirror image keep it.
9394
+ *
9395
+ * Null takes the camera off. False when the model is not loaded.
9396
+ */
9397
+ setCameraMount(model, options) {
9398
+ const prev = this.cameraMount;
9399
+ if (!model || !options) {
9400
+ if (prev)
9401
+ this.dropCameraMount();
9402
+ return true;
9403
+ }
9404
+ let modelName = typeof model === "string" ? model : "";
9405
+ if (typeof model !== "string")
9406
+ for (const i of this.modelInstances.values())
9407
+ if (i.model === model)
9408
+ modelName = i.name;
9409
+ const inst = this.modelInstances.get(modelName);
9410
+ if (!inst)
9411
+ return false;
9412
+ if (prev && prev.name === modelName)
9413
+ prev.mount.setOptions(options);
9414
+ else {
9415
+ if (prev)
9416
+ this.dropCameraMount();
9417
+ this.cameraMount = { name: modelName, mount: new CameraMount(inst.model, options) };
9418
+ }
9419
+ const pov = this.cameraMount.mount.options.mode === "pov";
9420
+ inst.cameraHiddenMaterials = new Set(pov ? headMaterials(inst.model) : []);
9421
+ this.writeCullHidden(true);
9422
+ return true;
9423
+ }
9424
+ getCameraMount() {
9425
+ const m = this.cameraMount;
9426
+ return m ? { ...m.mount.options, model: m.name } : null;
9427
+ }
9428
+ /** The materials a POV mount keeps out of the camera, for a host to show. */
9429
+ getCameraHiddenMaterials(modelName) {
9430
+ return [...(this.modelInstances.get(modelName)?.cameraHiddenMaterials ?? [])];
9431
+ }
9432
+ dropCameraMount() {
9433
+ const prev = this.cameraMount;
9434
+ if (!prev)
9435
+ return;
9436
+ this.cameraMount = null;
9437
+ this.camera.mountPose = null;
9438
+ const inst = this.modelInstances.get(prev.name);
9439
+ if (inst && inst.cameraHiddenMaterials.size > 0) {
9440
+ inst.cameraHiddenMaterials = new Set();
9441
+ this.writeCullHidden(true);
9442
+ }
9443
+ }
9354
9444
  /** True while the orbit target is riding a model bone (setCameraFollow). */
9355
9445
  isCameraFollowing() {
9356
9446
  return this.cameraTargetModel !== null;
@@ -12674,6 +12764,12 @@ export class Engine {
12674
12764
  const eye = this.camera.getEyePosition();
12675
12765
  const m = inst.model;
12676
12766
  _gazeScratch.setXYZ(eye.x - m.position.x, eye.y - m.position.y, eye.z - m.position.z);
12767
+ // Her own first-person camera sits between her eyes: looking AT it
12768
+ // crosses them. She looks where it looks, far ahead along the view.
12769
+ if (this.cameraMount?.name === inst.name && this.cameraMount.mount.options.mode === "pov") {
12770
+ const v = this.camera.getViewMatrix().values;
12771
+ _gazeScratch.setXYZ(_gazeScratch.x + v[2] * 100, _gazeScratch.y + v[6] * 100, _gazeScratch.z + v[10] * 100);
12772
+ }
12677
12773
  Quat.rotateVecInvInto(m.rotation, _gazeScratch, _gazeScratch);
12678
12774
  const inv = 1 / Math.max(m.scale, 1e-6);
12679
12775
  _gazeScratch.setXYZ(_gazeScratch.x * inv, _gazeScratch.y * inv, _gazeScratch.z * inv);
@@ -12951,9 +13047,11 @@ export class Engine {
12951
13047
  let changed = force;
12952
13048
  for (let i = 0; i < this.cullDraws.length; i++) {
12953
13049
  const { inst, draw } = this.cullDraws[i];
12954
- // bit 0: switched off; bit 1: drawn by its native look, not its graph
13050
+ // bit 0: switched off; bit 1: drawn by its native look, not its graph;
13051
+ // bit 2: out of the camera alone (a POV mount's head)
12955
13052
  const v = (inst.hiddenMaterials.has(draw.materialName) || inst.morphHiddenMaterials.has(draw.materialName) ? 1 : 0) |
12956
- (this.nativeLooks?.dresses(inst.name, draw.materialName) ? 2 : 0);
13053
+ (this.nativeLooks?.dresses(inst.name, draw.materialName) ? 2 : 0) |
13054
+ (inst.cameraHiddenMaterials.has(draw.materialName) ? 4 : 0);
12957
13055
  if (out[i] !== v) {
12958
13056
  out[i] = v;
12959
13057
  changed = true;
@@ -13999,6 +14097,7 @@ export class Engine {
13999
14097
  materialIdByName: new Map(),
14000
14098
  xrayKey: "",
14001
14099
  probeHiddenMaterials: new Set(),
14100
+ cameraHiddenMaterials: new Set(),
14002
14101
  materialMorphTargets: null,
14003
14102
  materialMorphByIndex: null,
14004
14103
  physics,
@@ -15784,6 +15883,22 @@ export class Engine {
15784
15883
  }
15785
15884
  this.onRaycast(hitModel, hitMaterial, hitBone, screenX, screenY);
15786
15885
  }
15886
+ /**
15887
+ * Global playback speed: every clock the frame advances — clips and their
15888
+ * morphs, the camera VMD, physics, tweens, jelly eyes, auto blink, effect
15889
+ * time (rzTime), particles, trails, dissolves, param tracks, scheduled
15890
+ * effects and the camera follow's lag — runs on `delta × scale`, live
15891
+ * (render) and offline (renderFrame) alike. So 0.5 is true slow motion: hair
15892
+ * falls slowly, a sparkle drifts at half pace, and an export stepped at
15893
+ * 1/fps covers half as much of the clip per frame. 0.25–2; frame stats stay
15894
+ * on wall time. The host keeps the music in step (it plays the audio).
15895
+ */
15896
+ setTimeScale(scale) {
15897
+ this.timeScale = Number.isFinite(scale) ? Math.min(4, Math.max(0.1, scale)) : 1;
15898
+ }
15899
+ getTimeScale() {
15900
+ return this.timeScale;
15901
+ }
15787
15902
  render() {
15788
15903
  if (!this.multisampleTexture || !this.camera || !this.device)
15789
15904
  return;
@@ -15794,7 +15909,8 @@ export class Engine {
15794
15909
  }
15795
15910
  /**
15796
15911
  * Render one frame advancing every clock — animation, physics, tweens, and the
15797
- * camera VMD — by exactly `deltaSeconds`, independent of wall time. This is the
15912
+ * camera VMD — by exactly `deltaSeconds` (times the time scale, see
15913
+ * setTimeScale), independent of wall time. This is the
15798
15914
  * offline-rendering primitive (video export): call it N times with 1/fps and the
15799
15915
  * result is deterministic whether the machine renders faster or slower than
15800
15916
  * realtime. Also resets the realtime clock so a later render() (returning to the
@@ -15806,7 +15922,9 @@ export class Engine {
15806
15922
  this.lastFrameTime = performance.now();
15807
15923
  this.renderWithDelta(deltaSeconds);
15808
15924
  }
15809
- renderWithDelta(deltaTime) {
15925
+ renderWithDelta(wallDelta) {
15926
+ // Every clock in the frame runs on the scaled delta — see setTimeScale.
15927
+ const deltaTime = wallDelta * this.timeScale;
15810
15928
  // The bind groups first, then the textures they used to name. A retired
15811
15929
  // texture is freed only once a frame has been rebuilt without it — freeing
15812
15930
  // it while a group still points at it is what "destroyed texture used in a
@@ -15886,6 +16004,16 @@ export class Engine {
15886
16004
  this.camera.target.y = f.y + this.cameraTargetOffset.y;
15887
16005
  this.camera.target.z = f.z + this.cameraTargetOffset.z;
15888
16006
  }
16007
+ // The camera on a bone, from this frame's pose (setCameraMount). A rig
16008
+ // that has gone (removed, replaced) takes the mount with it.
16009
+ const cm = this.cameraMount;
16010
+ if (cm) {
16011
+ const inst = this.modelInstances.get(cm.name);
16012
+ if (!inst || inst.model !== cm.mount.model)
16013
+ this.dropCameraMount();
16014
+ else
16015
+ this.camera.mountPose = cm.mount.step(deltaTime);
16016
+ }
15889
16017
  }
15890
16018
  // Who holds the shot this frame. An external pose is a statement about
15891
16019
  // where the camera IS, so it is reapplied rather than sampled — and it
@@ -15941,7 +16069,9 @@ export class Engine {
15941
16069
  // The scattering pass is the third reader: it rejects taps across a depth
15942
16070
  // step and scales its width by distance, so a scene wearing a subsurface
15943
16071
  // look stores depth for as long as it does.
15944
- const depthRead = dofOn || this.aovCapture || this.effects.some((e) => e.hasForeground) || this.subsurfaceInUse();
16072
+ // Motion blur is a fourth: its velocity pass tests against this depth and
16073
+ // its gather rebuilds the camera's motion from it.
16074
+ const depthRead = dofOn || this.aovCapture || this.effects.some((e) => e.hasForeground) || this.subsurfaceInUse() || this.motionBlur !== null;
15945
16075
  this.renderPassDescriptor.depthStencilAttachment.depthStoreOp = depthRead ? "store" : "discard";
15946
16076
  if (depthRead)
15947
16077
  this.writeDepthOfFieldUniforms();
@@ -16170,6 +16300,9 @@ export class Engine {
16170
16300
  // Skin scattering, on the resolved scene and before anything reads it:
16171
16301
  // bloom should bleed the scattered skin, not the raw one.
16172
16302
  this.renderSubsurface(encoder);
16303
+ // Motion blur, on the finished scene and before bloom, so a streak blooms
16304
+ // as a camera's would.
16305
+ this.renderMotionBlur(encoder, deltaTime);
16173
16306
  // The field mounts, likewise: after the scene so foregrounds can read its
16174
16307
  // depth, before the composite that samples both layers.
16175
16308
  this.renderFieldPass(encoder);
@@ -16218,9 +16351,10 @@ export class Engine {
16218
16351
  const dpr = window.devicePixelRatio || 1;
16219
16352
  this.resolvePickResult(pick.x / dpr, pick.y / dpr);
16220
16353
  }
16221
- // Feed the true vsync-to-vsync interval (deltaTime, computed at frame start), not the
16222
- // CPU time spent in render() — that's what actually reflects perceived smoothness.
16223
- this.updateStats(deltaTime * 1000);
16354
+ // Feed the true vsync-to-vsync interval (the wall delta, before the time
16355
+ // scale), not the CPU time spent in render() — that's what actually reflects
16356
+ // perceived smoothness.
16357
+ this.updateStats(wallDelta * 1000);
16224
16358
  }
16225
16359
  drawInstanceShadow(sp, inst, cascade) {
16226
16360
  sp.setBindGroup(0, inst.shadowBindGroups[cascade]);
@@ -16614,6 +16748,259 @@ export class Engine {
16614
16748
  inst.model.setEyeTracking(options);
16615
16749
  return true;
16616
16750
  }
16751
+ /**
16752
+ * Auto blink, per model — see Model.setAutoBlink. She blinks on her own
16753
+ * every few seconds, over a morph motion's own blinks. Null hands the morph
16754
+ * back. False for a model that is not loaded or has no closing morph.
16755
+ */
16756
+ setAutoBlink(modelName, options) {
16757
+ const inst = this.modelInstances.get(modelName);
16758
+ if (!inst)
16759
+ return false;
16760
+ return inst.model.setAutoBlink(options);
16761
+ }
16762
+ getAutoBlink(modelName) {
16763
+ return this.modelInstances.get(modelName)?.model.getAutoBlink() ?? null;
16764
+ }
16765
+ /**
16766
+ * Motion blur on everything that moves: her limbs, hair and cloth from the
16767
+ * pose, everything else from the camera. Per pixel, live and in an export
16768
+ * (the shutter follows the frame's own delta, so a 30 fps export and a
16769
+ * 120 Hz screen streak alike). `shutter` is the fraction of a 1/30 s frame
16770
+ * the shutter is open: 0.5 is film's 180°. Null switches it off, and then it
16771
+ * costs nothing. See shaders/passes/motion-blur.ts.
16772
+ */
16773
+ setMotionBlur(options) {
16774
+ if (!options) {
16775
+ this.motionBlur = null;
16776
+ this.mbPrevViewProj = null;
16777
+ return;
16778
+ }
16779
+ this.motionBlur = { shutter: Math.min(1, Math.max(0.05, options.shutter ?? 0.5)) };
16780
+ }
16781
+ getMotionBlur() {
16782
+ return this.motionBlur ? { ...this.motionBlur } : null;
16783
+ }
16784
+ mbEnsurePipelines() {
16785
+ if (this.mbVelocityPipeline && this.mbGatherPipeline)
16786
+ return true;
16787
+ if (this.mbVelocityPending)
16788
+ return false;
16789
+ this.mbVelocityPending = true;
16790
+ const device = this.device;
16791
+ this.mbFrameLayout = device.createBindGroupLayout({
16792
+ label: "motion velocity per-frame",
16793
+ entries: [
16794
+ { binding: 0, visibility: GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT, buffer: { type: "uniform" } },
16795
+ { binding: 1, visibility: GPUShaderStage.VERTEX, buffer: { type: "uniform" } },
16796
+ { binding: 2, visibility: GPUShaderStage.FRAGMENT, sampler: {} },
16797
+ ],
16798
+ });
16799
+ this.mbInstanceLayout = device.createBindGroupLayout({
16800
+ label: "motion velocity per-instance",
16801
+ entries: [
16802
+ { binding: 0, visibility: GPUShaderStage.VERTEX, buffer: { type: "read-only-storage" } },
16803
+ { binding: 1, visibility: GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT, buffer: { type: "uniform" } },
16804
+ { binding: 2, visibility: GPUShaderStage.VERTEX, buffer: { type: "read-only-storage" } },
16805
+ ],
16806
+ });
16807
+ this.mbPrevCameraBuffer = device.createBuffer({
16808
+ label: "motion blur previous camera",
16809
+ size: 64,
16810
+ usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
16811
+ });
16812
+ this.mbUniformBuffer = device.createBuffer({
16813
+ label: "motion blur uniforms",
16814
+ size: MOTION_BLUR_UNIFORM_FLOATS * 4,
16815
+ usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
16816
+ });
16817
+ this.mbSampler = device.createSampler({ magFilter: "linear", minFilter: "linear", addressModeU: "clamp-to-edge", addressModeV: "clamp-to-edge" });
16818
+ this.mbFrameBindGroup = device.createBindGroup({
16819
+ label: "motion velocity per-frame",
16820
+ layout: this.mbFrameLayout,
16821
+ entries: [
16822
+ { binding: 0, resource: { buffer: this.cameraUniformBuffer } },
16823
+ { binding: 1, resource: { buffer: this.mbPrevCameraBuffer } },
16824
+ { binding: 2, resource: this.materialSampler },
16825
+ ],
16826
+ });
16827
+ const velocityModule = device.createShaderModule({ label: "motion velocity", code: motionVelocityWgsl() });
16828
+ const gatherModule = device.createShaderModule({ label: "motion blur gather", code: MOTION_BLUR_WGSL });
16829
+ const velocity = device.createRenderPipelineAsync({
16830
+ label: "motion velocity",
16831
+ layout: device.createPipelineLayout({
16832
+ label: "motion velocity",
16833
+ bindGroupLayouts: [this.mbFrameLayout, this.mbInstanceLayout, this.mainPerMaterialBindGroupLayout],
16834
+ }),
16835
+ vertex: { module: velocityModule, entryPoint: "vs", buffers: this.materialVertexBufferLayouts.slice(0, 3) },
16836
+ fragment: { module: velocityModule, entryPoint: "fs", targets: [{ format: MOTION_VELOCITY_FORMAT }] },
16837
+ primitive: { cullMode: "none" },
16838
+ multisample: { count: Engine.MULTISAMPLE_COUNT },
16839
+ depthStencil: { format: this.depthFormat, depthWriteEnabled: false, depthCompare: this.depthAhead },
16840
+ });
16841
+ const gather = device.createRenderPipelineAsync({
16842
+ label: "motion blur gather",
16843
+ layout: "auto",
16844
+ vertex: { module: gatherModule, entryPoint: "vs" },
16845
+ fragment: { module: gatherModule, entryPoint: "fs", targets: [{ format: this.hdrFormat }] },
16846
+ primitive: { topology: "triangle-list" },
16847
+ });
16848
+ Promise.all([velocity, gather])
16849
+ .then(([v, g]) => {
16850
+ this.mbVelocityPipeline = v;
16851
+ this.mbGatherPipeline = g;
16852
+ })
16853
+ .catch((e) => console.warn("[motion blur] pipelines failed:", e));
16854
+ return false;
16855
+ }
16856
+ /** The motion pass and the gather, on the resolved HDR before bloom. */
16857
+ renderMotionBlur(encoder, deltaTime) {
16858
+ const mb = this.motionBlur;
16859
+ if (!mb || !this.device || !this.hdrResolveTexture || !this.depthReadView)
16860
+ return;
16861
+ const viewProj = this.camera.getProjectionMatrix().multiply(this.camera.getViewMatrix()).values;
16862
+ // The shutter: this frame's motion is deltaTime's worth; the streak is the
16863
+ // shutter's worth of it. No delta (a paused export's first frame, a seek)
16864
+ // or a hitch long enough to be a cut: no blur, and nothing carried over.
16865
+ const scale = deltaTime > 1e-4 && deltaTime < 0.25 ? (mb.shutter / 30) / deltaTime : 0;
16866
+ const prevVP = this.mbPrevViewProj ?? viewProj;
16867
+ if (!this.mbEnsurePipelines() || scale === 0) {
16868
+ this.mbStorePrev(viewProj);
16869
+ return;
16870
+ }
16871
+ const device = this.device;
16872
+ const w = this.hdrResolveTexture.width;
16873
+ const h = this.hdrResolveTexture.height;
16874
+ if (!this.mbVelocity || this.mbVelocity.width !== w || this.mbVelocity.height !== h) {
16875
+ this.mbVelocityMs?.destroy();
16876
+ this.mbVelocity?.destroy();
16877
+ this.mbScratch?.destroy();
16878
+ this.mbVelocityMs = device.createTexture({
16879
+ label: "motion velocity (msaa)",
16880
+ size: [w, h],
16881
+ sampleCount: Engine.MULTISAMPLE_COUNT,
16882
+ format: MOTION_VELOCITY_FORMAT,
16883
+ usage: GPUTextureUsage.RENDER_ATTACHMENT,
16884
+ });
16885
+ this.mbVelocity = device.createTexture({
16886
+ label: "motion velocity",
16887
+ size: [w, h],
16888
+ format: MOTION_VELOCITY_FORMAT,
16889
+ usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
16890
+ });
16891
+ this.mbScratch = device.createTexture({
16892
+ label: "motion blur scratch",
16893
+ size: [w, h],
16894
+ format: this.hdrFormat,
16895
+ usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC,
16896
+ });
16897
+ this.mbGatherBindGroup = null;
16898
+ }
16899
+ // The HDR resolve and depth are rebuilt on resize; the group follows them.
16900
+ if (!this.mbGatherBindGroup || this.mbGatherDepthView !== this.depthReadView) {
16901
+ this.mbGatherDepthView = this.depthReadView;
16902
+ this.mbGatherBindGroup = device.createBindGroup({
16903
+ label: "motion blur gather",
16904
+ layout: this.mbGatherPipeline.getBindGroupLayout(0),
16905
+ entries: [
16906
+ { binding: 0, resource: this.hdrResolveTexture.createView() },
16907
+ { binding: 1, resource: this.mbVelocity.createView() },
16908
+ { binding: 2, resource: this.depthReadView },
16909
+ { binding: 3, resource: { buffer: this.mbUniformBuffer } },
16910
+ { binding: 4, resource: this.mbSampler },
16911
+ ],
16912
+ });
16913
+ }
16914
+ // Last frame's camera and poses, then this frame's kept for the next.
16915
+ device.queue.writeBuffer(this.mbPrevCameraBuffer, 0, prevVP);
16916
+ const u = this.mbUniformData;
16917
+ const inv = new Float32Array(16);
16918
+ if (!Mat4.inverseInto(viewProj, inv))
16919
+ inv.set(viewProj);
16920
+ u.set(inv, 0);
16921
+ u.set(prevVP, 16);
16922
+ u[32] = scale;
16923
+ u[33] = Math.max(8, 0.06 * w);
16924
+ u[34] = w;
16925
+ u[35] = h;
16926
+ u[36] = this.depthClear;
16927
+ device.queue.writeBuffer(this.mbUniformBuffer, 0, u);
16928
+ const depthAtt = this.renderPassDescriptor.depthStencilAttachment;
16929
+ const pass = encoder.beginRenderPass({
16930
+ label: "motion velocity",
16931
+ colorAttachments: [
16932
+ {
16933
+ view: this.mbVelocityMs.createView(),
16934
+ resolveTarget: this.mbVelocity.createView(),
16935
+ clearValue: { r: 0, g: 0, b: 0, a: 0 },
16936
+ loadOp: "clear",
16937
+ storeOp: "discard",
16938
+ },
16939
+ ],
16940
+ depthStencilAttachment: { view: depthAtt.view, depthReadOnly: true, stencilReadOnly: true },
16941
+ });
16942
+ pass.setPipeline(this.mbVelocityPipeline);
16943
+ pass.setBindGroup(0, this.mbFrameBindGroup);
16944
+ this.forEachInstance((inst) => {
16945
+ if (!inst.model.drawn)
16946
+ return;
16947
+ const s = this.mbInstance(inst);
16948
+ const cur = inst.model.getSkinMatrices();
16949
+ device.queue.writeBuffer(s.prev, 0, (s.last ?? cur));
16950
+ if (!s.last || s.last.length !== cur.length)
16951
+ s.last = new Float32Array(cur.length);
16952
+ s.last.set(cur);
16953
+ this.setModelDrawState(pass, inst);
16954
+ pass.setBindGroup(1, s.bindGroup);
16955
+ for (const draw of inst.drawCalls) {
16956
+ if (draw.type !== "opaque" && draw.type !== "transparent")
16957
+ continue;
16958
+ pass.setBindGroup(2, draw.bindGroup);
16959
+ this.issueDraw(pass, draw, "camera");
16960
+ }
16961
+ });
16962
+ pass.end();
16963
+ const gather = encoder.beginRenderPass({
16964
+ label: "motion blur gather",
16965
+ colorAttachments: [{ view: this.mbScratch.createView(), loadOp: "clear", clearValue: [0, 0, 0, 0], storeOp: "store" }],
16966
+ });
16967
+ gather.setPipeline(this.mbGatherPipeline);
16968
+ gather.setBindGroup(0, this.mbGatherBindGroup);
16969
+ gather.draw(3);
16970
+ gather.end();
16971
+ encoder.copyTextureToTexture({ texture: this.mbScratch }, { texture: this.hdrResolveTexture }, [w, h]);
16972
+ this.mbStorePrev(viewProj);
16973
+ }
16974
+ mbStorePrev(viewProj) {
16975
+ if (!this.mbPrevViewProj)
16976
+ this.mbPrevViewProj = new Float32Array(16);
16977
+ this.mbPrevViewProj.set(viewProj);
16978
+ }
16979
+ /** A model's last-frame skin buffer and its velocity bind group, rebuilt if
16980
+ * the model's own buffers were replaced. */
16981
+ mbInstance(inst) {
16982
+ let s = this.mbInstances.get(inst);
16983
+ if (s && s.skin === inst.skinMatrixBuffer && s.light === inst.lightBuffer)
16984
+ return s;
16985
+ s?.prev.destroy();
16986
+ const prev = this.device.createBuffer({
16987
+ label: `${inst.name}: previous skin`,
16988
+ size: inst.skinMatrixBuffer.size,
16989
+ usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
16990
+ });
16991
+ const bindGroup = this.device.createBindGroup({
16992
+ label: `${inst.name}: motion velocity`,
16993
+ layout: this.mbInstanceLayout,
16994
+ entries: [
16995
+ { binding: 0, resource: { buffer: inst.skinMatrixBuffer } },
16996
+ { binding: 1, resource: { buffer: inst.lightBuffer } },
16997
+ { binding: 2, resource: { buffer: prev } },
16998
+ ],
16999
+ });
17000
+ s = { prev, bindGroup, last: null, skin: inst.skinMatrixBuffer, light: inst.lightBuffer };
17001
+ this.mbInstances.set(inst, s);
17002
+ return s;
17003
+ }
16617
17004
  /**
16618
17005
  * A repeating dissolve on one model, on the scene clock.
16619
17006
  *
@@ -17842,9 +18229,13 @@ export class Engine {
17842
18229
  pz += pos.z;
17843
18230
  break;
17844
18231
  }
17845
- u[44 + n * 4] = px;
17846
- u[45 + n * 4] = py;
17847
- u[46 + n * 4] = pz;
18232
+ // The view uniform keeps only the first four: its slot 15 is the tone
18233
+ // curve. Every reader goes through the cast buffer, which holds all.
18234
+ if (n < 4) {
18235
+ u[44 + n * 4] = px;
18236
+ u[45 + n * 4] = py;
18237
+ u[46 + n * 4] = pz;
18238
+ }
17848
18239
  this.writeCastEntry(inst, n, px, py, pz);
17849
18240
  n++;
17850
18241
  });
@@ -17893,7 +18284,7 @@ export class Engine {
17893
18284
  const live = this.castSubjectCount;
17894
18285
  const all = live === 0 ? 0 : (1 << live) - 1;
17895
18286
  for (const e of this.effects) {
17896
- let mask = 0xf;
18287
+ let mask = EFFECT_SUBJECTS_ALL;
17897
18288
  if (e.subjects) {
17898
18289
  mask = 0;
17899
18290
  for (const name of e.subjects) {
@@ -17912,7 +18303,7 @@ export class Engine {
17912
18303
  // The floods, one per distinct target set. Their masks are written here for
17913
18304
  // the same reason the effects' are: the slots have just been decided.
17914
18305
  for (const v of this.castDistanceVariants) {
17915
- let mask = 0xf;
18306
+ let mask = EFFECT_SUBJECTS_ALL;
17916
18307
  if (v.subjects) {
17917
18308
  mask = 0;
17918
18309
  for (const name of v.subjects) {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Engine, DEFAULT_BLOOM_OPTIONS, DEFAULT_DEPTH_OF_FIELD_OPTIONS, DEFAULT_VIEW_TRANSFORM, DEFAULT_COLOR_GRADING, type ColorGradingOptions, type StageGradeLut, type SceneFog, type StageCastShadow, type SceneFogLayer, type EngineStats, type EngineOptions, type BloomOptions, type DepthOfFieldOptions, type ViewTransformOptions, type ViewTransformName, type LoadModelFromFilesOptions, type MaterialPreset, type MaterialPresetMap, type ModelTransform, type SceneLight, type CastKey, RENDERING_LAYER_DEFAULT, RENDERING_LAYER_CHARACTER, type ModelAttachment, type SceneAovs, type LightProbe, type ReflectionProbeRegion, type PixelFilterType, type GizmoDragEvent, type GizmoDragCallback, type GizmoDragKind, type DissolveCycle, type EffectParamValue, type EffectPointValue, type EffectBoneValue, type EffectParamKey, type EffectResult, type ViewLut, type CullDiagnostics, type MidiNote, } from "./engine";
1
+ export { Engine, DEFAULT_BLOOM_OPTIONS, DEFAULT_DEPTH_OF_FIELD_OPTIONS, DEFAULT_VIEW_TRANSFORM, DEFAULT_COLOR_GRADING, type ColorGradingOptions, type StageGradeLut, type SceneFog, type StageCastShadow, type SceneFogLayer, type EngineStats, type EngineOptions, type BloomOptions, type DepthOfFieldOptions, type ViewTransformOptions, type ViewTransformName, type LoadModelFromFilesOptions, type MaterialPreset, type MaterialPresetMap, type ModelTransform, type SceneLight, type CastKey, RENDERING_LAYER_DEFAULT, RENDERING_LAYER_CHARACTER, type ModelAttachment, type SceneAovs, type LightProbe, type ReflectionProbeRegion, type PixelFilterType, type GizmoDragEvent, type GizmoDragCallback, type GizmoDragKind, type DissolveCycle, type EffectParamValue, type EffectPointValue, type EffectBoneValue, type EffectParamKey, type EffectResult, type ViewLut, type CullDiagnostics, type MidiNote, type MotionBlurOptions, } from "./engine";
2
2
  export { parsePmxFolderInput, pmxFileAtRelativePath, type PmxFolderInputResult } from "./folder-upload";
3
3
  export { parseMidi } from "./midi-loader";
4
4
  export { parseHDR, type HdrImage } from "./hdr";
@@ -50,7 +50,8 @@ export { boneOverlay, boneMarkerPositions, rigidbodyOverlay, jointOverlay, build
50
50
  * Pure strings, no GPU: importing them costs a host nothing.
51
51
  */
52
52
  export { EFFECT_MATH_API, PARTICLE_STRUCT_WGSL } from "./shaders/passes/hosted-api";
53
- export type { EyeTrackingOptions } from "./model";
53
+ export type { EyeTrackingOptions, AutoBlinkOptions } from "./model";
54
+ export type { CameraMountOptions, CameraMountMode } from "./camera-mount";
54
55
  export type { JellyEyeOptions } from "./jelly-eyes";
55
56
  /**
56
57
  * The game's own materials (src/unity): a stage package drawn by its translated
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,qBAAqB,EACrB,8BAA8B,EAC9B,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,K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