mrdoob/three.js — Issue #1171: Apply Phong material on .dae (Collada)
Author: sim254
Created: 2012-01-23 21:09:13+00:00
State: open

Hi everybody !

I've just a small problem with material on .dae object.
The basic material used is Lambert (informations with console.log). But I want use Phong material. It's ok but I loose my texture when I use this new material. How do I change material without lose my texture.
I read on issues that the material must be apply to skins[0]. But my table skin is empty (my texture is not here).
I try to use material.map to manually assign the texture but coordinates texture are bad...

My script:

var controlPanel;
new THREE.ColladaLoader().load('./models/control_Panel.dae', function colladaReady(collada) {
controlPanel = collada.scene.children[1];
controlPanel.scale.set(0.25,0.25,0.25);
controlPanel.position.set(0,0,350);
controlPanel.castShadow = true;
controlPanel.receiveShadow = true;
controlPanel.name = "control_Panel";
/*
controlPanel.children[0].material = new THREE.MeshPhongMaterial();
controlPanel.children[0].material.map = new THREE.ImageUtils.loadTexture( './models/images/controlPanel_Tex.jpg' ); // Problem here, my texture have bad coordinates
controlPanel.children[0].material.overdraw = false;
*/

console.log(controlPanel);

objectsClick.push(controlPanel);
scene.add(controlPanel);
});

Thank you in advance if you have the solution !