Hi everyone,
I’m relatively new to Three.js so please excuse me if I’m missing the obvious here.
I’m having problems getting a light map to show on a model.
I’ve exported a GLB file from Blender, along with a light map exported separately. It has one material, one mesh ‘room’ and one UV map (named ‘UVMap’ in Blender). From what I’ve gathered from the examples online, Three.js automatically creates a second UV when importing a gltf model, and then it’s just a matter of loading the image to use as the light map.
The model loads fine, but the light map doesn’t show. Here’s the code:
loadGLTF(){
const self = this;
const textureLoader = new THREE.TextureLoader();
const texture = textureLoader.load( '../../assets/ClassroomBakeLightMap.jpg' );
texture.flipY = false;
const loader = new GLTFLoader( ).setPath('../../assets/');
// Load a glTF resource
loader.load(
'classroom-v6.glb',
function ( gltf ) {
const classroom = gltf.scene;
classroom.traverse(function (room) {
if (room.isMesh) {
room.material.lightMap = texture;
room.material.needsUpdate = true;
}
});
self.scene.add( classroom );
},
);
}
What am I missing here?
I am getting a warning in the console that states the following:
THREE.GLTFLoader: Custom UV set 3 for texture map not yet supported.
Is this related to the issue I’m having? The model does use four image nodes for its appearance (base colour, roughness, emission and normal) but they all use the same UV map. Is this causing the problem?
I’ve been pulling my hair out because of this so thank you in advance for any help. It’ll be very much appreciated.
Best,
Vincent