tosijs-3d 0.11.2 → 0.11.4

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 (74) hide show
  1. package/CHANGELOG.md +6 -8
  2. package/changelog/v0.11.3.md +21 -0
  3. package/changelog/v0.11.4.md +18 -0
  4. package/dist/b3d-biped.d.ts +9 -0
  5. package/dist/b3d-biped.d.ts.map +1 -1
  6. package/dist/b3d-biped.js +73 -4
  7. package/dist/b3d-biped.js.map +1 -1
  8. package/dist/b3d-panel.d.ts.map +1 -1
  9. package/dist/b3d-panel.js +6 -4
  10. package/dist/b3d-panel.js.map +1 -1
  11. package/dist/b3d-shadows.d.ts +11 -17
  12. package/dist/b3d-shadows.d.ts.map +1 -1
  13. package/dist/b3d-shadows.js +15 -21
  14. package/dist/b3d-shadows.js.map +1 -1
  15. package/dist/character-builder.d.ts +33 -0
  16. package/dist/character-builder.d.ts.map +1 -0
  17. package/dist/character-builder.js +318 -0
  18. package/dist/character-builder.js.map +1 -0
  19. package/dist/glass-gamepad.d.ts.map +1 -1
  20. package/dist/glass-gamepad.js +7 -4
  21. package/dist/glass-gamepad.js.map +1 -1
  22. package/dist/hair-fit.d.ts +21 -0
  23. package/dist/hair-fit.d.ts.map +1 -0
  24. package/dist/hair-fit.js +169 -0
  25. package/dist/hair-fit.js.map +1 -0
  26. package/dist/hardware-gamepad.d.ts +2 -0
  27. package/dist/hardware-gamepad.d.ts.map +1 -1
  28. package/dist/hardware-gamepad.js +2 -1
  29. package/dist/hardware-gamepad.js.map +1 -1
  30. package/dist/human-face.d.ts +60 -0
  31. package/dist/human-face.d.ts.map +1 -0
  32. package/dist/human-face.js +348 -0
  33. package/dist/human-face.js.map +1 -0
  34. package/dist/human-hair.d.ts +63 -0
  35. package/dist/human-hair.d.ts.map +1 -0
  36. package/dist/human-hair.js +246 -0
  37. package/dist/human-hair.js.map +1 -0
  38. package/dist/human-morph.d.ts +41 -0
  39. package/dist/human-morph.d.ts.map +1 -0
  40. package/dist/human-morph.js +222 -0
  41. package/dist/human-morph.js.map +1 -0
  42. package/dist/human-pack.d.ts +79 -0
  43. package/dist/human-pack.d.ts.map +1 -0
  44. package/dist/human-pack.js +120 -0
  45. package/dist/human-pack.js.map +1 -0
  46. package/dist/human-rig.d.ts +37 -0
  47. package/dist/human-rig.d.ts.map +1 -0
  48. package/dist/human-rig.js +171 -0
  49. package/dist/human-rig.js.map +1 -0
  50. package/dist/index.d.ts +16 -0
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +8 -0
  53. package/dist/index.js.map +1 -1
  54. package/dist/playground.d.ts.map +1 -1
  55. package/dist/playground.js +5 -3
  56. package/dist/playground.js.map +1 -1
  57. package/dist/retarget.d.ts.map +1 -1
  58. package/dist/retarget.js +9 -1
  59. package/dist/retarget.js.map +1 -1
  60. package/dist/scene-schemas.js +2 -2
  61. package/dist/scene-schemas.js.map +1 -1
  62. package/dist/skin-tone.d.ts +32 -0
  63. package/dist/skin-tone.d.ts.map +1 -0
  64. package/dist/skin-tone.js +190 -0
  65. package/dist/skin-tone.js.map +1 -0
  66. package/dist/virtual-gamepad.d.ts.map +1 -1
  67. package/dist/virtual-gamepad.js +3 -1
  68. package/dist/virtual-gamepad.js.map +1 -1
  69. package/dist/xr-gamepad.d.ts.map +1 -1
  70. package/dist/xr-gamepad.js +12 -4
  71. package/dist/xr-gamepad.js.map +1 -1
  72. package/package.json +1 -1
  73. package/static/attributes.json +9 -4
  74. package/static/attributes.txt +3 -2
package/CHANGELOG.md CHANGED
@@ -12,19 +12,17 @@ Upgrading across a minor? Start with [Migration](/Migration/).
12
12
 
