Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visual improvements #108

Merged
merged 16 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed example/assets/hdr/industrial_sunset_2k.hdr
Binary file not shown.
Binary file removed example/assets/hdr/overcast_night_2k.hdr
Binary file not shown.
Binary file added example/assets/hdr/puresky_2k.hdr
Binary file not shown.
4 changes: 2 additions & 2 deletions example/assets/models/bot.glb
Git LFS file not shown
3 changes: 0 additions & 3 deletions example/assets/models/ears.glb

This file was deleted.

3 changes: 3 additions & 0 deletions example/assets/models/hat.glb
Git LFS file not shown
2 changes: 1 addition & 1 deletion example/local-multi-web-client/src/LocalAvatarClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { EditableNetworkedDOM, NetworkedDOM } from "@mml-io/networked-dom-docume
import { MMLWebRunnerClient } from "mml-web-runner";
import { AudioListener, Euler, Scene, Vector3 } from "three";

import hdrUrl from "../../assets/hdr/industrial_sunset_2k.hdr";
import hdrUrl from "../../assets/hdr/puresky_2k.hdr";
import airAnimationFileUrl from "../../assets/models/anim_air.glb";
import idleAnimationFileUrl from "../../assets/models/anim_idle.glb";
import jogAnimationFileUrl from "../../assets/models/anim_jog.glb";
Expand Down
2 changes: 1 addition & 1 deletion example/web-avatar-client/src/AvatarEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import React, { useCallback, useEffect, useState } from "react";
import { Group, Object3D } from "three";

import idleAnimationURL from "../../assets/avatar/anims/AS_Andor_Stand_Idle.glb";
import hdrURL from "../../assets/hdr/industrial_sunset_2k.hdr";
import hdrURL from "../../assets/hdr/puresky_2k.hdr";

type BodyPartTypes = "fullBody" | "head" | "upperBody" | "lowerBody" | "feet";

Expand Down
6 changes: 3 additions & 3 deletions example/web-client/src/Room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export class Room extends Group {
super();

this.floorMaterial = new MeshStandardMaterial({
color: 0xbcbcbc,
color: 0xffffff,
side: FrontSide,
metalness: 0.04,
roughness: 0.49,
metalness: 0.05,
roughness: 0.95,
});
this.floorMesh = new Mesh(this.floorGeometry, this.floorMaterial);
this.floorMesh.receiveShadow = true;
Expand Down
8 changes: 4 additions & 4 deletions example/web-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
} from "mml-web";
import { AudioListener, Euler, Scene, Vector3 } from "three";

import hdrUrl from "../../assets/hdr/industrial_sunset_2k.hdr";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this file isn't used any more we should remove it to clean up

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

import hdrUrl from "../../assets/hdr/puresky_2k.hdr";
import airAnimationFileUrl from "../../assets/models/anim_air.glb";
import idleAnimationFileUrl from "../../assets/models/anim_idle.glb";
import jogAnimationFileUrl from "../../assets/models/anim_jog.glb";
Expand All @@ -55,10 +55,10 @@ const characterDescription: CharacterDescription = {
// Option 3 - Use an MML Character from a string
// mmlCharacterString: `
// <m-character src="/assets/models/bot.glb">
// <m-model src="/assets/models/ears.glb"
// <m-model src="/assets/models/hat.glb"
// socket="head"
// x="0.077" y="0" z="0.04"
// sx="1.1" sy="1.1" sz="1.1"
// x="0.03" y="0" z="0.0"
// sx="1.03" sy="1.03" sz="1.03"
// rz="-90"
// ></m-model>
// </m-character>
Expand Down
19 changes: 9 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@
],
"devDependencies": {
"@types/jest": "29.5.11",
"@types/jju": "^1.4.5",
"@types/tmp": "^0.2.6",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"concurrently": "^8.2.2",
"esbuild": "0.20.0",
"esbuild-jest": "0.5.0",
"esbuild-plugin-copy": "2.1.1",
"jju": "^1.4.0",
"@types/jju": "^1.4.5",
"tmp": "^0.2.1",
"@types/tmp": "^0.2.6",
"eslint": "^8.56.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -43,9 +41,11 @@
"eslint-plugin-react-hooks": "^4.6.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jju": "^1.4.0",
"lerna": "8.0.2",
"prettier": "^3.2.4",
"rimraf": "^5.0.5",
"tmp": "^0.2.1",
"ts-node": "^10.9.2",
"tsx": "4.7.0",
"typescript": "^5.3.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/3d-web-avatar-editor-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"@types/node": "^20.11.13",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"esbuild-css-modules-plugin": "3.0.1"
"esbuild-css-modules-plugin": "3.1.0"
}
}
2 changes: 1 addition & 1 deletion packages/3d-web-avatar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@types/three": "0.153.0",
"esbuild-css-modules-plugin": "3.0.1"
"esbuild-css-modules-plugin": "3.1.0"
}
}
6 changes: 5 additions & 1 deletion packages/3d-web-avatar/src/helpers/SkeletonHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Bone, Group, Matrix4, Object3D, Skeleton, SkinnedMesh } from "three";
import { Bone, Group, Matrix4, Mesh, Object3D, Skeleton, SkinnedMesh } from "three";
import { GLTF } from "three/examples/jsm/loaders/GLTFLoader.js";
import * as SkeletonUtils from "three/examples/jsm/utils/SkeletonUtils.js";

