
블렌더에서 -> 형태인 obj 와 재질인 mtl 파일로 export 하여 가져옴.
처음에 아무것도 안보여서 다른 개체를 다 삭제함.
그래도 안보여서 스케일을 1000배 키웠더니 검게 형태만 보임.
빛을 추가하고 세기를 키웠더니 그제서야 보임
// OBJ Loader
const OBJloader = new OBJLoader() // MTLLoader에서 로드한 materials 파일을 설정합니다.
let ObjGroup = new THREE.Object3D()
// MTL Loader
const mtlLoader = new MTLLoader()
mtlLoader.load('../static/img/lemon.mtl', (mtl) => {
mtl.preload()
OBJloader.setMaterials(mtl);
OBJloader.load( '../static/img/lemon.obj',function (object) {
ObjGroup.add(object);
ObjGroup.scale.set(1000, 1000, 1000);
scene.add(ObjGroup);
},
function (xhr) {
const progress = (xhr.loaded / xhr.total) * 100 + '%'
console.log(progress)
},
function (error) {
console.log('An error happened')
}
)
})
const ambientLight = new THREE.AmbientLight(0xffffff, 1.8)
scene.add(ambientLight)
// OBJ 끝
'3Js' 카테고리의 다른 글
블렌더 단축키 (0) | 2025.02.24 |
---|---|
threejs + gsap 마우스 스크롤 연동 (1) | 2024.07.23 |
threejs, 파티클, 마우스 방향 이동 (0) | 2024.07.23 |
Raycaster() + gsap (1) | 2024.07.19 |
threejs GLTFloader.load() 블렌더에서 파일 가져오기 (0) | 2024.07.19 |
threejs skybox 배경 (0) | 2024.07.18 |
threejs Fog() 안개 (0) | 2024.07.18 |
OrbitControls(), 마우스휠 확대축소 제한, 로테이션 제한 (0) | 2024.07.18 |