THREE.js: Loading model with JSONLoader loads only half of textures

好久不见. 提交于 2020-01-05 07:31:17

问题


After making a house model in blender I've exported it to three.js json format as a single object, but when adding it to scene I got half textures displayed and another half are just grey meshes.

JSON URL (with absolute texture images links): http://pobegushki.meetroll.net/inn1.js Screenshot of what I get in blender and what I get in production:

Also there are two instances of a barrel model which both has a perfectly mapped material. I tried setting barrel image as a material to floor (simple scaled box mesh), but nothing changed, it still remained grey.

Any ideas?


回答1:


I think there's a bug in the file loaders/Loader.js (Rev56). At line 332, try to replace:

if ( m.mapDiffuse && texturePath ) {

by

if ( m.mapDiffuse && texturePath != null ) {

(same bug for all types of textures of course)

I stumbled upon this bug this week-end, where my textures were not displayed because texturePath = "".




回答2:


TATATATAAAM! I've solved the problem (the stupid way tbh, but I got fully textured model).

Behold: http://touhou.ru/upload/56e75518ab580497358741bec62491ff.png

Blender three.js export was creating empty textures for all untextured meshes I got, and I tried copy-pasting non-empty materials to empties. After thousands of page refreshes I got right materials assigned to right meshes.

It took pretty much time, I think I should submit a bugreport :(

UPDATE: Here's why those materials were empty on export:

On the first picture I've selected a mesh which had texture in production and on the second is one which didn't.

Thanks for your attention!



来源:https://stackoverflow.com/questions/15192316/three-js-loading-model-with-jsonloader-loads-only-half-of-textures

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!