In my app,i have import GLTFLoader and load my .gltf file.The model appears normal but the image is error;
The framework I’m using is Vue and I’m sure my gltf path is correct,because i can open it in google network.Vue startup app is a server built locally.I want to ask what is the problem and how to solve it.
It’s my code.
I suggest you first fix the following warning: Unknown extension “KHR_materials_pbrSpecularGlossiness”.
Please read the following post to understand the solution:
When importing the model into the three.js editor, you can see the following warning in the browser console:
THREE.GLTFLoader.js:395 THREE.GLTFLoader: Unknown extension “KHR_materials_pbrSpecularGlossiness”.
The support for this glTF extension has been removed with r147. Use the following guide to convert the asset to the metallic/roughness model.
Sidenote: Sketchfab should update its glTF exporter since the KHR_materials_pbrSpecularGlossiness extension has been archived by the Khronos Gr…
2 Likes
thx,I followed your advice and changed the material,now there is no error.
Can I ask another question: My picture is not displayed when it is imported. My image path is correct.
I solved the problem, I replaced the material
loader.load('assets/scene2.gltf', function (obj) {
obj.scene.traverse((child) => {
if (child.isMesh&&child.material.map&&child.material.map.normalMap) {
const texture = new THREE.TextureLoader().load('assets/' + child.material.map.normalMap);
const material = new THREE.MeshBasicMaterial({ map: texture });
child.material = material
}
})
that.scene.add(obj.scene || obj.scenes[0])
that.animate()
}, function (e) {
console.log(e)
}, function (e) {
console.log(e)
})
Works like a charm. Thanks!