From 191bff5fbd9c0f27863eaed21b1aafd30b7e0cfa Mon Sep 17 00:00:00 2001 From: Elar Huik Date: Thu, 5 Oct 2023 17:56:01 +0300 Subject: [PATCH 1/6] feat: make mirror value optional --- src/components/FloorReflection/FloorReflection.component.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/FloorReflection/FloorReflection.component.tsx b/src/components/FloorReflection/FloorReflection.component.tsx index f8f441c5..49e1f169 100644 --- a/src/components/FloorReflection/FloorReflection.component.tsx +++ b/src/components/FloorReflection/FloorReflection.component.tsx @@ -7,7 +7,7 @@ export interface FloorReflectionProps { mixStrength?: number; metalness?: number; blur?: [number, number] | number; - mirror: number; + mirror?: number; minDepthThreshold?: number; maxDepthThreshold?: number; depthScale?: number; From 6feba5249dd3d14bb0e1cce6147628d5e8eaa451 Mon Sep 17 00:00:00 2001 From: Elar Huik Date: Thu, 5 Oct 2023 18:33:18 +0300 Subject: [PATCH 2/6] feat: decrease shadow catcher plane size --- src/components/Shadow/Shadow.component.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Shadow/Shadow.component.tsx b/src/components/Shadow/Shadow.component.tsx index 19bf0841..e61e82e7 100644 --- a/src/components/Shadow/Shadow.component.tsx +++ b/src/components/Shadow/Shadow.component.tsx @@ -3,7 +3,7 @@ import React, { FC } from 'react'; const Shadow: FC = () => ( - + From 7e39e24551621d2bfb037a630db2d2a1a35d446c Mon Sep 17 00:00:00 2001 From: Elar Huik Date: Thu, 5 Oct 2023 18:38:51 +0300 Subject: [PATCH 3/6] feat: decrease fog area size --- src/components/FloorReflection/FloorReflection.component.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/FloorReflection/FloorReflection.component.tsx b/src/components/FloorReflection/FloorReflection.component.tsx index 49e1f169..7f1609ae 100644 --- a/src/components/FloorReflection/FloorReflection.component.tsx +++ b/src/components/FloorReflection/FloorReflection.component.tsx @@ -40,7 +40,7 @@ export const FloorReflection: FC = ({ ...props }) => ( <> - + From b3877e767393688cb8165a6a7924e810b368b275 Mon Sep 17 00:00:00 2001 From: Elar Huik Date: Thu, 5 Oct 2023 18:55:37 +0300 Subject: [PATCH 4/6] feat: render effects only on-demand --- src/components/Avatar/Avatar.component.tsx | 80 ++++++++++------------ 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/src/components/Avatar/Avatar.component.tsx b/src/components/Avatar/Avatar.component.tsx index 5a0f5848..a3b24907 100644 --- a/src/components/Avatar/Avatar.component.tsx +++ b/src/components/Avatar/Avatar.component.tsx @@ -2,14 +2,7 @@ import React, { Suspense, FC, useMemo, CSSProperties, ReactNode, useEffect } fro import { Vector3 } from 'three'; import { CameraLighting } from 'src/components/Scene/CameraLighting.component'; import { Environment } from 'src/components/Scene/Environment.component'; -import { - LightingProps, - BaseModelProps, - EnvironmentProps, - BloomConfiguration, - SpawnState, - EffectConfiguration -} from 'src/types'; +import { LightingProps, BaseModelProps, EnvironmentProps, SpawnState, EffectConfiguration } from 'src/types'; import { BaseCanvas } from 'src/components/BaseCanvas'; import { AnimationModel, HalfBodyModel, StaticModel, PoseModel } from 'src/components/Models'; import { isValidFormat, triggerCallback } from 'src/services'; @@ -131,10 +124,6 @@ export interface AvatarProps extends LightingProps, EnvironmentProps, Omit = ({ className, headMovement = false, cameraZoomTarget = CAMERA.CONTROLS.FULL_BODY.ZOOM_TARGET, - bloom, onLoadedEffect, onLoadedAnimation, children, @@ -218,7 +206,7 @@ const Avatar: FC = ({ idleRotation={idleRotation} onLoaded={onLoaded} headMovement={headMovement} - bloom={bloom} + bloom={effects?.bloom} /> ); } @@ -232,7 +220,7 @@ const Avatar: FC = ({ idleRotation={idleRotation} onLoaded={onLoaded} headMovement={headMovement} - bloom={bloom} + bloom={effects?.bloom} /> ); } @@ -245,13 +233,15 @@ const Avatar: FC = ({ scale={scale} poseSrc={poseSrc!} onLoaded={onLoaded} - bloom={bloom} + bloom={effects?.bloom} /> ); } - return ; - }, [halfBody, animationSrc, modelSrc, scale, poseSrc, idleRotation, emotion, onLoaded, headMovement, bloom]); + return ( + + ); + }, [halfBody, animationSrc, modelSrc, scale, poseSrc, idleRotation, emotion, onLoaded, headMovement, effects?.bloom]); useEffect(() => triggerCallback(onLoading), [modelSrc, animationSrc, onLoading]); @@ -281,31 +271,35 @@ const Avatar: FC = ({ {background?.src && } {capture && } {background?.color && } - - - <> - {effects?.ambientOcclusion && ( - - )} - - + {effects && ( + + <> + {effects?.ambientOcclusion && ( + + )} + {effects?.bloom && ( + + )} + + + )} ); }; From 97d7c5adb659c6e91f8f4a17272225e47aff508f Mon Sep 17 00:00:00 2001 From: Elar Huik Date: Mon, 9 Oct 2023 17:30:11 +0300 Subject: [PATCH 5/6] fix: remove fade in and introduce a bug with existing spawn animations. --- .../Models/AnimationModel/AnimationModel.component.tsx | 6 +++--- src/types/index.ts | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/Models/AnimationModel/AnimationModel.component.tsx b/src/components/Models/AnimationModel/AnimationModel.component.tsx index b87b9734..58aa5b90 100644 --- a/src/components/Models/AnimationModel/AnimationModel.component.tsx +++ b/src/components/Models/AnimationModel/AnimationModel.component.tsx @@ -1,4 +1,4 @@ -import React, { useRef, FC, useMemo } from 'react'; +import React, { useRef, FC, useMemo, useState } from 'react'; import { useFrame, useGraph } from '@react-three/fiber'; import { AnimationMixer, Group } from 'three'; import { Model } from 'src/components/Models/Model'; @@ -29,7 +29,7 @@ export const AnimationModel: FC = ({ bloom }) => { const ref = useRef(null); - const [animationRunning, setAnimationRunning] = React.useState(true); + const [animationRunning, setAnimationRunning] = useState(true); const onSpawnAnimationFinish = () => { setAnimationRunning(false); }; @@ -46,7 +46,7 @@ export const AnimationModel: FC = ({ } const animation = mixer.clipAction(await animationClip); - animation.fadeIn(0.5); + animation.fadeIn(0); animation.play(); mixer.update(0); diff --git a/src/types/index.ts b/src/types/index.ts index 1fce75e2..8bf26e11 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -142,6 +142,10 @@ export type EffectConfiguration = { * Enables ambient occlusion for the current scene. */ ambientOcclusion?: boolean; + /** + * Bloom post-processing effect. + */ + bloom?: BloomConfiguration; }; export interface SpawnState { From 4ecafc7244f0c69e5bbd491a4628a9717f552541 Mon Sep 17 00:00:00 2001 From: Elar Huik Date: Mon, 9 Oct 2023 17:56:38 +0300 Subject: [PATCH 6/6] chore: update owners --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ceb95da6..76da9df3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,4 +5,4 @@ # The '*' pattern is global owners. -* @Zaehiel @blanxii @chikul @tiivik @hanWolf3D \ No newline at end of file +* @readyplayerme/avatars-content-tech-team \ No newline at end of file