obj在three.js objloader中缺少材料

时间:2018-09-21 16:58:37

标签: three.js 3d blender

我正在three.js中使用objloader,但是我正在使用的.obj不会加载材料。根据控制台,一切都可以在three.js中顺利进行。我在同一个文件夹中有三个obj文件,它们是-model.jpg,model.obj和model.mtl。

model.obj既具有对mtl的引用,也具有如下使用的材料:

Video.find().where('loc').near({
    center: {
        type: 'Point',
        coordinates: [
            55.289856,
            31.325142
        ],
    },
});

model.mtl具有以下内容:

responseVideos.map((video) => {
    console.log(Math.hypot(video.loc.coordinates[1] - 55.289856, video.loc.coordinates[1] - 31.325142));
});
>>>> 2.1736579767755537
>>>> 2.6594503191449155
>>>> 2.8134665450294607
>>>> 2.171157525376724
>>>> 2.4310460711389243
>>>> 2.238485648826011
>>>> 2.6172705248025068
>>>> 2.7076781566500854
>>>> 2.4489028155482235
>>>> 4.292246498047378
>>>> 4.07279682773398
>>>> 4.5517789928774
>>>> 4.242816517362022
>>>> 2.9175184660940907
>>>> 3.9102712182149224
>>>> 4.655497610352737
>>>> 3.7662588864813826
>>>> 3.778974596368699
>>>> 3.442893260035811
>>>> 3.6324131097660137
>>>> 4.379940638867155
>>>> 3.6450876532670686
>>>> 5.990268274459831
>>>> 4.888664643847032
>>>> 3.782466126748529
>>>> 5.169445811690071
>>>> 4.832384297631964
>>>> 5.82337651195593
>>>> 5.527610062224002
>>>> 4.226487075574698
>>>> 4.239155576291108
>>>> 6.130590917684851
>>>> 5.989765688238564
>>>> 4.770853592387845
>>>> 6.090041461271012
>>>> 6.424373121169099
>>>> 4.269145581963681
>>>> 4.303545631220844
>>>> 7.686065443385192
>>>> 6.940258352539912
>>>> 6.71299292417324
>>>> 5.348967937836229
>>>> 5.119370371442176
>>>> 4.646366537413936
>>>> 6.5104654979502055
>>>> 5.997867787805929
>>>> 4.775668853679036
>>>> 4.8263788703333255
>>>> 8.006312072358906
>>>> 6.877499036713855
>>>> 6.670511299743072
>>>> 4.904635562404207
>>>> 4.886741450087165
>>>> 5.525652993085977
>>>> 7.001095057203549
>>>> 5.1108876919768065
>>>> 6.211088873941507
>>>> 7.759343851125556
>>>> 7.279430334854509
>>>> 7.904809295612387
>>>> 5.357855634486619
>>>> 6.275979604810708
>>>> 6.765889815833538
>>>> 6.9261239521105855
>>>> 6.091173696423374
>>>> 6.9496227955191925
>>>> 7.375687425589565
>>>> 6.382381060388045
>>>> 7.682898216168166
>>>> 7.848096903071474
>>>> 6.694544794084213
>>>> 7.820605603148648
>>>> 7.331397138335912
>>>> 6.988071693965368
>>>> 7.223431940566756
>>>> 9.696935856238301
>>>> 7.3201978798390375
>>>> 8.84015050776852
>>>> 7.242431152589577
>>>> 7.491465677689511
>>>> 7.799286185286444
>>>> 8.896376902986967
>>>> 8.71524468962289
>>>> 8.307777199708713
>>>> 8.034161375028507
>>>> 10.688343417012762
>>>> 9.24718443635683
>>>> 8.646792006287646
>>>> 8.71507871450396
>>>> 10.551810318613578
>>>> 10.212125831578849
>>>> 10.283667925404824
>>>> 10.905132232118964
>>>> 11.067551355200479
>>>> 10.718344321769104
>>>> 10.842562473880422
>>>> 13.189092008170991
>>>> 12.3563448478909
>>>> 13.354754846121288

这里是否也应该没有jpg的地图线,或者还有其他缺少的东西?

1 个答案:

答案 0 :(得分:1)

  

这里是否也应该没有jpg的地图线,或者还有其他缺少的东西?

是的。通常,如果MTL实际上是指纹理(例如,漫反射贴图),则应该像下面的示例中那样附加一行。

newmtl $Material_0
Kd 0.6 0.6 0.6
Ka 0.05 0.05 0.05
Ks 0.6 0.6 0.6
illum 1
map_Kd diffuse.jpg