How can I a texture to a json model exported from Blender to Three.js?

800 views Asked by At

In this case, I create two spheres in the scene. One is a SphereGeometry of Three.js(the left one), the other is a json model from Blender(the right one). Both of them use the same material and it does work. As follows:

var material = new THREE.MeshPhongMaterial({
    color: 0xffffff
});

Using color white

var material = new THREE.MeshPhongMaterial({
    color: 0xffffff,
    wireframe: true
});

Using wireframe

I try to add a texture to both of them.

However, the mapping effect does not work on the surface of the json model(the right one).

var material = new THREE.MeshPhongMaterial({
    map: texture,
});

enter image description here

How can I solve this problem?

Here are my Demo and source code.

2

There are 2 answers

1
Andy Ray On

Check the UVs option in the Blender Three.js exporter:

Three.js = :(

0
Kevin Hsiao On

I got the answer. I have to unwrap a UV sphere in Blender first.

Just like this video.

How To Unwrap A UV Sphere In Blender

After this step, the json file has complete information of the UVs array and mapping effect does work.

enter image description here