2017-08-25 201 views
0

我試圖從blender導出json並使用three.js渲染它。我使用以下代碼作爲基礎:https://github.com/jpetitcolas/webgl-experiments/tree/gh-pages/01-rotating-meshThree.js不渲染材質

當我按照原樣啓動代碼時,它的效果很好。但是,當我嘗試使用攪拌器導出器導出相同的混合對象時,three.js忽略了材質。見下面的圖片:

enter image description here

原出口的例子是正確的: enter image description here

我用下面的導出設置:

enter image description here

這裏是出口JSON ,它不起作用:https://pastebin.com/dWWWT2yG

{ 
"materials":[{ 
    "transparent":false, 
    "colorEmissive":[0,0,0], 
    "doubleSided":true, 
    "visible":true, 
    "DbgName":"Material", 
    "colorDiffuse":[0.768151,0.768151,0.768151], 
    "shading":"lambert", 
    "DbgColor":15658734, 
    "DbgIndex":0, 
    "opacity":1, 
    "wireframe":false, 
    "blending":1, 
    "depthWrite":true, 
    "depthTest":true 
},{ 
    "transparent":false, 
    "colorEmissive":[0,0,0], 
    "doubleSided":true, 
    "visible":true, 
    "DbgName":"Material.001", 
    "colorDiffuse":[0.026241,0.076185,0.341914], 
    "shading":"lambert", 
    "DbgColor":15597568, 
    "DbgIndex":1, 
    "opacity":1, 
    "wireframe":false, 
    "blending":1, 
    "depthWrite":true, 
    "depthTest":true 
},{ 
    "transparent":false, 
    "colorEmissive":[0,0,0], 
    "doubleSided":true, 
    "visible":true, 
    "DbgName":"Material.002", 
    "colorDiffuse":[0.043735,0.127438,0.412543], 
    "shading":"lambert", 
    "DbgColor":60928, 
    "DbgIndex":2, 
    "opacity":1, 
    "wireframe":false, 
    "blending":1, 
    "depthWrite":true, 
    "depthTest":true 
},{ 
    "transparent":false, 
    "colorEmissive":[0,0,0], 
    "doubleSided":true, 
    "visible":true, 
    "DbgName":"Material.003", 
    "colorDiffuse":[0.009134,0.009134,0.009134], 
    "shading":"lambert", 
    "DbgColor":238, 
    "DbgIndex":3, 
    "opacity":1, 
    "wireframe":false, 
    "blending":1, 
    "depthWrite":true, 
    "depthTest":true 
},{ 
    "transparent":false, 
    "colorEmissive":[0,0,0], 
    "doubleSided":true, 
    "visible":true, 
    "DbgName":"Material.004", 
    "colorDiffuse":[0.018849,0.018849,0.018849], 
    "shading":"lambert", 
    "DbgColor":15658496, 
    "DbgIndex":4, 
    "opacity":1, 
    "wireframe":false, 
    "blending":1, 
    "depthWrite":true, 
    "depthTest":true 
},{ 
    "transparent":false, 
    "colorEmissive":[0,0,0], 
    "doubleSided":true, 
    "visible":true, 
    "DbgName":"Material.005", 
    "colorDiffuse":[1,1,1], 
    "shading":"lambert", 
    "DbgColor":61166, 
    "DbgIndex":5, 
    "opacity":1, 
    "wireframe":false, 
    "blending":1, 
    "depthWrite":true, 
    "depthTest":true 
}], 
"uvs":[], 
"faces":[35,110,25,2,107,2,0,0,0,0,35,112,37,10,109,2,1,1,1,1,35,106,97,5,69,2,2,2,2,2,35,74,27,6,70,2,3,3,3,3,35,95,79,7,71,2,4,4,4,4,35,65,24,3,63,2,5,5,5,5,35,101,109,10,29,2,6,6,6,6,35,46,38,9,35,2,7,7,7,7,35,45,36,11,28,2,8,8,8,8,35,196,117,19,178,2,9,9,9,9,35,89,41,14,83,2,10,10,10,10,35,181,177,13,55,2,7,7,7,7,35,185,192,15,100,2,6,6,6,6,35,184,191,12,82,2,11,11,11,11,35,180,178,19,43,2,12,12,12,12,35,140,137,22,121,2,4,4,4,4,35,124,118,18,52,2,13,13,13,13,35,123,116,17,42,2,4,4,4,4,35,169,121,22,159,2,0,0,0,0,35,142,139,21,128,2,14,14,14,14,35,198,138,23,195,2,5,5,5,5,35,173,136,20,158,2,15,15,15,15,35,111,31,25,110,2,0,0,0,0,35,75,33,27,74,2,16,16,16,16,35,67,30,24,65,2,17,17,17,17,35,102,101,29,35,2,6,6,6,6,35,37,44,29,10,2,18,18,18,18,35,47,45,28,34,2,19,19,19,19,35,44,46,35,29,2,20,20,20,20,35,96,1,31,111,2,0,0,0,0,35,69,5,33,75,2,21,21,21,21,35,60,0,30,67,2,22,22,22,22,35,98,102,35,9,2,6,6,6,6,35,39,47,34,8,2,23,23,23,23,35,113,53,37,112,2,1,1,1,1,35,58,54,38,46,2,24,24,24,24,35,57,48,36,45,2,25,25,25,25,35,91,50,41,89,2,26,26,26,26,35,192,179,40,15,2,7,7,7,7,35,182,180,43,52,2,12,12,12,12,35,117,122,43,19,2,13,13,13,13,35,125,123,42,51,2,4,4,4,4,35,53,56,44,37,2,27,27,27,27,35,59,57,45,47,3,28,28,28,28,35,56,58,46,44,1,29,29,29,29,35,49,59,47,39,2,30,30,30,30,35,179,181,55,40,2,24,24,24,24,35,122,124,52,43,2,13,13,13,13,35,108,6,53,113,2,1,1,1,1,35,33,5,54,58,2,7,7,7,7,35,26,7,48,57,2,8,8,8,8,35,82,12,50,91,2,10,10,10,10,35,193,182,52,18,2,12,12,12,12,35,119,125,51,16,2,4,4,4,4,35,6,27,56,53,2,31,31,31,31,35,32,26,57,59,2,32,32,32,32,35,27,33,58,56,2,33,33,33,33,35,4,32,59,49,2,34,34,34,34,35,96,105,61,1,2,35,35,35,35,35,25,64,62,2,2,21,21,21,21,35,77,93,63,3,2,4,4,4,4,35,72,65,63,71,2,36,36,36,36,35,31,66,64,25,2,37,37,37,37,35,73,67,65,72,4,38,38,38,38,35,1,61,66,31,2,39,39,39,39,35,68,60,67,73,2,40,40,40,40,35,105,106,69,61,2,41,41,41,41,35,64,74,70,62,2,42,42,42,42,35,93,95,71,63,2,43,43,43,43,35,66,75,74,64,2,44,44,44,44,35,61,69,75,66,2,45,45,45,45,35,26,72,71,7,2,5,5,5,5,35,32,73,72,26,2,46,46,46,46,35,4,68,73,32,2,47,47,47,47,35,24,84,77,3,2,0,0,0,0,35,36,88,81,11,2,1,1,1,1,35,68,4,78,94,2,10,10,10,10,35,115,108,79,95,2,48,48,48,48,35,28,11,81,85,2,6,6,6,6,35,103,89,83,100,2,49,49,49,49,35,176,183,83,14,2,6,6,6,6,35,186,184,82,99,2,50,50,50,50,35,30,86,84,24,2,0,0,0,0,35,34,28,85,87,2,6,6,6,6,35,0,76,86,30,2,0,0,0,0,35,8,34,87,80,2,6,6,6,6,35,48,90,88,36,2,1,1,1,1,35,104,91,89,103,1,51,51,51,51,35,7,79,90,48,2,1,1,1,1,35,99,82,91,104,2,52,52,52,52,35,0,60,92,76,2,10,10,10,10,35,107,114,93,77,2,53,53,53,53,35,60,68,94,92,2,54,54,54,54,35,114,115,95,93,3,55,55,55,55,35,84,110,107,77,2,56,56,56,56,35,88,112,109,81,2,57,57,57,57,35,94,78,97,106,2,58,58,58,58,35,85,81,109,101,2,6,6,6,6,35,183,185,100,83,2,6,6,6,6,35,86,111,110,84,4,56,56,56,56,35,87,85,101,102,0,59,59,59,59,35,76,96,111,86,2,0,0,0,0,35,80,87,102,98,2,6,6,6,6,35,90,113,112,88,4,60,60,60,60,35,79,108,113,90,2,57,57,57,57,35,76,92,105,96,2,61,61,61,61,35,92,94,106,105,3,62,62,62,62,35,70,6,108,115,2,4,4,4,4,35,40,103,100,15,2,10,10,10,10,35,177,186,99,13,2,11,11,11,11,35,55,104,103,40,2,10,10,10,10,35,13,99,104,55,2,10,10,10,10,35,2,62,114,107,2,63,63,63,63,35,62,70,115,114,2,64,64,64,64,35,197,129,117,196,2,65,65,65,65,35,143,140,121,131,2,66,66,66,66,35,134,127,118,124,2,52,52,52,52,35,133,126,116,123,2,66,66,66,66,35,171,131,121,169,2,67,67,67,67,35,138,141,120,23,2,14,14,14,14,35,129,132,122,117,2,52,52,52,52,35,135,133,123,125,4,68,68,68,68,35,132,134,124,122,2,69,69,69,69,35,130,135,125,119,2,66,66,66,66,35,141,142,128,120,2,49,49,49,49,35,176,14,129,197,2,9,9,9,9,35,136,143,131,20,2,4,4,4,4,35,50,12,127,134,2,13,13,13,13,35,39,8,126,133,2,4,4,4,4,35,158,20,131,171,2,0,0,0,0,35,14,41,132,129,2,13,13,13,13,35,49,39,133,135,2,4,4,4,4,35,41,50,134,132,2,13,13,13,13,35,4,49,135,130,2,4,4,4,4,35,148,146,137,140,2,4,4,4,4,35,150,147,139,142,2,14,14,14,14,35,199,145,138,198,2,5,5,5,5,35,175,144,136,173,2,70,70,70,70,35,151,148,140,143,3,68,68,68,68,35,145,149,141,138,2,14,14,14,14,35,149,150,142,141,1,51,51,51,51,35,144,151,143,136,2,4,4,4,4,35,119,16,146,148,2,4,4,4,4,35,127,12,147,150,2,14,14,14,14,35,193,18,145,199,2,5,5,5,5,35,152,4,144,175,2,71,71,71,71,35,130,119,148,151,2,72,72,72,72,35,18,118,149,145,2,14,14,14,14,35,118,127,150,149,2,49,49,49,49,35,4,130,151,144,2,4,4,4,4,35,116,168,157,17,2,9,9,9,9,35,54,5,155,162,2,73,73,73,73,35,98,9,154,166,2,59,59,59,59,35,78,4,152,165,2,11,11,11,11,35,42,17,157,161,2,12,12,12,12,35,187,169,159,195,2,0,0,0,0,35,137,172,159,22,2,5,5,5,5,35,189,173,158,194,2,74,74,74,74,35,9,38,160,154,2,75,75,75,75,35,51,42,161,163,2,12,12,12,12,35,38,54,162,160,2,76,76,76,76,35,16,51,163,156,2,12,12,12,12,35,8,80,164,153,2,6,6,6,6,35,97,78,165,167,2,77,77,77,77,35,80,98,166,164,2,59,59,59,59,35,5,97,167,155,2,11,11,11,11,35,126,170,168,116,2,78,78,78,78,35,188,171,169,187,4,79,79,79,79,35,8,153,170,126,2,9,9,9,9,35,194,158,171,188,2,0,0,0,0,35,146,174,172,137,2,5,5,5,5,35,190,175,173,189,3,80,80,80,80,35,16,156,174,146,2,5,5,5,5,35,191,152,175,190,2,81,81,81,81,35,168,196,178,157,2,9,9,9,9,35,162,155,177,181,2,82,82,82,82,35,166,154,192,185,2,6,6,6,6,35,165,152,191,184,2,83,83,83,83,35,161,157,178,180,2,84,84,84,84,35,172,198,195,159,2,85,85,85,85,35,154,160,179,192,2,82,82,82,82,35,163,161,180,182,3,85,85,85,85,35,160,162,181,179,2,86,86,86,86,35,156,163,182,193,2,85,85,85,85,35,153,164,183,176,2,59,59,59,59,35,167,165,184,186,4,87,87,87,87,35,164,166,185,183,0,59,59,59,59,35,155,167,186,177,2,11,11,11,11,35,170,197,196,168,0,88,88,88,88,35,153,176,197,170,2,9,9,9,9,35,174,199,198,172,4,89,89,89,89,35,156,193,199,174,2,84,84,84,84,35,120,187,195,23,2,0,0,0,0,35,139,189,194,21,2,90,90,90,90,35,128,188,187,120,2,50,50,50,50,35,21,194,188,128,2,0,0,0,0,35,147,190,189,139,2,91,91,91,91,35,12,191,190,147,2,92,92,92,92], 
"vertices":[1,-1.31185,-1,1,-1.31185,1,-1,-1.31185,1,-1,-1.31185,-1,1,0.688149,-1,0.999999,0.688149,1,-1,0.688149,1,-1,0.688149,-1,1,2.68815,-1,0.999999,2.68815,1,-1,2.68815,1,-1,2.68815,-1,3,0.688149,-0.999998,3,0.688149,1,3,2.68815,-0.999998,3,2.68815,1,1,0.688149,-3,1,2.68815,-3,3,0.688149,-3,3,2.68815,-3,1,-1.31185,-0.999999,3,-1.31185,-0.999998,1,-1.31185,-3,3,-1.31185,-3,-0.9,-1.31185,-1,-0.9,-1.31185,1,-0.9,0.688149,-1,-0.9,0.688149,1,-0.9,2.68815,-1,-0.9,2.68815,1,0.905,-1.31185,-1,0.905,-1.31185,1,0.905001,0.688149,-1,0.904999,0.688149,1,0.905001,2.68815,-1,0.904999,2.68815,1,-1,2.58815,-1,-1,2.58815,1,0.999999,2.58815,1,1,2.58815,-1,3,2.58815,1,3,2.58815,-0.999998,1,2.58815,-3,3,2.58815,-3,-0.9,2.58815,1,-0.9,2.58815,-1,0.904999,2.58815,1,0.905001,2.58815,-1,-1,0.783149,-1,1,0.783149,-1,3,0.783149,-0.999998,1,0.783149,-3,3,0.783149,-3,-1,0.783149,1,0.999999,0.783149,1,3,0.783149,1,-0.9,0.783149,1,-0.9,0.783149,-1,0.904999,0.783149,1,0.905001,0.783149,-1,1,-1.21185,-1,1,-1.21185,1,-1,-1.21185,1,-1,-1.21185,-1,-0.9,-1.21185,1,-0.9,-1.21185,-1,0.905,-1.21185,1,0.905,-1.21185,-1,1,0.593149,-0.999999,0.999999,0.593149,1,-1,0.593149,1,-1,0.593149,-1,-0.9,0.593149,-1,0.905001,0.593149,-1,-0.9,0.593149,1,0.904999,0.593149,1,1,-1.31185,-0.9,-1,-1.31185,-0.9,1,0.688149,-0.9,-1,0.688149,-0.9,1,2.68815,-0.9,-1,2.68815,-0.9,3,0.688149,-0.899998,3,2.68815,-0.899998,-0.9,-1.31185,-0.9,-0.9,2.68815,-0.9,0.905,-1.31185,-0.9,0.905,2.68815,-0.9,-1,2.58815,-0.9,3,2.58815,-0.899998,-1,0.783149,-0.9,3,0.783149,-0.899998,1,-1.21185,-0.9,-1,-1.21185,-0.9,1,0.593149,-0.899999,-1,0.593149,-0.9,1,-1.31185,0.905,0.999999,0.688149,0.905001,0.999999,2.68815,0.905001,3,0.688149,0.905002,3,2.68815,0.905002,-0.9,2.68815,0.905,0.904999,2.68815,0.905001,3,2.58815,0.905002,3,0.783149,0.905002,1,-1.21185,0.905,0.999999,0.593149,0.905001,-1,-1.31185,0.905,-1,0.688149,0.905,-1,2.68815,0.905,-0.9,-1.31185,0.905,0.905,-1.31185,0.905,-1,2.58815,0.905,-1,0.783149,0.905,-1,-1.21185,0.905,-1,0.593149,0.905,1,2.68815,-2.9,3,2.68815,-2.9,3,0.688149,-2.9,1,0.688149,-2.9,3,-1.31185,-2.9,1,-1.31185,-2.9,3,2.58815,-2.9,1,2.58815,-2.9,3,0.783149,-2.9,1,0.783149,-2.9,1,2.68815,-1.095,3,0.688149,-1.095,3,-1.31185,-1.095,3,2.68815,-1.095,1,0.688149,-1.095,1,-1.31185,-1.095,3,2.58815,-1.095,1,2.58815,-1.095,3,0.783149,-1.095,1,0.783149,-1.095,1,-1.21185,-0.999999,1,-1.21185,-3,3,-1.21185,-3,3,-1.21185,-0.999998,1,-1.21185,-2.9,3,-1.21185,-2.9,3,-1.21185,-1.095,1,-1.21185,-1.095,1,0.593149,-0.999999,3,0.593149,-3,1,0.593149,-3,3,0.593149,-0.999998,1,0.593149,-2.9,3,0.593149,-2.9,3,0.593149,-1.095,1,0.593149,-1.095,1.1,0.688149,-0.999999,1.1,2.68815,-1,1.1,2.68815,1,1.1,0.688149,1,1.1,0.688149,-3,1.1,2.68815,-3,1.1,-1.31185,-0.999999,1.1,-1.31185,-3,1.1,2.58815,1,1.1,2.58815,-3,1.1,0.783149,1,1.1,0.783149,-3,1.1,2.68815,-0.9,1.1,0.688149,-0.899999,1.1,2.68815,0.905001,1.1,0.688149,0.905001,1.1,2.68815,-2.9,1.1,-1.31185,-2.9,1.1,2.68815,-1.095,1.1,-1.31185,-1.095,1.1,-1.21185,-3,1.1,-1.21185,-0.999999,1.1,0.593149,-3,1.1,0.593149,-0.999999,2.905,2.68815,-0.999999,2.905,0.688149,1,2.905,2.68815,-3,2.905,2.58815,1,2.905,2.58815,-3,2.905,0.783149,1,2.905,0.783149,-3,2.905,2.68815,-0.899999,2.905,0.688149,-0.899998,2.905,2.68815,0.905002,2.905,0.688149,0.905002,2.905,-1.31185,-2.9,2.905,-1.31185,-1.095,2.905,-1.21185,-0.999998,2.905,0.593149,-0.999998,2.905,0.688149,-0.999998,2.905,2.68815,1,2.905,0.688149,-3,2.905,-1.31185,-0.999998,2.905,-1.31185,-3,2.905,2.68815,-2.9,2.905,2.68815,-1.095,2.905,-1.21185,-3,2.905,0.593149,-3], 
"normals":[0,-1,0,-1,-0,0,1,1e-06,1e-06,-1e-06,1e-06,1,-1,0,0,0,0,-1,0,1,0,0,0,1,0,-0,-1,0,1,-0,1,0,0,-0,-1,0,-0,0,-1,1,0,-0,1,-0,0,-1e-06,0,1,-1e-06,0,1,0,0,-1,-1e-06,0,1,0,0,-1,-0,0,1,-0,0,1,0,0,-1,1e-06,0,-1,0,0,1,0,-0,-1,1,0,0,-1e-06,0,1,0,-0,-1,-1e-06,0,1,1e-06,-0,-1,-1e-06,0,1,0,0,-1,-1e-06,0,1,1e-06,0,-1,1,1e-06,0,0,0,-1,-0,-0,1,0,0,-1,-0,0,1,0,0,-1,1,0,0,-0,0,1,-1,-0,0,-0,-0,1,0,-0,1,0,-0,-1,1e-06,-1e-06,-1,-1,-0,-0,1,0,1e-06,0,-1,0,1,0,1e-06,1,0,1e-06,-1,0,-0,1,-0,0,-1,-0,-0,0,-1,0,-1,0,-0,1,0,1e-06,0,1,0,-1,-0,-0,1,0,0,1,-0,0,-1,0,0,-1,-0,0,0,1,-0,-1,0,-1e-06,-0,-1,0,-1,0,-1e-06,1,0,1e-06,-1e-06,0,1,-1e-06,1e-06,1,-1,0,-1e-06,-1e-06,0,1,-1e-06,0,1,-1e-06,0,1,-1e-06,0,1,-0,-1,0,0,1,-0,-0,-1,0,-1e-06,0,1,-1e-06,1e-06,1,-1e-06,0,1,-0,-1,0,1e-06,0,-1,1e-06,0,-1,-1e-06,0,1,-0,-1,0,0,1,-0,1e-06,0,-1,-1e-06,0,1,-1e-06,0,1,-1e-06,1e-06,1], 
"metadata":{ 
    "version":3, 
    "materials":6, 
    "type":"Geometry", 
    "faces":198, 
    "generator":"io_three", 
    "uvs":0, 
    "vertices":200, 
    "normals":93 
} 

}

我用的是最新的three.js所出口商攪拌器與攪拌機版本2.76。

你能告訴我我在做什麼錯誤的出口?

回答

0

問題不是導出,而是配置的燈。我添加了適當的光點,它工作。