Skip to content

Commit e3c0630

Browse files
committed
3d 렌더링
1 parent a96501e commit e3c0630

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

src/domains/shared/components/3d/HomeModel.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function Model({ onLoaded }: { onLoaded: () => void }) {
1212

1313
useEffect(() => {
1414
const isMobile = window.innerWidth < 768; // 모바일 기준 너비
15-
setScale(isMobile ? 8 : 13); // 모바일이면 작게
15+
setScale(isMobile ? 3.8 : 11.5); // 모바일이면 작게
1616
}, []);
1717

1818
useEffect(() => {
@@ -26,19 +26,18 @@ function Model({ onLoaded }: { onLoaded: () => void }) {
2626
scene.traverse((child) => {
2727
if ((child as THREE.Mesh).isMesh) {
2828
const mesh = child as THREE.Mesh;
29-
if (mesh.material) {
30-
const material = child.material as THREE.MeshPhysicalMaterial;
31-
material.envMapIntensity = 3;
32-
material.metalness = 1;
33-
material.roughness = 0.3;
34-
material.emissiveIntensity = 2;
35-
material.clearcoat = 1;
36-
material.clearcoatRoughness = 0.2;
37-
material.needsUpdate = true;
38-
material.opacity = 0.35;
39-
material.bumpScale = 0.3;
40-
material.thickness = 0.1;
41-
}
29+
const material = mesh.material as THREE.MeshPhysicalMaterial;
30+
31+
material.envMapIntensity = 3;
32+
material.metalness = 1;
33+
material.roughness = 0.3;
34+
material.emissiveIntensity = 2;
35+
material.clearcoat = 1;
36+
material.clearcoatRoughness = 0.2;
37+
material.needsUpdate = true;
38+
material.opacity = 0.35;
39+
material.bumpScale = 0.3;
40+
material.thickness = 0.1;
4241
}
4342
});
4443

@@ -64,7 +63,7 @@ function CameraAnimation() {
6463

6564
function HomeModel({ onLoaded }: { onLoaded: () => void }) {
6665
return (
67-
<Canvas className="z-10 w-full" camera={{ position: [5, 20, 10], fov: 30 }}>
66+
<Canvas className="z-10 w-full" camera={{ position: [5, 20, 10], fov: 30 }} dpr={[1, 1.5]}>
6867
<ambientLight intensity={0.5} />
6968
<pointLight position={[10, 30, 40]} intensity={1} />
7069
<spotLight position={[0, 10, 10]} angle={0.2} penumbra={1} intensity={15} castShadow />
@@ -81,12 +80,13 @@ function HomeModel({ onLoaded }: { onLoaded: () => void }) {
8180
target={[0, 0, 0]}
8281
/>
8382

84-
<EffectComposer>
83+
<EffectComposer multisampling={0}>
8584
<Bloom
8685
intensity={0.65}
8786
luminanceThreshold={0.9}
8887
luminanceSmoothing={0.2}
8988
luminanceColor={new THREE.Color(1, 1, 1)}
89+
mipmapBlur
9090
/>
9191
</EffectComposer>
9292
</Canvas>

src/domains/shared/components/3d/Landing.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ function Landing() {
1212
<>
1313
{isLoading && <Spinner />}
1414
<div className="page-layout max-w-full">
15-
<HomeModel onLoaded={() => setIsLoading(false)} />
16-
{!isLoading && <StarMain />}
15+
<div className="relative w-full h-[1000px]">
16+
<HomeModel onLoaded={() => setIsLoading(false)} />
17+
{!isLoading && <StarMain />}
18+
</div>
19+
<div className="w-full h-[1000px]"></div>
1720
</div>
1821
</>
1922
);

0 commit comments

Comments
 (0)