Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Three.js exports Blender model without texture

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

But when I load it I see no 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 meshes (body and eyes) but looks like this exporter can export only one mesh... So for 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 logging level.

like image 662
Alex P. Avatar asked Nov 24 '15 16:11

Alex P.


1 Answers

I'm not sure this will solve your problem but it might atleast give you a hint of where the problem is.

I compared my converted JSON files and compared to yours, and noticed that the JSON file that you use does not specify what texture the object should use.

Add:

"mapDiffuse" : "nameoftexture.png",

to your

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

array.

Good luck.

EDIT

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

like image 99
micnil Avatar answered Oct 03 '22 06:10

micnil