I’m writing code to load a GLB model from Blender into Three.js. When the number of objects exported from Blender is small, they load fine in Three.js. However, when there are many objects exported from Blender, I encounter the following errors:
ERROR: 0:398: ‘uv2’ : undeclared identifier ERROR: 0:398: ‘constructor’ : not enough data provided for construction
Looking at the object properties, uv2
does exist in geometry, so I’m not clear on the cause of the problem.
It might be an issue on Blender’s side, but I’m not sure. If you have any knowledge about this, I would appreciate your help. I’m also including my code for reference. Thank you for your cooperation
gltfLoader.load(
'/models/wall_bake_test.glb',
(gltf) =>
{
gltf.scene.traverse((child) => {
if (child.name==="Cube022") {
const mesh = child;
const material = mesh.material
const lightMapTexture = new THREE.TextureLoader().load('./textures/Cube.022_Bake1_PBR_Lightmap.png',function(){
material.needsUpdate = true;
});
lightMapTexture.channel = 2
lightMapTexture.flipY = false
material.lightMap = lightMapTexture;
console.log(lightMapTexture);
material.needsUpdate = true; //
gui.add(child.material, 'lightMapIntensity').min(0).max(30).step(0.001).name('lightMapIntensity')
}
});
scene.add(gltf.scene)
updateAllMaterials()
}
)