首先,我是Three.js的初学者。通过创建这个问题,当加载的gltf模型没有纹理时,我想留下关于如何解决这个问题的信息。

const loader = new GLTFLoader();
loader.load(
// resource URL
// PVPanelDataURI,
process.env.PUBLIC_URL + 'staticPresets/PVPanel.gltf',
(gltf) => {
this.scene.add(gltf.scene);
console.log('gltf', gltf)
},
function(xhr) {
console.log((xhr.loaded / xhr.total * 100) + '% loaded');
},
function(error) {
console.log('An error happened: ', error);
}
);另外,我想消除这一警告:

我将感谢你的回答。
发布于 2021-12-24 18:39:43
这有很多原因。有时你甚至可以有一个破的GLTF文件。但是如果,你是幸运的,那么你需要为你的模型创造光,一切都会好起来的!
const ambientLight = new AmbientLight(0xFFFFFF);
ambientLight.intensity = 4;
this.scene.add( ambientLight );

注意,有时强度必须是显着的,而光应该是不同的。我用过
const spotLight = new THREE.SpotLight( 0xffffff );
spotLight.intensity = 10;
spotLight.position.set( 1000, 1000, 1000 );才能看到我的模型的黑色表面。另外,您可能需要在画布上导航以查看差异。

https://stackoverflow.com/questions/70475770
复制相似问题