原本的3D模型顏色是這樣棕色
但放入html裡變成紅色
試問有無方法解決此問題
<script src="three.js"></script>
<script type="module" src="GLTFLoader.js"></script>
<script type="module">
import { GLTFLoader } from "./GLTFLoader.js";
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(
15,
window.innerWidth / window.innerHeight,
0.01,
1000
);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(700, 450);
document.getElementById('3D').appendChild(renderer.domElement);
/*document.body.appendChild(renderer.domElement);*/
var loader = new GLTFLoader();
var obj;
loader.load("scene.gltf", function (gltf) {
obj = gltf.scene;
scene.add(gltf.scene);
});
scene.background = new THREE.Color(0x999999);
var light = new THREE.HemisphereLight(0xffffff, 0x000000, 30);//(天空的反光颜色,地面的反光颜色,光的强度);
scene.add(light);
camera.position.set(0, 2.5, 45);
function animate() {
requestAnimationFrame(animate);
obj.rotation.y += 0.01;
renderer.render(scene, camera);
}
animate();
</script>