Three.js exports a Blender model without texture

I am trying to export this https://www.dropbox.com/s/zz1g38xaci2ibod/sailor.blend?dl=1 Blender model using the exporter from Three.js 73 (from the lead github branch).

But when I load it, I do not see the texture:

var loader = new THREE.JSONLoader(); loader.load("assets/sailor.json", function (geom, mat) { console.log(mat); var model = new THREE.Mesh(geom, mat[0]); model.castShadow = true; scene.add(model); }); 

enter image description here

The model has two cells (body and eyes), but it looks like this exporter can only export one grid ... So now I exported without eyes.

enter image description here

Exporter Settings:

enter image description here

Exporter Output File: sailor.json

io_three.export.log is empty with any level of logging.

+6
source share
1 answer

I'm not sure if this will solve your problem, but it may at least give you a hint of where the problem is.

I compared the converted JSON files compared to yours, and noticed that the JSON file you are using does not indicate which texture the object should use.

Add

"mapDiffuse" : "nameoftexture.png",

to

 "materials: [{ ..., ..., ... }]" 

an array.

Good luck.

EDIT

Your model seems to work with textures for me when I added this line to the material properties array.

+1
source

All Articles