loader.setPath(‘models/gltf/’); loader.load(‘sphere.glb’, function (gltf) {
gltf.scene.traverse(function (child) {
if (child.isMesh) {
// mat.map = child.material.map;
// mat.normalMap = child.material.normalMap;
// //mat.metalnessMap = child.material.metalnessMap;
// mat.roughness = 0;
// //mat.metalness = child.material.metalness;
// mat.metalness = 0;
var sMat = new THREE.MeshPhysicalMaterial();
child.material = sMat;
//roughnessMipmapper.generateMipmaps(child.material);
console.log(child.geometry);
child.geometry.computeVertexNormals();
child.geometry.computeTangents();
console.log(child.geometry);
}
});
I am here http://localhost:8080/examples/?q=gltf#webgl_ loader_ Gltf modified the code, loaded a model (ball) exported from threejs editr, and loaded it. But the browser reported an error. Before r131, I could set vertextangents = true in the material, but now I don’t have this attribute. What should I do to use tangents correctly? I forced tangents on the shader:
export default /* glsl */`
#define STANDARD
#define USE_UV
#define USE_TANGENT