2016-05-12 7 views
1

サーフェスのobjファイルがあり、上下の面にテクスチャを適用したいのですが、面全体にテクスチャを分割したいときに分割します。また、材料はメッシュの内側に適用されます。問題はモデルに関係しているのですか?コード内で何かが間違っていましたか?オブジェクト全体に3つのテクスチャモデルが正しく適用されていません

var loader = new THREE.OBJLoader(); 

    var texture = new THREE.Texture(); 
    var ImageLoader = new THREE.ImageLoader(); 
    ImageLoader.load("models/white.jpg", function (image) { 
     texture.image = image; 
     texture.needsUpdate = true; 
    }); 

    var custom = new THREE.Texture(); 
    var customLoader = new THREE.ImageLoader(); 
    customLoader.load("models/UV_Grid_Sm.jpg", function(image) { 
     custom.image = image; 
     custom.mapping = THREE.UVMapping; 
     custom.needsUpdate = true; 
    }); 


    loader.load("models/Hidden 5'4-19'5-2 (Holes_Patched).obj", function(object){ 
     object.traverse(function(child) { 

      if (child instanceof THREE.Mesh) { 

       if(child.name === 'Bottom') { 
        child.material = new THREE.MeshStandardMaterial({ map: custom}); 

       } 
       else if(child.name === 'Top') { 
        child.material = new THREE.MeshStandardMaterial({ map: custom}); 

       } 
       else { 
        child.material = new THREE.MeshStandardMaterial({ map: texture}); 

       } 
      } 

     }); 

download obj file hereオブジェクトは、「トップ」という名前の2つのグループがありますが、私はそれを後で変更できます。

Image of problem

+0

あなたの3DモデルのUVは、紫外線をproper.UpdateされていませんBlenderなどの3Dソフトウェアを使用してください – ArUn

答えて

0

あなたはUVがモデル上の座標を設定/追加する必要があります。これは、3Dソフトウェア(3DS Maxなど)で行う必要があります。
また、あなたが本当に(?? 134000 Vertsのを)必要とされていないエッジと頂点を削除することによって、あなたのモデルを最適化/クリーンアップする必要があります

enter image description here

+0

OBJLoaderがそのファイル形式を使用していたので、objファイルに残しておきます。 UVを3DSからobjにエクスポートすることは可能ですか? – Tulip

+0

エクスポート時にUV座標は.objファイルになります。はい – 2pha

関連する問題