IO_THREE for THREE.ObjectLoader has a bug: allows only one material per geometry, and only if material has no texture

By loading each scene object separately with JsonLoader, everything works fine.

However, once all objects are combined in one scene and scene file is exported from Blender,
THREEJS refuses to use JSONLoader, and you are obliged to use ObjectLoader.
However loaded object has only one material, if material has no texture, or no material at all, if material has texture.

THREE.JS is 0.88.0, Blender v2.79, IO_THREE: 4.3.
By googling I found the issue exists from 2015 already…

By parsing exported JSON I found the reason:
“geometries” section is correct and contains all geometries used in scene.
“object-children” section contains hierarchy of all geometries used in the scene.
For example, I have 3 road blocks, this is one geometry, but 3 entries under object section.

Then each of these entries contains both propetries “geometry” and “material”.

It seems to me to be a bug, as all materials should be taken from relevant “geometry” section.

Here is the same issue described 3 years ago:
https://stackoverflow.com/questions/29927755/exporting-a-scene-from-blender-to-threejs-every-object-has-just-one-single-mate

Author: Fantashit

1 thought on “IO_THREE for THREE.ObjectLoader has a bug: allows only one material per geometry, and only if material has no texture

  1. The glTF file format doesn’t have a way to include shadows other than ambient occlusion, so you’d need to enable them after loading the model.

Comments are closed.