Search code examples
javascriptthree.jsgltf

Invisible material when exporting to .glb instead of .gltf


I have exported model using gltf exporter included in blender 2.8. Exporting to .gltf works fine but when exporting to .glb I cannot see the texture anymore. What is weird is that if I check .glb file in gltf viewer https://gltf-viewer.donmccurdy.com/ it works fine while in my environment and in three.js editor https://threejs.org/editor/ texture is black. Why does this happen and how to fix it? Does the gltf viewer load something differently? Here is the model to check for yourself https://drive.google.com/open?id=1gqdujds0VAgU__92GgTMsgWkO1BbbnPJ

glTF Viewer - works fine

Viewer

Three.js editor - black texture (ambientlight is added)

Editor


Solution

  • glTF Viewer - works fine

    That's because the viewer applies an environment map to the materials of your skinned mesh. This is not true for the editor. When you load the model in the viewer, just select for environment the value None in order to see this effect.

    Instead of using an environment map, you can also set the metalness value for all materials from 1 to 0. Why a metalness value of 1 is problematic in your case is explained here:

    https://stackoverflow.com/a/53349297/5250847