three.js在具有许多面孔的模型上定位纹理

时间:2014-04-12 19:26:19

标签: json three.js textures positioning

我正在尝试展示我在我的网站上设计和制作的家具。所以人们可以移动它并最终改变材料和颜色。配置器可以这么说。

这是我到目前为止所得到的:http://www.wijmakenalles.nl/configurator.php

正如您所看到的,桌面上的纹理有一个重复的缝隙,不应该在哪里。 我知道我可以调整纹理来调整uv,但由于模型上有超过600个面孔和900多个uv,因此在json文件中搜索相应的face / uv似乎毫无意义。它不仅仅是一个立方体。 这是json的材料部分:     {

"metadata" :
{
    "formatVersion" : 3.1,
    "generatedBy"   : "Blender 2.65 Exporter",
    "vertices"      : 1116,
    "faces"         : 647,
    "normals"       : 208,
    "colors"        : 0,
    "uvs"           : [972],
    "materials"     : 1,
    "morphTargets"  : 0,
    "bones"         : 0
},

"scale" : 1.000000,

"materials" : [ {
    "DbgColor" : 15658734,
    "DbgIndex" : 0,
    "DbgName" : "beton.001",
    "blending" : "NormalBlending",
    "colorAmbient" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
    "colorDiffuse" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
    "colorSpecular" : [0.5, 0.5, 0.5],
    "depthTest" : true,
    "depthWrite" : true,
    "mapDiffuse" : "texturez_3914.jpg",
    "mapDiffuseRepeat" : [2, 2],
    "mapDiffuseWrap" : ["repeat", "repeat"],
    "shading" : "Lambert",
    "specularCoef" : 50,
    "transparency" : 1.0,
    "transparent" : false,
    "vertexColors" : false
},

{
    "DbgColor" : 15658734,
    "DbgIndex" : 0,
    "DbgName" : "default",
    "vertexColors" : false
},

{
    "DbgColor" : 15597568,
    "DbgIndex" : 1,
    "DbgName" : "beton",
    "blending" : "NormalBlending",
    "colorAmbient" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
    "colorDiffuse" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
    "colorSpecular" : [0.5, 0.5, 0.5],
    "depthTest" : true,
    "depthWrite" : true,
    "mapDiffuse" : "concrete.jpg",
    "mapDiffuseRepeat" : [1, 8],
    "shading" : "Lambert",
    "specularCoef" : 50,
    "transparency" : 1.0,
    "transparent" : false,
    "vertexColors" : false
},

{
    "DbgColor" : 15597568,
    "DbgIndex" : 1,
    "DbgName" : "beton",
    "blending" : "NormalBlending",
    "colorAmbient" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
    "colorDiffuse" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
    "colorSpecular" : [0.5, 0.5, 0.5],
    "depthTest" : true,
    "depthWrite" : true,
    "mapDiffuse" : "concrete.jpg",
    "mapDiffuseRepeat" : [1, 8],
    "shading" : "Lambert",
    "specularCoef" : 50,
    "transparency" : 1.0,
    "transparent" : false,
    "vertexColors" : false
},

{
    "DbgColor" : 15597568,
    "DbgIndex" : 0,
    "DbgName" : "houtpaneel",
    "blending" : "NormalBlending",
    "colorAmbient" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
    "colorDiffuse" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
    "colorSpecular" : [0.5, 0.5, 0.5],
    "depthTest" : true,
    "depthWrite" : true,
    "mapDiffuse" : "eikenorigineel.jpg",
    "mapDiffuseRepeat" : [0.01, 0.027],
    "mapDiffuseWrap" : ["norepeat", "norepeat"],
    "shading" : "Face",
    "specularCoef" : 50,
    "transparency" : 1.0,
    "transparent" : false,
    "vertexColors" : false
}],

"vertices" : [5.4625,-0.0032920.....etc.

这是de loader代码:

    // Load in the mesh and add it to the scene.
  var loader = new THREE.JSONLoader();
  loader.load( "json/eikenbetontafel.js", function(geo, materials){
    var material = new THREE.MeshFaceMaterial(materials);
    mesh = new THREE.Mesh(geo, material);
            mesh.position.set(-.45, 0, .18);
    scene.add(mesh);
  });

希望有人可以给我一个指示,谢谢

0 个答案:

没有答案