I am currently working on creating a virtual representation of planet Earth using three.js. Initially, I applied a texture on a MeshBasicMaterial
and everything was functioning flawlessly. However, upon switching the material to a MeshPhongMaterial
, the map fails to render.
The reason behind wanting to change the material is my intention to incorporate a bump map as well.
Below is the snippet of my code:
let renderer;
const earthGeometry = new THREE.SphereGeometry(5, 50, 50);
const earthMaterial = new THREE.MeshPhongMaterial({
map: new THREE.TextureLoader().load("../img/globe.jpg"),
// bumpMap: new THREE.TextureLoader().load("../img/earthbump.jpg"),
// bumpScale: 0.3,
});
const sphere = new THREE.Mesh(earthGeometry, earthMaterial); scene.add(sphere);
Despite no errors being displayed in the console, I am at a loss on how to proceed further. Additionally, I am utilizing svelte and vite in my project, which might be contributing to this issue.