正确地将纹理添加到threejs中的.obj

时间:2017-02-21 14:36:10

标签: javascript 3d three.js textures

我正在尝试将纹理添加到我已下载的.obj(https://www.cgtrader.com/free-3d-models/character/anatomy/eyeball--3)。纹理就像这样:

Eyeball and Iris Texture

我已将图像加载到threejs中的obj,就像三个.js建议的例子一样:

质地:

    var loader = new THREE.ImageLoader( manager );
    loader.load( 'textures/Eye_D.jpg', function ( image ) {

        texture.image = image;
        texture.needsUpdate = true;

    } );

模特:

    var loader = new THREE.OBJLoader( manager );
    loader.load( 'obj/eyeball.obj', function ( object ) {
                object.scale.set(25, 25, 25)

                object.traverse( function ( child ) {

                    if ( child instanceof THREE.Mesh ) {

                        child.material.map = texture;

                    }

                } );

                object.position.y = 5;
                scene.add( object );

            }, onProgress, onError );

但我不知道如何正确添加纹理,因为虹膜应单独纹理。它目前看起来像这样:

enter image description here

0 个答案:

没有答案