Expand Down Expand Up @@ -151,6 +151,10 @@ export class SkeletonHelpers {

let hierarchyCheck = false;
clone.scene!.traverse((node) => {
if ((node as Mesh).isMesh || (node as SkinnedMesh).isSkinnedMesh) {
node.castShadow = true;
node.receiveShadow = true;
}
if (node.type === "Bone") {
if (hierarchyCheck === false) {
hierarchyCheck = true;
Expand Down
10 changes: 4 additions & 6 deletions packages/3d-web-client-core/src/character/Character.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class Character extends Group {
private readonly modelLoadedCallback: () => void,
private readonly cameraManager: CameraManager,
private readonly composer: Composer,
private readonly isLocal: boolean,
) {
super();
this.tooltip = new CharacterTooltip();
Expand All @@ -48,13 +49,15 @@ export class Character extends Group {
this.characterDescription,
this.animationConfig,
this.characterModelLoader,
this.cameraManager,
this.characterId,
this.isLocal,
);
await this.model.init();
this.add(this.model.mesh!);
if (this.speakingIndicator === null) {
this.speakingIndicator = new CharacterSpeakingIndicator(this.composer.postPostScene);
}
this.color = this.model.material.colorsCube216[this.characterId];
this.modelLoadedCallback();
}

Expand All @@ -76,11 +79,6 @@ export class Character extends Group {
);
}
}
if (typeof this.model.material.uniforms.time !== "undefined") {
this.model.material.uniforms.time.value = time;
this.model.material.uniforms.diffuseRandomColor.value = this.color;
this.model.material.update();
}
this.model.update(deltaTime);
}

Expand Down
17 changes: 8 additions & 9 deletions packages/3d-web-client-core/src/character/CharacterManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ export class CharacterManager {
private localController: LocalController;
public localCharacter: Character | null = null;

private cameraOffsetTarget: number = 0;
private cameraOffset: number = 0;

private speakingCharacters: Map<number, boolean> = new Map();

public readonly group: Group;
Expand Down Expand Up @@ -67,6 +64,7 @@ export class CharacterManager {
},
this.cameraManager,
this.composer,
true,
);
const quaternion = new Quaternion().setFromEuler(character.rotation);
this.sendUpdate({
Expand Down Expand Up @@ -112,6 +110,7 @@ export class CharacterManager {
},
this.cameraManager,
this.composer,
false,
);

this.remoteCharacters.set(id, character);
Expand Down Expand Up @@ -164,12 +163,12 @@ export class CharacterManager {
this.sendUpdate(this.localController.networkState);
}

this.cameraOffsetTarget = this.cameraManager.targetDistance <= 0.4 ? 0.13 : 0;
this.cameraOffset += ease(this.cameraOffsetTarget, this.cameraOffset, 0.1);
const targetOffset = new Vector3(0, 0, this.cameraOffset);
targetOffset.add(this.headTargetOffset);
targetOffset.applyQuaternion(this.localCharacter.quaternion);
this.cameraManager.setTarget(targetOffset.add(this.localCharacter.position));
const targetOffset = new Vector3();
targetOffset
.add(this.headTargetOffset)
.applyQuaternion(this.localCharacter.quaternion)
.add(this.localCharacter.position);
this.cameraManager.setTarget(targetOffset);

for (const [id, update] of this.clientStates) {
if (this.remoteCharacters.has(id) && this.speakingCharacters.has(id)) {
Expand Down
Loading
Loading