@mml-io/3d-web-client-core 0.0.0-experimental-a3e15a8-20240207 → 0.0.0-experimental-ad4b20a-20240208

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.
package/build/index.js CHANGED
@@ -262,7 +262,7 @@ import { Color as Color3, Group, Vector3 as Vector34 } from "three";
262
262
 
263
263
  // src/character/CharacterModel.ts
264
264
  import {
265
- Character as MMLCharacter,
265
+ MMLCharacter,
266
266
  ModelLoader,
267
267
  parseMMLDescription
268
268
  } from "@mml-io/3d-web-avatar";
@@ -273,7 +273,7 @@ import {
273
273
  } from "three";
274
274
 
275
275
  // src/character/CharacterMaterial.ts
276
- import { Color, MeshPhysicalMaterial, UniformsUtils } from "three";
276
+ import { Color, MeshStandardMaterial, UniformsUtils } from "three";
277
277
 
278
278
  // src/rendering/shaders/bayer-dither.ts
279
279
  var bayerDither = (
@@ -367,50 +367,23 @@ ${before}
367
367
 
368
368
  // src/tweakpane/blades/characterFolder.ts
369
369
  var characterValues = {
370
- transmission: 0.01,
371
370
  metalness: 0.2,
372
371
  roughness: 0.8,
373
- ior: 1,
374
- thickness: 0.1,
375
- specularColor: { r: 1, g: 1, b: 1 },
376
- specularIntensity: 0.1,
377
372
  emissive: { r: 1, g: 1, b: 1 },
378
373
  emissiveIntensity: 0.01,
379
- envMapIntensity: 0.12,
380
- sheenColor: { r: 1, g: 1, b: 1 },
381
- sheen: 0.5,
382
- clearcoat: 0,
383
- clearcoatRoughness: 0
374
+ envMapIntensity: 0.12
384
375
  };
385
376
  var characterOptions = {
386
- transmission: { min: 0.01, max: 3, step: 0.01 },
387
377
  metalness: { min: 0, max: 1, step: 0.01 },
388
378
  roughness: { min: 0, max: 1, step: 0.01 },
389
- ior: { min: 1, max: 5, step: 0.01 },
390
- thickness: { min: 0, max: 1, step: 0.01 },
391
- specularIntensity: { min: 0, max: 1, step: 0.01 },
392
379
  emissiveIntensity: { min: 0, max: 1, step: 0.01 },
393
- envMapIntensity: { min: 0, max: 1, step: 0.01 },
394
- sheen: { min: 0, max: 1, step: 0.01 },
395
- clearcoat: { min: 0, max: 1, step: 0.01 },
396
- clearcoatRoughness: { min: 0, max: 1, step: 0.01 }
380
+ envMapIntensity: { min: 0, max: 1, step: 0.01 }
397
381
  };
398
382
  var CharacterFolder = class {
399
383
  constructor(parentFolder, expand = false) {
400
384
  this.folder = parentFolder.addFolder({ title: "characterMaterial", expanded: expand });
401
- this.folder.addBinding(characterValues, "transmission", characterOptions.transmission);
402
385
  this.folder.addBinding(characterValues, "metalness", characterOptions.metalness);
403
386
  this.folder.addBinding(characterValues, "roughness", characterOptions.roughness);
404
- this.folder.addBinding(characterValues, "ior", characterOptions.ior);
405
- this.folder.addBinding(characterValues, "thickness", characterOptions.thickness);
406
- this.folder.addBinding(characterValues, "specularColor", {
407
- color: { type: "float" }
408
- });
409
- this.folder.addBinding(
410
- characterValues,
411
- "specularIntensity",
412
- characterOptions.specularIntensity
413
- );
414
387
  this.folder.addBinding(characterValues, "emissive", {
415
388
  color: { type: "float" }
416
389
  });
@@ -420,16 +393,6 @@ var CharacterFolder = class {
420
393
  characterOptions.emissiveIntensity
421
394
  );
422
395
  this.folder.addBinding(characterValues, "envMapIntensity", characterOptions.envMapIntensity);
423
- this.folder.addBinding(characterValues, "sheenColor", {
424
- color: { type: "float" }
425
- });
426
- this.folder.addBinding(characterValues, "sheen", characterOptions.sheen);
427
- this.folder.addBinding(characterValues, "clearcoat", characterOptions.clearcoat);
428
- this.folder.addBinding(
429
- characterValues,
430
- "clearcoatRoughness",
431
- characterOptions.clearcoatRoughness
432
- );
433
396
  }
434
397
  setupChangeEvent() {
435
398
  this.folder.on("change", (e) => {
@@ -437,15 +400,6 @@ var CharacterFolder = class {
437
400
  if (!target)
438
401
  return;
439
402
  switch (target) {
440
- case "specularColor": {
441
- const value = e.value;
442
- characterValues.specularColor = {
443
- r: value.r,
444
- g: value.g,
445
- b: value.b
446
- };
447
- break;
448
- }
449
403
  case "emissive": {
450
404
  const value = e.value;
451
405
  characterValues.emissive = {
@@ -455,15 +409,6 @@ var CharacterFolder = class {
455
409
  };
456
410
  break;
457
411
  }
458
- case "sheenColor": {
459
- const value = e.value;
460
- characterValues.sheenColor = {
461
- r: value.r,
462
- g: value.g,
463
- b: value.b
464
- };
465
- break;
466
- }
467
412
  default: {
468
413
  break;
469
414
  }
@@ -473,83 +418,59 @@ var CharacterFolder = class {
473
418
  };
474
419
 
475
420
  // src/character/CharacterMaterial.ts
476
- var CharacterMaterial = class extends MeshPhysicalMaterial {
477
- constructor(color) {
421
+ var CharacterMaterial = class extends MeshStandardMaterial {
422
+ constructor(isLocal, cameraManager, characterId, originalMaterial, colorOverride) {
478
423
  super();
479
- this.uniforms = {};
424
+ this.isLocal = isLocal;
425
+ this.cameraManager = cameraManager;
426
+ this.characterId = characterId;
427
+ this.originalMaterial = originalMaterial;
428
+ this.colorOverride = colorOverride;
429
+ this.uniforms = {
430
+ discardAll: { value: 1 },
431
+ diffuseColor: { value: new Color() },
432
+ map: { value: null }
433
+ };
480
434
  this.colorsCube216 = [];
481
- if (color) {
482
- this.color = color;
483
- }
484
- this.transmission = characterValues.transmission;
485
- this.metalness = characterValues.metalness;
486
- this.roughness = characterValues.roughness;
487
- this.ior = characterValues.ior;
488
- this.thickness = characterValues.thickness;
489
- this.specularColor = new Color().setRGB(
490
- characterValues.specularColor.r,
491
- characterValues.specularColor.g,
492
- characterValues.specularColor.b
493
- );
494
- this.specularIntensity = characterValues.specularIntensity;
495
- this.emissive = new Color().setRGB(
496
- characterValues.emissive.r,
497
- characterValues.emissive.g,
498
- characterValues.emissive.b
499
- );
500
- this.emissiveIntensity = characterValues.emissiveIntensity;
435
+ this.targetAlpha = 1;
436
+ this.currentAlpha = 1;
437
+ this.copy(this.originalMaterial);
438
+ this.generateColorCube();
439
+ this.color = this.colorOverride || this.colorsCube216[this.characterId];
501
440
  this.envMapIntensity = characterValues.envMapIntensity;
502
- this.sheenColor = new Color().setRGB(
503
- characterValues.sheenColor.r,
504
- characterValues.sheenColor.g,
505
- characterValues.sheenColor.b
506
- );
507
- this.sheen = characterValues.sheen;
508
- this.clearcoat = characterValues.clearcoat;
509
- this.clearcoatRoughness = characterValues.clearcoatRoughness;
441
+ this.transparent = true;
442
+ this.side = this.originalMaterial.side;
510
443
  this.onBeforeCompile = (shader) => {
511
444
  this.uniforms = UniformsUtils.clone(shader.uniforms);
512
445
  this.uniforms.nearClip = { value: 0.01 };
513
446
  this.uniforms.farClip = { value: 1e3 };
514
- this.uniforms.ditheringNear = { value: 0.25 };
447
+ this.uniforms.ditheringNear = { value: 0.3 };
515
448
  this.uniforms.ditheringRange = { value: 0.5 };
516
449
  this.uniforms.time = { value: 0 };
517
450
  this.uniforms.diffuseRandomColor = { value: new Color() };
451
+ this.uniforms.discardAll = { value: 0 };
518
452
  shader.uniforms = this.uniforms;
453
+ shader.vertexShader = "varying vec3 vWorldPosition;\n" + shader.vertexShader;
454
+ shader.vertexShader = shader.vertexShader.replace(
455
+ "#include <worldpos_vertex>",
456
+ "vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\nvWorldPosition = worldPosition.xyz;"
457
+ );
519
458
  shader.vertexShader = injectBeforeMain(shader.vertexShader, "varying vec2 vUv;");
520
459
  shader.vertexShader = injectInsideMain(shader.vertexShader, "vUv = uv;");
521
460
  shader.fragmentShader = injectBeforeMain(
522
461
  shader.fragmentShader,
523
462
  /* glsl */
524
463
  `
525
- //#define showPattern
526
464
  varying vec2 vUv;
465
+ varying vec3 vWorldPosition;
527
466
  uniform float nearClip;
528
467
  uniform float farClip;
529
468
  uniform float ditheringNear;
530
469
  uniform float ditheringRange;
531
470
  uniform float time;
532
471
  uniform vec3 diffuseRandomColor;
472
+ uniform int discardAll;
533
473
  ${bayerDither}
534
-
535
- #ifdef showPattern
536
- vec2 rand2(vec2 p) {
537
- return fract(vec2(sin(p.x * 591.32 + p.y * 154.077), cos(p.x * 391.32 + p.y * 49.077)));
538
- }
539
- float voronoi(in vec2 x) {
540
- vec2 p = floor(x);
541
- vec2 f = fract(x);
542
- float minDistance = 1.0;
543
- for(int j = -1; j <= 1; j ++)
544
- for(int i = -1; i <= 1; i ++) {
545
- vec2 b = vec2(i, j);
546
- vec2 rand = 0.5 + 0.5 * sin(time * 1.5 + 12.0 * rand2(p + b));
547
- vec2 r = vec2(b) - f + rand;
548
- minDistance = min(minDistance, length(r));
549
- }
550
- return minDistance;
551
- }
552
- #endif
553
474
  `
554
475
  );
555
476
  shader.fragmentShader = injectBefore(
@@ -557,42 +478,32 @@ var CharacterMaterial = class extends MeshPhysicalMaterial {
557
478
  "#include <output_fragment>",
558
479
  /* glsl */
559
480
  `
560
- float distance = length(vWorldPosition - cameraPosition);
561
- float normalizedDistance = (distance - nearClip) / (farClip - nearClip);
562
- ivec2 p = ivec2(mod(gl_FragCoord.xy, 8.0));
563
- float d = 0.0;
564
- if (p.x <= 3 && p.y <= 3) {
565
- d = bayerDither(bayertl, p);
566
- } else if (p.x > 3 && p.y <= 3) {
567
- d = bayerDither(bayertr, p - ivec2(4, 0));
568
- } else if (p.x <= 3 && p.y > 3) {
569
- d = bayerDither(bayerbl, p - ivec2(0, 4));
570
- } else if (p.x > 3 && p.y > 3) {
571
- d = bayerDither(bayerbr, p - ivec2(4, 4));
481
+ if (discardAll == 1) {
482
+ discard;
483
+ } else {
484
+ float distance = length(vWorldPosition - cameraPosition);
485
+ float normalizedDistance = (distance - nearClip) / (farClip - nearClip);
486
+ ivec2 p = ivec2(mod(gl_FragCoord.xy, 8.0));
487
+ float d = 0.0;
488
+ if (p.x <= 3 && p.y <= 3) {
489
+ d = bayerDither(bayertl, p);
490
+ } else if (p.x > 3 && p.y <= 3) {
491
+ d = bayerDither(bayertr, p - ivec2(4, 0));
492
+ } else if (p.x <= 3 && p.y > 3) {
493
+ d = bayerDither(bayerbl, p - ivec2(0, 4));
494
+ } else if (p.x > 3 && p.y > 3) {
495
+ d = bayerDither(bayerbr, p - ivec2(4, 4));
496
+ }
497
+ if (distance <= ditheringNear + d * ditheringRange) discard;
498
+ outgoingLight *= diffuseRandomColor;
572
499
  }
573
- if (distance <= ditheringNear + d * ditheringRange) discard;
574
-
575
- vec2 uv = vUv;
576
- float s = clamp(0.35 + 0.35 * sin(5.0 * -time + vUv.y * 600.0), 0.0, 1.0);
577
- float scanLines = pow(s, 1.33);
578
-
579
- outgoingLight *= diffuseRandomColor;
580
-
581
- #ifdef showPattern
582
- float val = pow(voronoi(uv * 8.0) * 1.2, 0.5);
583
- float thickness = 1.0 / 500.0;
584
- vec2 g = step(mod(uv, 0.015), vec2(thickness));
585
- float a = 1.0 - clamp(val * (g.x + g.y), 0.0, 1.0);
586
- vec3 grid = vec3(smoothstep(0.01, 0.0, a) * 1.15) * diffuseRandomColor;
587
- outgoingLight += grid;
588
- #endif
589
500
  `
590
501
  );
591
502
  };
592
- this.generateColorCube();
503
+ this.needsUpdate = true;
593
504
  }
594
505
  generateColorCube() {
595
- const saturation = 0.5;
506
+ const saturation = 1;
596
507
  const lightness = 0.9;
597
508
  const goldenRatioConjugate = 0.618033988749895;
598
509
  let hue = 0;
@@ -604,17 +515,24 @@ var CharacterMaterial = class extends MeshPhysicalMaterial {
604
515
  }
605
516
  }
606
517
  update() {
607
- this.transmission = characterValues.transmission;
518
+ if (this.isLocal) {
519
+ this.targetAlpha = this.cameraManager.targetDistance < 0.4 ? 0 : 1;
520
+ this.currentAlpha += ease(this.targetAlpha, this.currentAlpha, 0.07);
521
+ if (this.currentAlpha > 0.999) {
522
+ this.currentAlpha = 1;
523
+ this.cameraManager.minPolarAngle = Math.PI * 0.25;
524
+ }
525
+ if (this.currentAlpha < 1e-3) {
526
+ this.currentAlpha = 0;
527
+ this.cameraManager.minPolarAngle = Math.PI * 0.35;
528
+ }
529
+ this.uniforms.discardAll.value = this.currentAlpha === 0 ? 1 : 0;
530
+ if (this.currentAlpha !== this.opacity) {
531
+ this.opacity = this.currentAlpha;
532
+ }
533
+ }
608
534
  this.metalness = characterValues.metalness;
609
535
  this.roughness = characterValues.roughness;
610
- this.ior = characterValues.ior;
611
- this.thickness = characterValues.thickness;
612
- this.specularColor = new Color().setRGB(
613
- characterValues.specularColor.r,
614
- characterValues.specularColor.g,
615
- characterValues.specularColor.b
616
- );
617
- this.specularIntensity = characterValues.specularIntensity;
618
536
  this.emissive = new Color().setRGB(
619
537
  characterValues.emissive.r,
620
538
  characterValues.emissive.g,
@@ -622,14 +540,6 @@ var CharacterMaterial = class extends MeshPhysicalMaterial {
622
540
  );
623
541
  this.emissiveIntensity = characterValues.emissiveIntensity;
624
542
  this.envMapIntensity = characterValues.envMapIntensity;
625
- this.sheenColor = new Color().setRGB(
626
- characterValues.sheenColor.r,
627
- characterValues.sheenColor.g,
628
- characterValues.sheenColor.b
629
- );
630
- this.sheen = characterValues.sheen;
631
- this.clearcoat = characterValues.clearcoat;
632
- this.clearcoatRoughness = characterValues.clearcoatRoughness;
633
543
  }
634
544
  };
635
545
 
@@ -646,13 +556,16 @@ var AnimationState = /* @__PURE__ */ ((AnimationState2) => {
646
556
 
647
557
  // src/character/CharacterModel.ts
648
558
  var CharacterModel = class {
649
- constructor(characterDescription, animationConfig, characterModelLoader) {
559
+ constructor(characterDescription, animationConfig, characterModelLoader, cameraManager, characterId, isLocal) {
650
560
  this.characterDescription = characterDescription;
651
561
  this.animationConfig = animationConfig;
652
562
  this.characterModelLoader = characterModelLoader;
563
+ this.cameraManager = cameraManager;
564
+ this.characterId = characterId;
565
+ this.isLocal = isLocal;
653
566
  this.mesh = null;
654
- this.material = new CharacterMaterial();
655
567
  this.headBone = null;
568
+ this.materials = /* @__PURE__ */ new Map();
656
569
  this.animations = {};
657
570
  this.animationMixer = null;
658
571
  this.currentAnimation = 0 /* idle */;
@@ -669,22 +582,32 @@ var CharacterModel = class {
669
582
  2 /* running */
670
583
  );
671
584
  await this.setAnimationFromFile(this.animationConfig.airAnimationFileUrl, 4 /* air */);
672
- if (this.characterDescription.meshFileUrl) {
673
- this.applyCustomMaterial(this.material);
674
- }
585
+ this.applyCustomMaterials();
675
586
  }
676
- applyCustomMaterial(material) {
587
+ applyCustomMaterials() {
677
588
  if (!this.mesh)
678
589
  return;
679
590
  this.mesh.traverse((child) => {
680
- const asSkinnedMesh = child;
681
- if (asSkinnedMesh.isSkinnedMesh) {
682
- const mat = asSkinnedMesh.material;
683
- if (!mat.name.includes("joints")) {
684
- asSkinnedMesh.material = material;
591
+ if (child.isMesh || child.isSkinnedMesh) {
592
+ const asMesh = child;
593
+ const originalMaterial = asMesh.material;
594
+ if (this.materials.has(originalMaterial.name)) {
595
+ asMesh.material = this.materials.get(originalMaterial.name);
685
596
  } else {
686
- const color = mat.color;
687
- asSkinnedMesh.material = new CharacterMaterial(color);
597
+ const material = originalMaterial.name === "body_replaceable_color" ? new CharacterMaterial(
598
+ this.isLocal,
599
+ this.cameraManager,
600
+ this.characterId,
601
+ originalMaterial
602
+ ) : new CharacterMaterial(
603
+ this.isLocal,
604
+ this.cameraManager,
605
+ this.characterId,
606
+ originalMaterial,
607
+ originalMaterial.color
608
+ );
609
+ this.materials.set(originalMaterial.name, material);
610
+ asMesh.material = material;
688
611
  }
689
612
  }
690
613
  });
@@ -706,7 +629,7 @@ var CharacterModel = class {
706
629
  this.animationMixer = new AnimationMixer(this.mesh);
707
630
  }
708
631
  async composeMMLCharacter(mmlCharacterDescription) {
709
- var _a, _b, _c;
632
+ var _a, _b;
710
633
  if (((_a = mmlCharacterDescription.base) == null ? void 0 : _a.url.length) === 0) {
711
634
  throw new Error(
712
635
  "ERROR: An MML Character Description was provided but it's not a valid <m-character> string, or a valid URL"
@@ -715,14 +638,13 @@ var CharacterModel = class {
715
638
  let mergedCharacter = null;
716
639
  if (mmlCharacterDescription) {
717
640
  const characterBase = ((_b = mmlCharacterDescription.base) == null ? void 0 : _b.url) || null;
718
- const parts = [];
719
- (_c = mmlCharacterDescription.parts) == null ? void 0 : _c.forEach((part) => {
720
- if (part.url)
721
- parts.push(part.url);
722
- });
723
641
  if (characterBase) {
642
+ this.mmlCharacterDescription = mmlCharacterDescription;
724
643
  const mmlCharacter = new MMLCharacter(new ModelLoader());
725
- mergedCharacter = await mmlCharacter.mergeBodyParts(characterBase, parts);
644
+ mergedCharacter = await mmlCharacter.mergeBodyParts(
645
+ characterBase,
646
+ mmlCharacterDescription.parts
647
+ );
726
648
  if (mergedCharacter) {
727
649
  return mergedCharacter.children[0].children[0];
728
650
  }
@@ -814,6 +736,7 @@ var CharacterModel = class {
814
736
  update(time) {
815
737
  if (this.animationMixer) {
816
738
  this.animationMixer.update(time);
739
+ this.materials.forEach((material) => material.update());
817
740
  }
818
741
  }
819
742
  };
@@ -822,7 +745,7 @@ var CharacterModel = class {
822
745
  import {
823
746
  CircleGeometry,
824
747
  GLSL3,
825
- Mesh,
748
+ Mesh as Mesh2,
826
749
  RawShaderMaterial
827
750
  } from "three";
828
751
  var CharacterSpeakingIndicator = class {
@@ -886,7 +809,7 @@ var CharacterSpeakingIndicator = class {
886
809
  transparent: true,
887
810
  glslVersion: GLSL3
888
811
  });
889
- this.mesh = new Mesh(this.geometry, this.material);
812
+ this.mesh = new Mesh2(this.geometry, this.material);
890
813
  this.currentAlpha = 0;
891
814
  this.targetAlpha = 0;
892
815
  this.scene.add(this.mesh);
@@ -915,13 +838,13 @@ import {
915
838
  Color as Color2,
916
839
  FrontSide,
917
840
  LinearFilter as LinearFilter2,
918
- Mesh as Mesh2,
841
+ Mesh as Mesh3,
919
842
  MeshBasicMaterial as MeshBasicMaterial2,
920
843
  PlaneGeometry
921
844
  } from "three";
922
845
 
923
846
  // src/character/CanvasText.ts
924
- import { Texture, LinearFilter, RGBAFormat, MeshBasicMaterial } from "three";
847
+ import { Texture as Texture2, LinearFilter, RGBAFormat, MeshBasicMaterial } from "three";
925
848
  function getTextAlignOffset(textAlign, width) {
926
849
  switch (textAlign) {
927
850
  case "center":
@@ -1022,7 +945,7 @@ function CanvasText(message, options) {
1022
945
  }
1023
946
  function THREECanvasTextTexture(text, options) {
1024
947
  const canvas = CanvasText(text, options);
1025
- const texture = new Texture(canvas);
948
+ const texture = new Texture2(canvas);
1026
949
  texture.minFilter = LinearFilter;
1027
950
  texture.magFilter = LinearFilter;
1028
951
  texture.format = RGBAFormat;
@@ -1041,7 +964,7 @@ var defaultLabelWidth = 0.25;
1041
964
  var defaultLabelHeight = 0.125;
1042
965
  var defaultLabelCastShadows = true;
1043
966
  var tooltipGeometry = new PlaneGeometry(1, 1, 1, 1);
1044
- var CharacterTooltip = class extends Mesh2 {
967
+ var CharacterTooltip = class extends Mesh3 {
1045
968
  constructor() {
1046
969
  super(tooltipGeometry);
1047
970
  this.visibleOpacity = 0.85;
@@ -1148,7 +1071,7 @@ var CharacterTooltip = class extends Mesh2 {
1148
1071
 
1149
1072
  // src/character/Character.ts
1150
1073
  var Character = class extends Group {
1151
- constructor(characterDescription, animationConfig, characterModelLoader, characterId, modelLoadedCallback, cameraManager, composer) {
1074
+ constructor(characterDescription, animationConfig, characterModelLoader, characterId, modelLoadedCallback, cameraManager, composer, isLocal) {
1152
1075
  super();
1153
1076
  this.characterDescription = characterDescription;
1154
1077
  this.animationConfig = animationConfig;
@@ -1157,6 +1080,7 @@ var Character = class extends Group {
1157
1080
  this.modelLoadedCallback = modelLoadedCallback;
1158
1081
  this.cameraManager = cameraManager;
1159
1082
  this.composer = composer;
1083
+ this.isLocal = isLocal;
1160
1084
  this.model = null;
1161
1085
  this.color = new Color3();
1162
1086
  this.tooltip = null;
@@ -1169,14 +1093,16 @@ var Character = class extends Group {
1169
1093
  this.model = new CharacterModel(
1170
1094
  this.characterDescription,
1171
1095
  this.animationConfig,
1172
- this.characterModelLoader
1096
+ this.characterModelLoader,
1097
+ this.cameraManager,
1098
+ this.characterId,
1099
+ this.isLocal
1173
1100
  );
1174
1101
  await this.model.init();
1175
1102
  this.add(this.model.mesh);
1176
1103
  if (this.speakingIndicator === null) {
1177
1104
  this.speakingIndicator = new CharacterSpeakingIndicator(this.composer.postPostScene);
1178
1105
  }
1179
- this.color = this.model.material.colorsCube216[this.characterId];
1180
1106
  this.modelLoadedCallback();
1181
1107
  }
1182
1108
  updateAnimation(targetAnimation) {
@@ -1199,11 +1125,6 @@ var Character = class extends Group {
1199
1125
  );
1200
1126
  }
1201
1127
  }
1202
- if (typeof this.model.material.uniforms.time !== "undefined") {
1203
- this.model.material.uniforms.time.value = time;
1204
- this.model.material.uniforms.diffuseRandomColor.value = this.color;
1205
- this.model.material.update();
1206
- }
1207
1128
  this.model.update(deltaTime);
1208
1129
  }
1209
1130
  getCurrentAnimation() {
@@ -1613,8 +1534,6 @@ var CharacterManager = class {
1613
1534
  this.remoteCharacterControllers = /* @__PURE__ */ new Map();
1614
1535
  this.localCharacterSpawned = false;
1615
1536
  this.localCharacter = null;
1616
- this.cameraOffsetTarget = 0;
1617
- this.cameraOffset = 0;
1618
1537
  this.speakingCharacters = /* @__PURE__ */ new Map();
1619
1538
  this.group = new Group2();
1620
1539
  }
@@ -1628,7 +1547,8 @@ var CharacterManager = class {
1628
1547
  () => {
1629
1548
  },
1630
1549
  this.cameraManager,
1631
- this.composer
1550
+ this.composer,
1551
+ true
1632
1552
  );
1633
1553
  const quaternion = new Quaternion5().setFromEuler(character.rotation);
1634
1554
  this.sendUpdate({
@@ -1667,7 +1587,8 @@ var CharacterManager = class {
1667
1587
  () => {
1668
1588
  },
1669
1589
  this.cameraManager,
1670
- this.composer
1590
+ this.composer,
1591
+ false
1671
1592
  );
1672
1593
  this.remoteCharacters.set(id, character);
1673
1594
  const remoteController = new RemoteController(character, id);
@@ -1714,12 +1635,9 @@ var CharacterManager = class {
1714
1635
  if (this.timeManager.frame % 2 === 0) {
1715
1636
  this.sendUpdate(this.localController.networkState);
1716
1637
  }
1717
- this.cameraOffsetTarget = this.cameraManager.targetDistance <= 0.4 ? 0.13 : 0;
1718
- this.cameraOffset += ease(this.cameraOffsetTarget, this.cameraOffset, 0.1);
1719
- const targetOffset = new Vector38(0, 0, this.cameraOffset);
1720
- targetOffset.add(this.headTargetOffset);
1721
- targetOffset.applyQuaternion(this.localCharacter.quaternion);
1722
- this.cameraManager.setTarget(targetOffset.add(this.localCharacter.position));
1638
+ const targetOffset = new Vector38();
1639
+ targetOffset.add(this.headTargetOffset).applyQuaternion(this.localCharacter.quaternion).add(this.localCharacter.position);
1640
+ this.cameraManager.setTarget(targetOffset);
1723
1641
  for (const [id, update] of this.clientStates) {
1724
1642
  if (this.remoteCharacters.has(id) && this.speakingCharacters.has(id)) {
1725
1643
  const character = this.remoteCharacters.get(id);
@@ -2069,8 +1987,8 @@ var BrightnessContrastSaturationFolder = class {
2069
1987
  // src/tweakpane/blades/environmentFolder.ts
2070
1988
  var sunValues = {
2071
1989
  sunPosition: {
2072
- sunAzimuthalAngle: 215,
2073
- sunPolarAngle: -39
1990
+ sunAzimuthalAngle: 214.5,
1991
+ sunPolarAngle: -41.5
2074
1992
  },
2075
1993
  sunIntensity: 1,
2076
1994
  sunColor: { r: 1, g: 1, b: 1 }
@@ -2224,14 +2142,14 @@ var EnvironmentFolder = class {
2224
2142
  // src/tweakpane/blades/postExtrasFolder.ts
2225
2143
  var extrasValues = {
2226
2144
  grain: 0.055,
2227
- bloom: 0.25
2145
+ bloom: 3
2228
2146
  };
2229
2147
  var extrasOptions = {
2230
2148
  grain: {
2231
2149
  amount: { min: 0, max: 0.2, step: 2e-3 }
2232
2150
  },
2233
2151
  bloom: {
2234
- amount: { min: 0, max: 2, step: 0.05 }
2152
+ amount: { min: 0, max: 5, step: 0.05 }
2235
2153
  }
2236
2154
  };
2237
2155
  var PostExtrasFolder = class {
@@ -2264,7 +2182,7 @@ var rendererValues = {
2264
2182
  shadowMap: 2,
2265
2183
  toneMapping: 5,
2266
2184
  exposure: 1,
2267
- bgIntensity: 0.45,
2185
+ bgIntensity: 1,
2268
2186
  bgBlurriness: 0
2269
2187
  };
2270
2188
  var rendererOptions = {
@@ -2995,8 +2913,8 @@ var Sun = class extends Group4 {
2995
2913
  }
2996
2914
  this.directionalLight = new DirectionalLight(16777215, 0.5);
2997
2915
  this.directionalLight.intensity = sunValues.sunIntensity;
2998
- this.directionalLight.shadow.normalBias = 0.05;
2999
- this.directionalLight.shadow.radius = 1.5;
2916
+ this.directionalLight.shadow.normalBias = 0.01;
2917
+ this.directionalLight.shadow.radius = 0.02;
3000
2918
  this.directionalLight.shadow.camera = this.shadowCamera;
3001
2919
  this.directionalLight.shadow.mapSize.set(this.shadowResolution, this.shadowResolution);
3002
2920
  this.directionalLight.castShadow = true;
@@ -3845,7 +3763,7 @@ var EffectShader = {
3845
3763
  import {
3846
3764
  BufferAttribute,
3847
3765
  BufferGeometry,
3848
- Mesh as Mesh3,
3766
+ Mesh as Mesh4,
3849
3767
  OrthographicCamera as OrthographicCamera2,
3850
3768
  Sphere
3851
3769
  } from "three";
@@ -3861,7 +3779,7 @@ var FullScreenTriangle = class {
3861
3779
  this.geometry.boundingSphere = new Sphere();
3862
3780
  this.geometry.computeBoundingSphere = function() {
3863
3781
  };
3864
- this.mesh = new Mesh3(this.geometry, material);
3782
+ this.mesh = new Mesh4(this.geometry, material);
3865
3783
  this.mesh.frustumCulled = false;
3866
3784
  }
3867
3785
  get material() {
@@ -4709,7 +4627,6 @@ var Composer = class {
4709
4627
  if (envMap) {
4710
4628
  envMap.colorSpace = LinearSRGBColorSpace;
4711
4629
  envMap.needsUpdate = true;
4712
- this.scene.environment = envMap;
4713
4630
  this.scene.background = envMap;
4714
4631
  this.scene.backgroundIntensity = rendererValues.bgIntensity;
4715
4632
  this.isEnvHDRI = true;
@@ -4832,7 +4749,7 @@ import {
4832
4749
  Group as Group5,
4833
4750
  Line3 as Line32,
4834
4751
  Matrix4 as Matrix46,
4835
- Mesh as Mesh4,
4752
+ Mesh as Mesh5,
4836
4753
  MeshBasicMaterial as MeshBasicMaterial3,
4837
4754
  Quaternion as Quaternion6,
4838
4755
  Ray as Ray2,
@@ -4920,7 +4837,7 @@ var CollisionsManager = class {
4920
4837
  };
4921
4838
  if (this.debug) {
4922
4839
  newBufferGeometry.boundsTree = meshBVH;
4923
- const wireframeMesh = new Mesh4(newBufferGeometry, new MeshBasicMaterial3({ wireframe: true }));
4840
+ const wireframeMesh = new Mesh5(newBufferGeometry, new MeshBasicMaterial3({ wireframe: true }));
4924
4841
  const normalsHelper = new VertexNormalsHelper(wireframeMesh, 0.25, 65280);
4925
4842
  const visualizer = new MeshBVHHelper(wireframeMesh, 4);
4926
4843
  visualizer.edgeMaterial.color = new Color8("blue");