Skip to content

Commit

Permalink
feat: update default lighting config
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaehiel committed Mar 14, 2024
1 parent f1f2954 commit d523680
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/components/Avatar/Avatar.component.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Suspense, FC, useMemo, CSSProperties, ReactNode, useEffect } from 'react';
import { Vector3 } from 'three';
import { ContactShadows } from "@react-three/drei";
import { CameraControls } from 'src/components/Scene/CameraControls.component';
import { Environment } from 'src/components/Scene/Environment.component';
import { BaseModelProps, EnvironmentProps, SpawnState, EffectConfiguration, LightingProps } from 'src/types';
Expand All @@ -12,7 +13,6 @@ import { Provider, useSetAtom } from 'jotai';
import Capture, { CaptureType } from 'src/components/Capture/Capture.component';
import { Box, Background } from 'src/components/Background/Box/Box.component';
import { BackgroundColor } from 'src/components/Background';
import Shadow from 'src/components/Shadow/Shadow.component';
import Loader from 'src/components/Loader';
import Bloom from 'src/components/Bloom/Bloom.component';
import { BlendFunction } from 'postprocessing';
Expand Down Expand Up @@ -260,7 +260,7 @@ const Avatar: FC<AvatarProps> = ({
/>
{AvatarModel}
{children}
{shadows && <Shadow />}
{shadows && <ContactShadows position={[0, 0, 0]} opacity={2} scale={10} blur={1.0} far={1.0}/>}
{background?.src && <Box {...background} />}
{capture && <Capture {...capture} />}
{background?.color && <BackgroundColor color={background.color} />}
Expand Down
6 changes: 4 additions & 2 deletions src/components/Avatar/Examples.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const FloatingSparkles: StoryFn<typeof SparklesDrei> = (args) => (
modelSrc={getStoryAssetPath('female.glb')}
cameraTarget={CAMERA.TARGET.FULL_BODY.FEMALE}
cameraInitialDistance={CAMERA.CONTROLS.FULL_BODY.MAX_DISTANCE}
shadows
>
<Sparkles {...args} />
</Avatar>
Expand All @@ -84,7 +85,8 @@ FloatingSparkles.args = {
size: 5,
speed: 0.25,
opacity: 0.6,
color: '#124cca'
color: '#124cca',
position: [0, 3, 0],
};

FloatingSparkles.argTypes = {
Expand All @@ -98,7 +100,7 @@ FloatingSparkles.argTypes = {

export const SpawnEffectAndAnimation: StoryFn<typeof Avatar> = (args) => (
<Avatar {...args}>
<Sparkles color="white" count={50} opacity={0.9} scale={5} size={0.5} speed={0.35} />
<Sparkles color="white" count={50} opacity={0.9} scale={5} size={0.5} speed={0.35} position={[0, 3, 0]}/>
</Avatar>
);
SpawnEffectAndAnimation.args = {
Expand Down
8 changes: 3 additions & 5 deletions src/components/Lights/Lights.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export const LIGHT_CONFIG = Object.freeze({
dirLightPosition: new Vector3(-0.75, 2.5, -1.0),
silhouetteLightPosition: new Vector3(-1.5, 0.1, -1.5),
defaultProps: {
keyLightIntensity: 1.2,
keyLightIntensity: 0.8,
keyLightColor: '#FFFFFF',
fillLightIntensity: 9.0,
fillLightIntensity: 3.0,
fillLightColor: '#6794FF',
fillLightPosition: new Vector3(-0.5, 1.6, -0.5),
backLightIntensity: 9.0,
backLightIntensity: 6.0,
backLightColor: '#FFB878',
backLightPosition: new Vector3(0.5, 1.6, -1.0),
lightTarget: new Vector3(0.0, 1.7, 0.0)
Expand Down Expand Up @@ -104,8 +104,6 @@ const Lights: FC<LightingProps> = (lightingProps) => {
intensity={keyLightIntensity * 0.25}
castShadow
/>
{/* Dummy directional light for shadow casting from behind avatar. */}
<directionalLight position={LIGHT_CONFIG.dirLightPosition} target={targets.shoe} castShadow intensity={0.0} />
</group>
);
};
Expand Down

0 comments on commit d523680

Please sign in to comment.