0

I'm trying to update an image in a material of a pre-loaded .js model - i want it to have the same properties, whereas only the image is changed.
Was trying to use this post as a reference, but in the .js model file, the map appears as the "mapAmbient" property. I was thinking of somehow using the THREE.ImageUtils.loadTexture() function, but couldn't find where exactly it should be placed.
Moreover, the texture should be loaded using an Image() object generated using another canvas.
Any help would be appriciated

*Edit:
Wasn't able to find actual way to change that property in runtime, but was able to change the image using base64 encoding:

//img is base64 encoded image       
var tex = new THREE.ImageUtils.loadTexture(img);
currentMesh.material.materials[1].map = tex;
Community
  • 1
  • 1
bks
  • 1,886
  • 1
  • 24
  • 43
  • three.js has no mapAmbient property in any of its materials. – WestLangley Feb 12 '14 at 15:56
  • what about "mapDiffuse" then? The model was exported from 3D Studio Max to .obj file, and imported to .js using the python script supplied in the Three.js source – bks Feb 12 '14 at 16:15
  • What is your question? – WestLangley Feb 12 '14 at 16:32
  • I had an image path in the "mapAmbient" property in one of the materials of my model, and i wanted to know how can i set a different image in runtime. Actually found a temporary sulotion, and updated question. – bks Feb 13 '14 at 10:25

0 Answers0