Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ericjansenrpm committed Jul 15, 2024
1 parent 9afc537 commit 3f02382
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/components/Avatar/Avatar.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { BaseCanvas } from 'src/components/BaseCanvas';
import { AnimationModel, HalfBodyModel, StaticModel, PoseModel } from 'src/components/Models';
import { isValidFormat, triggerCallback } from 'src/services';
import { Dpr } from '@react-three/fiber';
import { EffectComposer, SSAO, Vignette } from '@react-three/postprocessing';
import { BrightnessContrast, EffectComposer, SSAO, Vignette } from '@react-three/postprocessing';
import { Provider, useSetAtom } from 'jotai';
import Capture, { CaptureType } from 'src/components/Capture/Capture.component';
import { Box, Background } from 'src/components/Background/Box/Box.component';
Expand Down Expand Up @@ -44,9 +44,9 @@ export const CAMERA = {
}
}
};

// prettier-ignore
export type Emotion = Record<string, number>;

// prettier-ignore
export interface AvatarProps extends LightingProps, EnvironmentProps, Omit<BaseModelProps, 'setModelFallback'> {
/**
* Arbitrary binary data (base64 string, Blob) of a `.glb` file or path (URL) to a `.glb` resource.
Expand Down Expand Up @@ -151,6 +151,7 @@ export interface AvatarProps extends LightingProps, EnvironmentProps, Omit<BaseM
* Interactive avatar presentation with zooming and horizontal rotation controls.
* Optimised for full-body and half-body avatars.
*/
// prettier-ignore
const Avatar: FC<AvatarProps> = ({
modelSrc,
animationSrc = undefined,
Expand Down Expand Up @@ -265,7 +266,7 @@ const Avatar: FC<AvatarProps> = ({
{capture && <Capture {...capture} />}
{background?.color && <BackgroundColor color={background.color} />}
{(effects?.ambientOcclusion || effects?.bloom || effects?.vignette) && (
<EffectComposer autoClear multisampling={4}>
<EffectComposer autoClear multisampling={4} enableNormalPass={effects?.ambientOcclusion}>
<>
{effects?.ambientOcclusion && (
<SSAO
Expand Down Expand Up @@ -293,6 +294,7 @@ const Avatar: FC<AvatarProps> = ({
/>
)}
{effects?.vignette && <Vignette eskil={false} offset={0.5} darkness={0.5} />}
<BrightnessContrast brightness={0.05} contrast={0.25} />
</>
</EffectComposer>
)}
Expand Down
1 change: 0 additions & 1 deletion src/components/BaseCanvas/BaseCanvas.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const BaseCanvas: FC<BaseCanvasProps> = (
toneMapping: ACESFilmicToneMapping,
useLegacyLights: true,
}}
legacy
dpr={dpr}
camera={{ fov, position }}
resize={{ scroll: true, debounce: { scroll: 50, resize: 0 } }}
Expand Down
5 changes: 3 additions & 2 deletions src/components/Scene/Environment.component.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { FC, useMemo } from 'react';
import { Environment as DreiEnvironment } from '@react-three/drei';
import { environmentPresets, getPresetEnvironmentMap, EnvironmentPresets } from 'src/services/Environment.service';
import { LinearEncoding } from '@react-three/drei/helpers/deprecated';

export interface EnvironmentProps {
environment: string | EnvironmentPresets;
}

// prettier-ignore
export const Environment: FC<EnvironmentProps> = ({ environment }) => {
const config = useMemo<{ files: string }>(() => {
const isStaticPreset = environment in environmentPresets;
Expand All @@ -16,5 +17,5 @@ export const Environment: FC<EnvironmentProps> = ({ environment }) => {
};
}, [environment]);

return <DreiEnvironment files={config.files} />;
return <DreiEnvironment files={config.files} encoding={LinearEncoding} environmentIntensity={10}/>;
};

0 comments on commit 3f02382

Please sign in to comment.