13
13
  ## Unreleased
14
14
 
15
- Nothing yet.
15
+ ## 0.11.4
16
16
 
17
- ## 0.11.2
18
-
19
- The latest release. A new glass gamepad, laid out like a pair of VR
20
- controllers held flat, with stick clicks (L3, R3) that a hardware pad and a
21
- headset's thumbsticks now report too; view and menu on the headset's system bar
22
- when a scene asks for them; and the full-screen button on an iPhone.
23
- [Read 0.11.2](/v0.11.2/).
17
+ The latest release. A character creator on MakeHuman's CC0 body: shape a
18
+ person with sliders, give them skin, eyes and hair, and watch them walk with
19
+ UAL's clips. [Read 0.11.4](/v0.11.4/).
24
20
 
25
21
  ## Every version
26
22
 
27
23
  <!-- toc -->
24
+ - [0.11.4](/v0.11.4/)
25
+ - [0.11.3](/v0.11.3/)
28
26
  - [0.11.2](/v0.11.2/)
29
27
  - [0.11.1](/v0.11.1/)
30
28
  - [0.11.0](/v0.11.0/)
@@ -0,0 +1,21 @@
1
+ # 0.11.3
2
+
3
+ <!--{ "parent": "CHANGELOG", "order": 9988997 }-->
4
+
5
+ ## Added
6
+
7
+ - **`blendSeconds` on `<tosi-b3d-biped>`** (default 0.25): how long each animation change eases over. `0` cuts.
8
+ - The panel page's system-bar demo has a "New journal entry" button that blinks the Journal button (`attention()`).
9
+
10
+ ## Changed
11
+
12
+ - **The biped eases every animation change** instead of cutting: walk to run, standing to crouch, the gun coming up and going down, aim up/level/down. The blend is timed, so it lasts the same at any frame rate. A crouch at rest plays a transition clip if the states name one (`sneakEnter` / `sneakExit`, e.g. UAL's `Crouch_Enter` / `Crouch_Exit`); the defaults have none, so it blends.
13
+ - **The sun's shadow bias defaults are now `shadowBias` 0.002 and `shadowNormalBias` 0.04**, which clears the fine acne stripes on plain lit surfaces. If a small caster's shadow detaches, set them lower on your `<tosi-b3d-sun>`.
14
+ - **In the biped mapping, clicking the right stick (R3) toggles the weapon**, as the right bumper does. The playground's glass pad shows both stick clicks.
15
+
16
+ ## Fixed
17
+
18
+ - **XR thumbsticks have the hardware pad's 0.15 per-axis deadzone**, so a stick pushed sideways to turn no longer drifts the biped's look pitch (its aim). Raising the weapon now levels the aim in a headset too.
19
+ - In the glass gamepad demo, the cube moves away from you on left stick up, and the readout sits top centre, clear of the system bar.
20
+
21
+ Size: barrel (min, packages external) 1245.8 KB raw / 426.2 KB gz, +0.08% on 0.11.2.
@@ -0,0 +1,18 @@
1
+ # 0.11.4
2
+
3
+ <!--{ "parent": "CHANGELOG", "order": 9988996 }-->
4
+
5
+ ## Added
6
+
7
+ - **A character creator, on MakeHuman's CC0 body** (CHARACTER-DESIGN.md). Try it on the [character builder](/character-builder/) page: a person walking while you reshape them. The data is a **human pack** on the CDN (`makehuman/hm08/`), loaded with `loadHumanPack`.
8
+ - **Body**: `macroWeights` / `morphHuman` turn gender, age, muscle, weight, height, proportions and an ancestry mix into a body, in about a millisecond.
9
+ - **Skeleton**: `humanRig` places UAL's 65 joints from the body's own joint cubes, and bone heat binds the skin once per base, so UAL's clips play on any body shape (`buildRig`, `retargetClip`). `humanBody` draws a body unrigged.
10
+ - **Skin**: one dial from very fair to very dark through the Monk Skin Tone Scale, plus redness (`skinMaterial`, `skinAlbedo`); lips tinted from it over the pack's `lips` region, no UVs needed (`lipTint`, `lipAlbedo`).
11
+ - **Eyes**: `humanFace` adds eyes and eyelashes that fit every body (they are the base mesh's own helper vertices); the iris is drawn in code with a colour dial (`eyeTexture`, `irisColor`); `eyeGaze` aims the eyes at a world point with small saccades.
12
+ - **Hair**: Quaternius' CC0 hairstyles, beards and eyebrows, modelled for another head, fitted to any body (`loadHairLibrary`, `headScalp`, `humanHair`); tinted by `hairColor` (black to platinum, plus red). The pure fit is `fitToScalp` / `conformOutside`.
13
+
14
+ ## Fixed
15
+
16
+ - **Retargeting no longer lines a character's collarbones up with the clip's.** A collarbone's rest direction is the body's shape, like the spine's; where two rigs differed (UAL's runs back to the shoulder, MakeHuman's lies flat), every clip shrugged the shoulders.
17
+
18
+ Size: barrel (min, packages external) 1266.7 KB raw / 433.9 KB gz, +1.67% on 0.11.3 (the character creator).
@@ -49,6 +49,7 @@ export declare class B3dBiped extends B3dControllable {
49
49
  static preferredTagName: string;
50
50
  url: string;
51
51
  player: boolean;
52
+ blendSeconds: number;
52
53
  static initAttributes: {
53
54
  url: string;
54
55
  skin: string;
@@ -57,6 +58,7 @@ export declare class B3dBiped extends B3dControllable {
57
58
  cameraType: string;
58
59
  animation: string;
59
60
  animationSpeed: number;
61
+ blendSeconds: number;
60
62
  initialState: string;
61
63
  turnSpeed: number;
62
64
  forwardSpeed: number;
@@ -513,6 +515,9 @@ export declare class B3dBiped extends B3dControllable {
513
515
  */
514
516
  private _clipSeconds;
515
517
  private _sneakWas;
518
+ /** The stance-change clip playing (`sneakEnter`/`sneakExit`), and its seconds left. */
519
+ private _stanceClip;
520
+ private _stanceLeft;
516
521
  /** Zoom 0..1, now integrated from the d-pad rather than read off a stick. */
517
522
  private _camZoom;
518
523
  private _waterEl;
@@ -661,6 +666,10 @@ export declare class B3dBiped extends B3dControllable {
661
666
  private _updateAimLayer;
662
667
  /** Seconds left of the one-shot fire pose. */
663
668
  private _shootFor;
669
+ private _eased;
670
+ private _blendStep;
671
+ private _ease;
672
+ private _paceBlends;
664
673
  setAnimationState(name: string, speed?: number): void;
665
674
  getCameraTarget(): BABYLON.Node | null;
666
675
  applyInput(input: ControlInput, dt: number): void;
@@ -1 +1 @@
1
- {"version":3,"file":"b3d-biped.d.ts","sourceRoot":"","sources":["../src/b3d-biped.ts"],"names":[],"mappings":"AAiTA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EACL,OAAO,EAKR,MAAM,gBAAgB,CAAA;AAyBvB,OAAO,EAQL,KAAK,GAAG,EAET,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAYxE,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAA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
184
184
  | `scale` | `1` | Uniform scale applied to the loaded model |
185
185
  | `animation` | `''` | Current animation state name |
186
186
  | `animationSpeed` | `1` | Playback speed multiplier (0–2) |
187
+ | `blendSeconds` | `0.25` | Seconds each animation change eases over (walk to run, crouching, the gun coming up). `0` cuts |
187
188
  | `player` | `false` | Whether this biped receives input |
188
189
  | `cameraType` | `'none'` | `'follow'`, `'xr'`, or `'none'` |
189
190
  | `turnSpeed` | `180` | Degrees per second |
@@ -374,6 +375,9 @@ export function ualAnimationStates(extra = []) {
374
375
  { name: 'sneakIdle', animation: 'Crouch_Idle_Loop', loop: true },
375
376
  { name: 'sneakLeft', animation: 'Crouch_Left_Loop', loop: true },
376
377
  { name: 'sneakRight', animation: 'Crouch_Right_Loop', loop: true },
378
+ // No `sneakEnter` / `sneakExit`: UAL's `Crouch_Enter` / `Crouch_Exit` are
379
+ // slower than the blend between the loops, which reads better. Add them to
380
+ // your states to have a crouch at rest play them.
377
381
  // One clip per phase, which is why the jump can be done properly here:
378
382
  // `jump` is the wind-up, and the loop and landing are addressable.
379
383
  { name: 'jump', animation: 'Jump_Start', loop: false },
@@ -481,6 +485,8 @@ export class B3dBiped extends B3dControllable {
481
485
  cameraType: 'none',
482
486
  animation: '',
483
487
  animationSpeed: 1,
488
+ // Seconds every animation change eases over (see `_ease`).
489
+ blendSeconds: 0.25,
484
490
  initialState: 'idle',
485
491
  turnSpeed: 180,
486
492
  forwardSpeed: 2,
@@ -818,10 +824,10 @@ export class B3dBiped extends B3dControllable {
818
824
  look pitch is whatever it was left at: walking around looking at the
819
825
  ground, or the last dive, so the gun came up pointing at your feet. Tonio:
820
826
  "It seems quite common for it to be aiming at your feet which is weird."
821
- Levelled only on the way UP (lowering it leaves the view alone) and only
822
- flat: in a headset the aim is the controller.
827
+ Levelled only on the way UP (lowering it leaves the view alone), and in a
828
+ headset too: there the right stick still sets the look pitch the aim reads.
823
829
  */
824
- if (on && !this.gunplay && !this.owner?.xrActive)
830
+ if (on && !this.gunplay)
825
831
  this._lookPitch = 0;
826
832
  this.gunplay = on;
827
833
  this._showWeapons(on);
@@ -1269,6 +1275,9 @@ export class B3dBiped extends B3dControllable {
1269
1275
  return (g.to - g.from) / fps / ratio;
1270
1276
  }
1271
1277
  _sneakWas = false;
1278
+ /** The stance-change clip playing (`sneakEnter`/`sneakExit`), and its seconds left. */
1279
+ _stanceClip = '';
1280
+ _stanceLeft = 0;
1272
1281
  /** Zoom 0..1, now integrated from the d-pad rather than read off a stick. */
1273
1282
  _camZoom = 0;
1274
1283
  _waterEl;
@@ -1392,7 +1401,9 @@ export class B3dBiped extends B3dControllable {
1392
1401
  * immediately and merely gets better; it is committed to the cache once the
1393
1402
  * window closes.
1394
1403
  */
1395
- _currentPose(settle = 0.25, window = 2, interval = 0.08) {
1404
+ _currentPose(
1405
+ // Past the blend, so a pose is never measured mid-blend.
1406
+ settle = Math.max(0.25, Number(this.blendSeconds) + 0.1), window = 2, interval = 0.08) {
1396
1407
  const key = this.animationState?.animation ?? this.animationState?.name;
1397
1408
  if (key == null)
1398
1409
  return null;
@@ -1693,12 +1704,45 @@ export class B3dBiped extends B3dControllable {
1693
1704
  const layerGroup = groups.find((g) => g.name.replace(/^Clone of /, '') === layerClip);
1694
1705
  if (layerGroup == null)
1695
1706
  return;
1707
+ this._ease(baseGroup);
1708
+ this._ease(layerGroup);
1696
1709
  baseGroup.stop();
1697
1710
  this._aimLayer = layerOnUpperBody(scene, skeleton, baseGroup, layerGroup);
1698
1711
  this._aimLayer?.play(layerClip !== 'Pistol_Shoot');
1699
1712
  }
1700
1713
  /** Seconds left of the one-shot fire pose. */
1701
1714
  _shootFor = 0;
1715
+ /*
1716
+ EVERY CLIP CHANGE IS EASED, not cut. Babylon's animation blending starts a
1717
+ clip from wherever each bone is now and eases it in, so standing to crouch,
1718
+ walk to run and the gun coming up all move rather than pop. It is set on the
1719
+ ANIMATIONS (an AnimationGroup passes it down), which the upper-body layer's
1720
+ tiers share, so the layer is eased too.
1721
+
1722
+ Babylon's `blendingSpeed` is a step PER FRAME, so a fixed value is slower the
1723
+ slower the frame rate (0.2 took 300 ms at 20 fps). `_paceBlends` resets it
1724
+ from each frame's dt so a blend takes `blendSeconds` at any frame rate.
1725
+ `_currentPose` waits past it, so a pose is not measured mid-blend.
1726
+ */
1727
+ _eased = new Set();
1728
+ _blendStep = 0;
1729
+ _ease(group) {
1730
+ if (group == null || this._eased.has(group))
1731
+ return;
1732
+ this._eased.add(group);
1733
+ group.enableBlending = true;
1734
+ group.blendingSpeed = this._blendStep || 0.2;
1735
+ }
1736
+ _paceBlends(dt) {
1737
+ const seconds = Number(this.blendSeconds);
1738
+ const step = seconds > 0 ? Math.min(1, dt / seconds) : 1;
1739
+ // Only when it moves noticeably: the setter walks every animation.
1740
+ if (Math.abs(step - this._blendStep) < this._blendStep * 0.1)
1741
+ return;
1742
+ this._blendStep = step;
1743
+ for (const group of this._eased)
1744
+ group.blendingSpeed = step;
1745
+ }
1702
1746
  setAnimationState(name, speed = 1) {
1703
1747
  name = this._gunplayState(name);
1704
1748
  if (name == null) {
@@ -1752,6 +1796,7 @@ export class B3dBiped extends B3dControllable {
1752
1796
  }
1753
1797
  }
1754
1798
  const animationGroup = this.entries.animationGroups[idx];
1799
+ this._ease(animationGroup);
1755
1800
  if (newState.backwards) {
1756
1801
  animationGroup.start(loop, speed, animationGroup.to, animationGroup.from, additive);
1757
1802
  }
@@ -1936,8 +1981,23 @@ export class B3dBiped extends B3dControllable {
1936
1981
  const sneakDown = (input.sneak ?? 0) > 0.5;
1937
1982
  if (!this._swimming && sneakDown && !this._sneakWas) {
1938
1983
  this._sneaking = !this._sneaking;
1984
+ /*
1985
+ A TRANSITION CLIP if the states name one (`sneakEnter` / `sneakExit`,
1986
+ none by default); a blend otherwise. Such clips are drawn standing
1987
+ still, so they play only while you are at rest (see the idle branch
1988
+ below); moving, the stance change is the ordinary blend between loops.
1989
+ */
1990
+ const clip = this._sneaking ? 'sneakEnter' : 'sneakExit';
1991
+ this._stanceClip = this.animationStates.some((st) => st.name === clip)
1992
+ ? clip
1993
+ : '';
1994
+ this._stanceLeft = this._stanceClip
1995
+ ? this._clipSeconds(this._stanceClip)
1996
+ : 0;
1939
1997
  }
1940
1998
  this._sneakWas = sneakDown;
1999
+ this._stanceLeft = Math.max(0, this._stanceLeft - dt);
2000
+ this._paceBlends(dt);
1941
2001
  const speed = input.forward;
1942
2002
  /*
1943
2003
  STRAFING IS OPTIONAL, AND OFF BY DEFAULT.
@@ -2911,6 +2971,9 @@ export class B3dBiped extends B3dControllable {
2911
2971
  else if (speed < -0.1) {
2912
2972
  this.setAnimationState('walkBackwards', Math.abs(speed) + 0.25);
2913
2973
  }
2974
+ else if (this._stanceLeft > 0 && Math.abs(rotation) <= 0.1) {
2975
+ this.setAnimationState(this._stanceClip);
2976
+ }
2914
2977
  else if (this._sneaking &&
2915
2978
  this.animationStates.some((st) => st.name === 'sneakIdle')) {
2916
2979
  // A crouch that HOLDS at rest — the stock rig had no such clip, so
@@ -2923,6 +2986,10 @@ export class B3dBiped extends B3dControllable {
2923
2986
  else {
2924
2987
  this.setAnimationState('idle');
2925
2988
  }
2989
+ // Anything else chosen (moving, a jump) ends the transition clip, so
2990
+ // stopping again later does not replay half of it.
2991
+ if (this.animationState?.name !== this._stanceClip)
2992
+ this._stanceLeft = 0;
2926
2993
  }
2927
2994
  }
2928
2995
  setupXRInput(xr) {
@@ -3217,6 +3284,7 @@ export class B3dBiped extends B3dControllable {
3217
3284
  const attrs = this;
3218
3285
  if (attrs.url !== '' && !this.entries) {
3219
3286
  this.loadAssetContainer(scene, attrs.url, (container) => {
3287
+ this._eased.clear();
3220
3288
  this.entries = container.instantiateModelsToScene(undefined, false, {
3221
3289
  doNotInstantiate: true,
3222
3290
  });
@@ -3321,6 +3389,7 @@ export class B3dBiped extends B3dControllable {
3321
3389
  ag.dispose();
3322
3390
  }
3323
3391
  this.entries = undefined;
3392
+ this._eased.clear();
3324
3393
  }
3325
3394
  this.gameController = undefined;
3326
3395
  this.inputProvider = null;